From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Nov 15 08:50:26 2003 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 8468316A4CE for ; Sat, 15 Nov 2003 08:50:26 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DC4143FE5 for ; Sat, 15 Nov 2003 08:50:24 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id hAFGoNFY061512 for ; Sat, 15 Nov 2003 08:50:23 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id hAFGoNqM061511; Sat, 15 Nov 2003 08:50:23 -0800 (PST) (envelope-from gnats) Resent-Date: Sat, 15 Nov 2003 08:50:23 -0800 (PST) Resent-Message-Id: <200311151650.hAFGoNqM061511@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 DE92816A4CF for ; Sat, 15 Nov 2003 08:47:44 -0800 (PST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id E000943F75 for ; Sat, 15 Nov 2003 08:47:42 -0800 (PST) (envelope-from sw@gegenunendlich.de) Received: from [212.227.126.162] (helo=mrelayng.kundenserver.de) by moutng7.kundenserver.de with esmtp (Exim 3.35 #1) id 1AL3aI-0006uB-00 for FreeBSD-gnats-submit@freebsd.org; Sat, 15 Nov 2003 17:47:42 +0100 Received: from [80.142.209.23] (helo=kyuzo.dunkelkammer.void) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1AL3aH-0002HG-00 for FreeBSD-gnats-submit@freebsd.org; Sat, 15 Nov 2003 17:47:41 +0100 Received: by kyuzo.dunkelkammer.void (Postfix, from userid 1002) id DD12B3975; Sat, 15 Nov 2003 17:47:40 +0100 (CET) Message-Id: <20031115164740.DD12B3975@kyuzo.dunkelkammer.void> Date: Sat, 15 Nov 2003 17:47:40 +0100 (CET) From: Stefan Walter To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/59304: Maintainer update: sysutils/pkg_cutleaves -> pkg_cutleaves-20031115 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: Sat, 15 Nov 2003 16:50:26 -0000 >Number: 59304 >Category: ports >Synopsis: Maintainer update: sysutils/pkg_cutleaves -> pkg_cutleaves-20031115 >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: Sat Nov 15 08:50:23 PST 2003 >Closed-Date: >Last-Modified: >Originator: Stefan Walter >Release: FreeBSD 5.1-RELEASE-p2 i386 >Organization: Infinity Approximation Task Force >Environment: System: FreeBSD kyuzo.dunkelkammer.void 5.1-RELEASE-p2 FreeBSD 5.1-RELEASE-p2 #0: Wed Sep 24 11:41:19 CEST 2003 root@kyuzo.dunkelkammer.void:/usr/src/sys/i386/compile/KYUZO i386 >Description: Update sysutils/pkg_cutleaves. A few minor changes: - Show comment/short description of each package when it's offered for deinstallation - Optionally ('-c') print comments when listing leaves, too - _Sorted_ output of deinstalled packages >How-To-Repeat: Huh? >Fix: --- pkg_cutleaves-20031115.patch begins here --- diff -urN pkg_cutleaves.old/Makefile pkg_cutleaves/Makefile --- pkg_cutleaves.old/Makefile Sat Nov 15 17:11:22 2003 +++ pkg_cutleaves/Makefile Sat Nov 15 17:20:05 2003 @@ -8,7 +8,7 @@ # PORTNAME= pkg_cutleaves -PORTVERSION= 20030727 +PORTVERSION= 20031115 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 Sat Nov 15 17:11:22 2003 +++ pkg_cutleaves/src/pkg_cutleaves Sat Nov 15 17:18:14 2003 @@ -25,13 +25,14 @@ # 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.1 2003/09/30 14:19:27 leeym Exp $ +# $FreeBSD$ # Interactive script for deinstalling "leaf" packages; # requires the portupgrade tools # -# Syntax: pkg_cutleaves [-l] [-x] [-R] +# Syntax: pkg_cutleaves [-c] [-l] [-x] [-R] # Options: +# -c: Show comments, too; only works with '-l' (ignored otherwise) # -l: List leaf packages only, don't ask if they should be deinstalled # -x: Honor exclude list in $excludefile # -R: Run 'pkg_deinstall -R' instead of plain 'pkg_deinstall' @@ -41,7 +42,7 @@ my $dbdir = "/var/db/pkg"; my $excludefile = "/usr/local/etc/pkg_leaves.exclude"; my $pkgdeinstall = "/usr/local/sbin/pkg_deinstall"; -my ($opt_listonly, $opt_excludelist, $opt_recursive); +my ($opt_comments, $opt_listonly, $opt_excludelist, $opt_recursive); my $exclpattern; # Read the exclude list if the file exists @@ -71,26 +72,36 @@ return $excl_pattern; } -# Get a list of all leaves +# Get a hash (name => comment) of all leaves sub get_leaves { my $db_dir = $_[0]; my $excl_pattern = $_[1]; - my @pkgdirs; + my %leaves; opendir(DBDIR, $db_dir) or die "Can't open package db directory $db_dir!"; while(defined(my $file = readdir(DBDIR))) { my $path = $db_dir . '/' . $file; my $reqlist = $path . '/+REQUIRED_BY'; + my $commentfile = $path . '/+COMMENT'; # Exclude non-directories, "." and ".." - if (($file ne ".") && ($file ne "..") && (-d $path) && (!-s $reqlist)) { + if (($file ne ".") && ($file ne "..") && (-d $path) && (!-e $reqlist)) { # Exclude packages matching exclude pattern, if requested unless ($file =~ m/$excl_pattern/) { - @pkgdirs = (@pkgdirs, $file); + # Read package's short description/comment + my $comment; + if ((-s $commentfile) && (open(COMMENT, $commentfile))) { + $comment = ; + chomp($comment); + close(COMMENT); + } else { + $comment = "No short description"; + } + $leaves{$file} = $comment; } } } closedir(DBDIR); - return @pkgdirs; + return %leaves; } # Examine command line arguments @@ -102,8 +113,13 @@ elsif ($arg eq "-l") { $opt_listonly = 1; } + elsif ($arg eq "-c") { + $opt_comments = 1; + } elsif ($arg eq "-R") { $opt_recursive = 1; + } else { + warn "Unrecognized command line argument $arg ignored.\n"; } } @@ -118,9 +134,13 @@ if ($opt_listonly) { # Just print out the list of leaves, one per line - my @leaveslist = get_leaves($dbdir, $exclpattern); - foreach my $leaf (sort @leaveslist) { - print "$leaf\n"; + my %leaves = get_leaves($dbdir, $exclpattern); + foreach my $leaf (sort keys %leaves) { + if ($opt_comments) { + print "$leaf - $leaves{$leaf}\n"; + } else { + print "$leaf\n"; + } } } else { my %leavestokeep; @@ -130,9 +150,10 @@ my $again = "y"; ROUND: while($again eq "y") { # Get list of packages and put them into an array - my @leaves = get_leaves($dbdir, $exclpattern); - LEAVESLOOP: foreach my $leaf (sort @leaves) { + my %leaves = get_leaves($dbdir, $exclpattern); + 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(), 0, 1); @@ -177,9 +198,9 @@ print "\n"; } # ROUND - # print list of removed packages + # print list of removed packages, sorted lexically print "** Deinstalled packages:\n"; - foreach my $cutleaf (@cutleaves) { + foreach my $cutleaf (sort @cutleaves) { print "$cutleaf\n"; } } diff -urN pkg_cutleaves.old/src/pkg_cutleaves.1 pkg_cutleaves/src/pkg_cutleaves.1 --- pkg_cutleaves.old/src/pkg_cutleaves.1 Sat Nov 15 17:11:22 2003 +++ pkg_cutleaves/src/pkg_cutleaves.1 Sat Nov 15 17:12:04 2003 @@ -2,7 +2,7 @@ .SH NAME pkg_cutleaves \- deinstall 'leaf' packages .SH SYNOPSIS -.B pkg_cutleaves [-l] [-x] [-R] +.B pkg_cutleaves [-c] [-l] [-x] [-R] .SH DESCRIPTION .B pkg_cutleaves finds installed 'leaf' packages, i.e. packages that are not referenced @@ -18,6 +18,9 @@ to work properly, so it might be a good idea to run pkgdb(1) before running pkg_cutleaves. .SH OPTIONS +.IP -c +When listing leaf packages, also print their comments/short +descriptions. Will be ignored unless the '-l' parameter is given, too. .IP -l List leaf packages only, one per line, and don't ask for anything to be deinstalled. --- pkg_cutleaves-20031115.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: