Skip site navigation (1)Skip section navigation (2)
Date:      Sun,  8 Feb 2004 15:35:01 +0100 (CET)
From:      Stefan Walter <sw@gegenunendlich.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:    ports/62539: Update sysutils/pkg_cutleaves to pkg_cutleaves-20040207
Message-ID:  <20040208143501.495A03905@kyuzo.dunkelkammer.void>
Resent-Message-ID: <200402081440.i18EeAQV002965@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         62539
>Category:       ports
>Synopsis:       Update sysutils/pkg_cutleaves to pkg_cutleaves-20040207
>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:   Sun Feb 08 06:40:10 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Walter
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
Infinity Approximation Task Force
>Environment:
System: FreeBSD kyuzo.dunkelkammer.void 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Fri Feb 6 18:55:55 CET 2004 root@kyuzo.dunkelkammer.void:/usr/obj/usr/src/sys/KYUZO i386
>Description:
- provide a dummy exclusion pattern if the exclude file exists but
  doesn't contain any patterns (Yen-Ming Lee <leeym@FreeBSD.org>)
- progress status display for interactive phase, too
- minor code cleanups, improved comments/docs
>How-To-Repeat:
	
>Fix:
--- pkg_cutleaves-20040207.patch begins here ---
diff -urN pkg_cutleaves.old/Makefile pkg_cutleaves/Makefile
--- pkg_cutleaves.old/Makefile	Sun Feb  8 15:21:00 2004
+++ pkg_cutleaves/Makefile	Sun Feb  8 15:22:05 2004
@@ -8,7 +8,7 @@
 #
 
 PORTNAME=	pkg_cutleaves
-PORTVERSION=	20031231
+PORTVERSION=	20040207
 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	Sun Feb  8 15:21:00 2004
+++ pkg_cutleaves/src/pkg_cutleaves	Sun Feb  8 15:21:22 2004
@@ -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.4 2003/12/31 15:12:54 pav Exp $
+# $FreeBSD$
 
 # Interactive script for deinstalling "leaf" packages;
 # requires the portupgrade tools
@@ -47,9 +47,12 @@
 my ($opt_comments, $opt_listonly, $opt_excludelist, $opt_recursive, $opt_pkgdb);
 my $exclpattern;
 
+#
 # Read the exclude list if the file exists
+# Parameter: path of the exclude file
+#
 sub get_excl_pattern {
-	my $excl_file = $_[0];
+	my $excl_file = shift;
 	my $excl_pattern;
 	# Does the exclude file exist?
 	if (($excl_file) && (-f $excl_file) && (-T $excl_file)) {
@@ -62,11 +65,12 @@
 			# Ignore comments and empty lines, add others as regular expressions
 			unless (($exclude =~ m/(^ *#)|(^ *$)/)) {
 				$exclude = "^" . $exclude . ".*";
-				@excludes = (@excludes, $exclude);
+				push @excludes, $exclude;
 			}
 		}
 		close(EXCLFILE);
-		$excl_pattern = join("|", @excludes);
+		# Provide a dummy exclusion pattern if @excludes is empty
+		$excl_pattern = scalar(@excludes) ? join("|", @excludes) : " ";
 	} else {
 		# Dummy exclusion pattern -> doesn't exclude anything
 		$excl_pattern = " ";
@@ -74,10 +78,14 @@
 	return $excl_pattern;
 }
 
+#
 # Get a hash (name => comment) of all leaves
+# Parameters: - path to package database
+#             - pattern of packages to exclude
+#
 sub get_leaves {
-	my $db_dir = $_[0];
-	my $excl_pattern = $_[1];
+	my $db_dir = shift;
+	my $excl_pattern = shift;
 	my %leaves;
 	opendir(DBDIR, $db_dir)
 		or die "Can't open package db directory $db_dir!";
@@ -151,6 +159,7 @@
 	my %leavestokeep;
 	my %leavestocut;
 	my @cutleaves;
+	my ($nleaves, $i);
 	# Loop while the user wants to
 	my $again = "y";
 	ROUND: while($again eq "y") {
@@ -163,15 +172,19 @@
 			}
 		}
 		# Any leaves left?
-		if (keys(%leaves) == 0) {
+		$nleaves = keys %leaves;
+		if ($nleaves == 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 = ();
+		# Initialize counter for progress status
+		$i = 1;
 
 		LEAVESLOOP: foreach my $leaf (sort keys %leaves) {
+			print "Package $i of $nleaves:\n";
 			print "$leaf - $leaves{$leaf}\n";
 			print "$leaf - [keep]/(d)elete/(f)lush marked pkgs/(a)bort? ";
 			# Get first character of input, without leading whitespace
@@ -192,6 +205,7 @@
 				print "** Keeping $leaf.\n\n";
 				$leavestokeep{$leaf} = 1;
 			}
+			$i++;
 		} # LEAVESLOOP
 
 		# Initialize 'progress meter'
@@ -211,7 +225,7 @@
 				print STDERR "\n\n$0: pkg_deinstall returned $status - exiting, fix this first.\n\n";
 				last ROUND;
 			}
-			@cutleaves = (@cutleaves, $leaf);
+			push @cutleaves, $leaf;
 		}
 
 		# Run 'pkgdb -F' if requested
--- pkg_cutleaves-20040207.patch ends here ---

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040208143501.495A03905>