ports/60763: Update port: sysutils/pkg_cutleaves to pkg_cutleaves-20031231

Stefan Walter sw at gegenunendlich.de
Wed Dec 31 14:20:37 UTC 2003


>Number:         60763
>Category:       ports
>Synopsis:       Update port: sysutils/pkg_cutleaves to pkg_cutleaves-20031231
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 31 06:20:16 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Walter
>Release:        FreeBSD 5.2-RC i386
>Organization:
Infinity Approximation Task Force
>Environment:
System: FreeBSD kyuzo.dunkelkammer.void 5.2-RC FreeBSD 5.2-RC #1: Thu Dec 25 20:45:48 CET 2003 root at kyuzo.dunkelkammer.void:/usr/obj/usr/src/sys/KYUZO i386

>Description:
Cosmetic update, no functional changes:

- exit automatically when there aren't any more packages to process
- send error messages to stderr
- ignore whitespace in user input, don't blindly get the first character
>How-To-Repeat:
	
>Fix:
--- pkg_cutleaves-20031231.patch begins here ---
diff -urN pkg_cutleaves.old/Makefile pkg_cutleaves/Makefile
--- pkg_cutleaves.old/Makefile	Wed Dec 31 15:03:00 2003
+++ pkg_cutleaves/Makefile	Wed Dec 31 15:06:30 2003
@@ -8,7 +8,7 @@
 #
 
 PORTNAME=	pkg_cutleaves
-PORTVERSION=	20031227
+PORTVERSION=	20031231
 CATEGORIES=	sysutils
 MASTER_SITES=	# none
 DISTFILES=	# none
diff -urN pkg_cutleaves.old/src/pkg_cutleaves pkg_cutleaves/src/pkg_cutleaves
--- pkg_cutleaves.old/src/pkg_cutleaves	Wed Dec 31 15:03:00 2003
+++ pkg_cutleaves/src/pkg_cutleaves	Wed Dec 31 15:06:00 2003
@@ -25,7 +25,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: ports/sysutils/pkg_cutleaves/src/pkg_cutleaves,v 1.3 2003/12/27 23:08:05 pav Exp $
+# $FreeBSD$
 
 # Interactive script for deinstalling "leaf" packages;
 # requires the portupgrade tools
@@ -156,31 +156,41 @@
 	ROUND: while($again eq "y") {
 		# Get list of leaf packages and put them into a hash
 		my %leaves = get_leaves($dbdir, $exclpattern);
+		# Ignore all leaves the user already told us to keep
+		foreach my $leaf (keys %leavestokeep) {
+			if ($leaves{$leaf}) {
+				delete $leaves{$leaf};
+			}
+		}
+		# Any leaves left?
+		if (keys(%leaves) == 0) {
+			# If not, don't go on, there's nothing left to do.
+			print "Didn't find any new leaves, exiting.\n";
+			last ROUND;
+		}
 		# Always start with an empty list of leaves to cut
 		%leavestocut = ();
 
 		LEAVESLOOP: foreach my $leaf (sort keys %leaves) {
-			if (!$leavestokeep{$leaf}) {
-				print "$leaf - $leaves{$leaf}\n";
-				print "$leaf - [keep]/(d)elete/(f)lush marked pkgs/(a)bort? ";
-				my $answer = substr(lc(<STDIN>), 0, 1);
-
-				if ($answer eq "d") {
-					print "** Marking $leaf for removal.\n\n";
-					$leavestocut{$leaf} = 1;
-				}
-				elsif ($answer eq "f") {
-					print "\n";
-					last LEAVESLOOP;
-				}
-				elsif ($answer eq "a") {
-					print "\n";
-					last ROUND;
-				}
-				else {
-					print "** Keeping $leaf.\n\n";
-					$leavestokeep{$leaf} = 1;
-				}
+			print "$leaf - $leaves{$leaf}\n";
+			print "$leaf - [keep]/(d)elete/(f)lush marked pkgs/(a)bort? ";
+			# Get first character of input, without leading whitespace
+			my ($answer) = (lc(<STDIN>) =~ m/(\S)/);
+			if ($answer eq "d") {
+				print "** Marking $leaf for removal.\n\n";
+				$leavestocut{$leaf} = 1;
+			}
+			elsif ($answer eq "f") {
+				print "\n";
+				last LEAVESLOOP;
+			}
+			elsif ($answer eq "a") {
+				print "\n";
+				last ROUND;
+			}
+			else {
+				print "** Keeping $leaf.\n\n";
+				$leavestokeep{$leaf} = 1;
 			}
 		} # LEAVESLOOP
 
@@ -190,7 +200,7 @@
 		# loop through packages marked for removal and pkg_deinstall them
 		foreach my $leaf (sort keys %leavestocut) {
 			$noff++;
-			print "Deleting $leaf, package $noff of $ncuts.\n";
+			print "Deleting $leaf (package $noff of $ncuts).\n";
 			my @deinstall_args;
 			if ($opt_recursive) {
 				@deinstall_args = ($pkgdeinstall, '-R', $leaf);
@@ -198,7 +208,7 @@
 				@deinstall_args = ($pkgdeinstall, $leaf);
 			}
 			if ((my $status = system(@deinstall_args) >> 8) != 0) {
-				print "\npkg_cutleaves: pkg_deinstall returned $status - exiting, fix this first.\n\n";
+				print STDERR "\n\n$0: pkg_deinstall returned $status - exiting, fix this first.\n\n";
 				last ROUND;
 			}
 			@cutleaves = (@cutleaves, $leaf);
@@ -208,13 +218,14 @@
 		if ($opt_pkgdb) {
 			print "Running 'pkgdb -F'.\n";
 			if ((my $status = system(@pkgdb_args) >> 8) != 0) {
-				print "\npkg_cutleaves: pkgdb returned $status - exiting, fix this first.\n\n";
+				print STDERR "\n\n$0: pkgdb returned $status - exiting, fix this first.\n\n";
 				last ROUND;
 			}
 		}
 
 		print "Go on with new leaf packages ((y)es/[no])? ";
-		$again = substr(lc(<STDIN>), 0, 1);
+		# Get first character of input, without leading whitespace
+		($again) = (lc(<STDIN>) =~ m/(\S)/);
 		print "\n";
 	} # ROUND
 
--- pkg_cutleaves-20031231.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list