From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Feb 8 06:40:10 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 84E8416A4CE for ; Sun, 8 Feb 2004 06:40:10 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 82E4F43D1F for ; Sun, 8 Feb 2004 06:40:10 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i18EeAbv002966 for ; Sun, 8 Feb 2004 06:40:10 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i18EeAQV002965; Sun, 8 Feb 2004 06:40:10 -0800 (PST) (envelope-from gnats) Resent-Date: Sun, 8 Feb 2004 06:40:10 -0800 (PST) Resent-Message-Id: <200402081440.i18EeAQV002965@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stefan Walter Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 949E916A4CE for ; Sun, 8 Feb 2004 06:35:04 -0800 (PST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4467443D1D for ; Sun, 8 Feb 2004 06:35:04 -0800 (PST) (envelope-from sw@gegenunendlich.de) Received: from [212.227.126.208] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1Apq1X-00082c-00 for FreeBSD-gnats-submit@freebsd.org; Sun, 08 Feb 2004 15:35:03 +0100 Received: from [80.142.196.110] (helo=kyuzo.dunkelkammer.void) (TLSv1:EDH-RSA-DES-CBC3-SHA:168) (Exim 3.35 #1) id 1Apq1X-00074V-00 for FreeBSD-gnats-submit@freebsd.org; Sun, 08 Feb 2004 15:35:03 +0100 Received: by kyuzo.dunkelkammer.void (Postfix, from userid 1002) id 495A03905; Sun, 8 Feb 2004 15:35:01 +0100 (CET) Message-Id: <20040208143501.495A03905@kyuzo.dunkelkammer.void> Date: Sun, 8 Feb 2004 15:35:01 +0100 (CET) From: Stefan Walter To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/62539: Update sysutils/pkg_cutleaves to pkg_cutleaves-20040207 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stefan Walter List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Feb 2004 14:40:10 -0000 >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 ) - 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: