FreeBSD Bugzilla – Attachment 38286 Details for
Bug 60639
Update port: sysutils/pkg_cutleaves to pkg_cutleaves-20031227
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
pkg_cutleaves-20031227.patch
pkg_cutleaves-20031227.patch (text/plain), 7.21 KB, created by
Stefan Walter
on 2003-12-27 22:50:20 UTC
(
hide
)
Description:
pkg_cutleaves-20031227.patch
Filename:
MIME Type:
Creator:
Stefan Walter
Created:
2003-12-27 22:50:20 UTC
Size:
7.21 KB
patch
obsolete
>diff -urN pkg_cutleaves.old/Makefile pkg_cutleaves/Makefile >--- pkg_cutleaves.old/Makefile Sat Dec 27 23:05:37 2003 >+++ pkg_cutleaves/Makefile Sat Dec 27 23:16:08 2003 >@@ -8,7 +8,7 @@ > # > > PORTNAME= pkg_cutleaves >-PORTVERSION= 20031115 >+PORTVERSION= 20031227 > CATEGORIES= sysutils > MASTER_SITES= # none > DISTFILES= # none >@@ -42,6 +42,9 @@ > ${WRKDIR}/pkg_cutleaves > @${REINPLACE_CMD} -e \ > 's,/usr/local/sbin/pkg_deinstall,${LOCALBASE}/sbin/pkg_deinstall,' \ >+ ${WRKDIR}/pkg_cutleaves >+ @${REINPLACE_CMD} -e \ >+ 's,/usr/local/sbin/pkgdb,${LOCALBASE}/sbin/pkgdb,' \ > ${WRKDIR}/pkg_cutleaves > @${REINPLACE_CMD} -e \ > 's,/var/db/pkg,${PKG_DBDIR},' \ >diff -urN pkg_cutleaves.old/pkg-descr pkg_cutleaves/pkg-descr >--- pkg_cutleaves.old/pkg-descr Sat Dec 27 23:05:37 2003 >+++ pkg_cutleaves/pkg-descr Sat Dec 27 23:22:29 2003 >@@ -1,10 +1,3 @@ > pkg_cutleaves finds installed 'leaf' packages, i.e. packages that are > not referenced by any other installed package, and lets you decide for > each one if you want to keep or deinstall it (via pkg_deinstall(1)). >- >-Usage: pkg_cutleaves [-l] [-x] [-R] >- -l: List leaf packages only, one per line, and don't ask for anything >- to be deinstalled. >- -x: Exclude packages matching expressions given in the exclude file. >- -R: Run 'pkg_deinstall -R' instead of plain 'pkg_deinstall', so packages >- the removed leaf packages depend(ed) on will be deinstalled, too. >diff -urN pkg_cutleaves.old/src/pkg_cutleaves pkg_cutleaves/src/pkg_cutleaves >--- pkg_cutleaves.old/src/pkg_cutleaves Sat Dec 27 23:05:37 2003 >+++ pkg_cutleaves/src/pkg_cutleaves Sat Dec 27 23:11:38 2003 >@@ -25,24 +25,26 @@ > # 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.2 2003/11/16 18:50:53 pav Exp $ >+# $FreeBSD$ > > # Interactive script for deinstalling "leaf" packages; > # requires the portupgrade tools > # >-# Syntax: pkg_cutleaves [-c] [-l] [-x] [-R] >+# Syntax: pkg_cutleaves [-c] [-F] [-l] [-R] [-x] > # Options: > # -c: Show comments, too; only works with '-l' (ignored otherwise) >+# -F: Fix package db after each deinstallation run (via 'pkgdb -F') > # -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' >+# -x: Honor exclude list in $excludefile > > use strict; > > my $dbdir = "/var/db/pkg"; > my $excludefile = "/usr/local/etc/pkg_leaves.exclude"; > my $pkgdeinstall = "/usr/local/sbin/pkg_deinstall"; >-my ($opt_comments, $opt_listonly, $opt_excludelist, $opt_recursive); >+my @pkgdb_args = ("/usr/local/sbin/pkgdb", "-F"); >+my ($opt_comments, $opt_listonly, $opt_excludelist, $opt_recursive, $opt_pkgdb); > my $exclpattern; > > # Read the exclude list if the file exists >@@ -84,7 +86,7 @@ > my $reqlist = $path . '/+REQUIRED_BY'; > my $commentfile = $path . '/+COMMENT'; > # Exclude non-directories, "." and ".." >- if (($file ne ".") && ($file ne "..") && (-d $path) && (!-e $reqlist)) { >+ if (($file ne ".") && ($file ne "..") && (-d $path) && (!-s $reqlist)) { > # Exclude packages matching exclude pattern, if requested > unless ($file =~ m/$excl_pattern/) { > # Read package's short description/comment >@@ -107,17 +109,20 @@ > # Examine command line arguments > while(@ARGV) { > my $arg = shift(@ARGV); >- if ($arg eq "-x") { >- $opt_excludelist = 1; >+ if ($arg eq "-c") { >+ $opt_comments = 1; >+ } >+ elsif ($arg eq "-F") { >+ $opt_pkgdb = 1; > } > elsif ($arg eq "-l") { > $opt_listonly = 1; > } >- elsif ($arg eq "-c") { >- $opt_comments = 1; >- } > elsif ($arg eq "-R") { > $opt_recursive = 1; >+ } >+ elsif ($arg eq "-x") { >+ $opt_excludelist = 1; > } else { > warn "Unrecognized command line argument $arg ignored.\n"; > } >@@ -149,8 +154,11 @@ > # Loop while the user wants to > my $again = "y"; > ROUND: while($again eq "y") { >- # Get list of packages and put them into an array >+ # Get list of leaf packages and put them into a hash > my %leaves = get_leaves($dbdir, $exclpattern); >+ # 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"; >@@ -175,10 +183,14 @@ > } > } > } # LEAVESLOOP >- >+ >+ # Initialize 'progress meter' >+ my $ncuts = keys %leavestocut; >+ my $noff = 0; > # loop through packages marked for removal and pkg_deinstall them > foreach my $leaf (sort keys %leavestocut) { >- print "Deleting $leaf.\n"; >+ $noff++; >+ print "Deleting $leaf, package $noff of $ncuts.\n"; > my @deinstall_args; > if ($opt_recursive) { > @deinstall_args = ($pkgdeinstall, '-R', $leaf); >@@ -186,22 +198,32 @@ > @deinstall_args = ($pkgdeinstall, $leaf); > } > if ((my $status = system(@deinstall_args) >> 8) != 0) { >- print "\nError: pkg_deinstall returned $status - exiting, fix this first.\n\n"; >+ print "\npkg_cutleaves: pkg_deinstall returned $status - exiting, fix this first.\n\n"; > last ROUND; > } > @cutleaves = (@cutleaves, $leaf); >- delete $leavestocut{$leaf}; > } >- >- print "Once more ((y)es/[no])? "; >+ >+ # Run 'pkgdb -F' if requested >+ 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"; >+ last ROUND; >+ } >+ } >+ >+ print "Go on with new leaf packages ((y)es/[no])? "; > $again = substr(lc(<STDIN>), 0, 1); > print "\n"; > } # ROUND > >- # print list of removed packages, sorted lexically >+ # print list of removed packages, sorted lexically, and their number > print "** Deinstalled packages:\n"; > foreach my $cutleaf (sort @cutleaves) { > print "$cutleaf\n"; > } >+ my $noff = @cutleaves; >+ print "** Number of deinstalled packages: $noff\n"; > } > >diff -urN pkg_cutleaves.old/src/pkg_cutleaves.1 pkg_cutleaves/src/pkg_cutleaves.1 >--- pkg_cutleaves.old/src/pkg_cutleaves.1 Sat Dec 27 23:05:37 2003 >+++ pkg_cutleaves/src/pkg_cutleaves.1 Sat Dec 27 23:13:13 2003 >@@ -2,7 +2,7 @@ > .SH NAME > pkg_cutleaves \- deinstall 'leaf' packages > .SH SYNOPSIS >-.B pkg_cutleaves [-c] [-l] [-x] [-R] >+.B pkg_cutleaves [-c] [-F] [-l] [-R] [-x] > .SH DESCRIPTION > .B pkg_cutleaves > finds installed 'leaf' packages, i.e. packages that are not referenced >@@ -21,14 +21,19 @@ > .IP -c > When listing leaf packages, also print their comments/short > descriptions. Will be ignored unless the '-l' parameter is given, too. >+.IP -F >+Run 'pkgdb -F' after each deinstallation run, to make sure the package >+registry database is up to date. (Note: This is mostly for convenience; >+it shouldn't be necessary to run 'pkgdb -F' after each run, but it >+doesn't hurt, either.) > .IP -l > List leaf packages only, one per line, and don't ask for anything to be > deinstalled. >-.IP -x >-Exclude packages matching expressions given in the exclude file. > .IP -R > Run 'pkg_deinstall -R' instead of plain 'pkg_deinstall', so packages the > removed leaf packages depend(ed) on will be deinstalled, too. >+.IP -x >+Exclude packages matching expressions given in the exclude file. > .SH FILES > .I /usr/local/etc/pkg_leaves.exclude > .RS >@@ -40,4 +45,4 @@ > .SH AUTHOR > Stefan Walter <sw@gegenunendlich.de> > .SH SEE ALSO >-pkg_deinstall(1), portsclean(1) >+pkg_deinstall(1), pkgdb(1), portsclean(1)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 60639
: 38286