FreeBSD Bugzilla – Attachment 151679 Details for
Bug 196762
ports-mgmt/pkg_cutleaves, Remove pkg_install support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
apply the pkg patch to the source
diff (text/plain), 13.06 KB, created by
Mathieu Arnold
on 2015-01-15 14:33:13 UTC
(
hide
)
Description:
apply the pkg patch to the source
Filename:
MIME Type:
Creator:
Mathieu Arnold
Created:
2015-01-15 14:33:13 UTC
Size:
13.06 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 376834) >+++ Makefile (working copy) >@@ -17,13 +17,6 @@ > > PLIST_FILES= sbin/pkg_cutleaves man/man1/pkg_cutleaves.1.gz > >-.include <bsd.port.pre.mk> >- >-.if defined(WITH_PKGNG) >-EXTRA_PATCHES+= ${FILESDIR}/extra-patch-pkg_cutleaves \ >- ${FILESDIR}/extra-patch-pkg_cutleaves.1 >-.endif >- > do-extract: > ${MKDIR} ${WRKSRC} > ${CP} ${FILESDIR}/pkg_cutleaves ${FILESDIR}/pkg_cutleaves.1 ${WRKSRC} >@@ -32,7 +25,6 @@ > @${REINPLACE_CMD} -e \ > 's,/usr/local/etc/pkg_leaves.exclude,${PREFIX}/etc/pkg_leaves.exclude,' \ > ${WRKSRC}/pkg_cutleaves.1 >-.if defined(WITH_PKGNG) > @${REINPLACE_CMD} \ > -e 's,/usr/local/etc/pkg_leaves.exclude,${PREFIX}/etc/pkg_leaves.exclude,' \ > -e 's,/usr/local/sbin/pkg delete -y,${PKG_DELETE},' \ >@@ -39,18 +31,9 @@ > -e 's,/usr/local/sbin/pkg query,${PKG_QUERY},' \ > -e 's,/usr/bin/perl,${PERL},' \ > ${WRKSRC}/pkg_cutleaves >-.else >- @${REINPLACE_CMD} \ >- -e 's,/usr/local/etc/pkg_leaves.exclude,${PREFIX}/etc/pkg_leaves.exclude,' \ >- -e 's,/usr/sbin/pkg_delete,${PKG_DELETE},' \ >- -e 's,/usr/local/sbin/pkgdb,${LOCALBASE}/sbin/pkgdb,' \ >- -e 's,/var/db/pkg,${PKG_DBDIR},' \ >- -e 's,/usr/bin/perl,${PERL},' \ >- ${WRKSRC}/pkg_cutleaves >-.endif > > do-install: > ${INSTALL_SCRIPT} ${WRKSRC}/pkg_cutleaves ${STAGEDIR}${PREFIX}/sbin/pkg_cutleaves > ${INSTALL_MAN} ${WRKSRC}/pkg_cutleaves.1 ${STAGEDIR}${MAN1PREFIX}/man/man1 > >-.include <bsd.port.post.mk> >+.include <bsd.port.mk> >Index: files/extra-patch-pkg_cutleaves >=================================================================== >--- files/extra-patch-pkg_cutleaves (revision 376834) >+++ files/extra-patch-pkg_cutleaves (working copy) >@@ -1,117 +0,0 @@ >-Index: pkg_cutleaves >-=================================================================== >-RCS file: /home/ncvs/ports/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves,v >-retrieving revision 1.3 >-diff -u -r1.3 pkg_cutleaves >---- pkg_cutleaves 12 Aug 2009 17:50:48 -0000 1.3 >-+++ pkg_cutleaves 6 Mar 2012 12:39:29 -0000 >-@@ -28,10 +28,9 @@ >- >- # Interactive script for deinstalling "leaf" packages >- # >--# Syntax: pkg_cutleaves [-cFgLlRVx] >-+# Syntax: pkg_cutleaves [-cgLlRVx] >- # Options: >- # -c: Show comments, too; only works with '-l' (ignored otherwise) >--# -F: Fix package db after each deinstallation run (via 'pkgdb -F') >- # -g: Generate exclude list from kept/installed leaf packages >- # -L: Interpret exclude file as list of packages that *should* be installed >- # -l: List leaf packages only, don't ask if they should be deinstalled >-@@ -43,15 +42,14 @@ >- use Getopt::Std; >- use strict; >- >--my $dbdir = "/var/db/pkg"; >- my $excludefile = "/usr/local/etc/pkg_leaves.exclude"; >--my $pkgdeinstall = "/usr/sbin/pkg_delete"; >--my @pkgdb_args = ("/usr/local/sbin/pkgdb", "-F"); >-+my @pkgdeinstall = (qw{/usr/local/sbin/pkg delete -y}); >-+my @pkgquery = (qw{/usr/local/sbin/pkg query}); >- my $exclpattern; >- my %leavestokeep; >- my %opt; >- >--getopts('cFgLlRVx', \%opt); >-+getopts('cgLlRVx', \%opt); >- set_excl_pattern(); >- >- # LIST MODE >-@@ -77,7 +75,7 @@ >- my ($file, $required) = @$pkg; >- # Clobber any exclude patterns that match this package >- for (my $i = 0; $i < @excludes; $i++) { >-- if ($file =~ /\Q@excludes[$i]\E/) { >-+ if ($file =~ /\Q$excludes[$i]\E/) { >- splice(@excludes, $i--, 1); >- } >- } >-@@ -219,7 +217,7 @@ >- foreach my $leaf (sort keys %leavestocut) { >- $noff++; >- print "Deleting $leaf (package $noff of $ncuts).\n"; >-- my @deinstall_args = ($pkgdeinstall, $leaf); >-+ my @deinstall_args = (@pkgdeinstall, $leaf); >- if ((my $status = system(@deinstall_args) >> 8) != 0) { >- print STDERR "\n\n$0: pkg_deinstall returned $status - exiting, fix this first.\n\n"; >- last ROUND; >-@@ -227,15 +225,6 @@ >- push @cutleaves, $leaf; >- } >- >-- # Run 'pkgdb -F' if requested >-- if ($opt{F}) { >-- print "Running 'pkgdb -F'.\n"; >-- if ((my $status = system(@pkgdb_args) >> 8) != 0) { >-- print STDERR "\n\n$0: pkgdb returned $status - exiting, fix this first.\n\n"; >-- last ROUND; >-- } >-- } >-- >- # Get new list of leaf packages and put them into a hash >- %leaves = get_leaves(); >- >-@@ -328,15 +317,13 @@ >- # >- sub get_packages { >- my @pkgs; >-- opendir(DBDIR, $dbdir) >-- or die "Can't open package db directory $dbdir!"; >-- while (defined(my $file = readdir(DBDIR))) { >-- my $path = join('/', $dbdir, $file); >-- unless ($file =~ /^\.+$/o || !(-d $path)) { >-- push @pkgs, [$file, -s $path . '/+REQUIRED_BY', join('/', $path, '+COMMENT')]; >-- } >-+ open(PKGQUERY, '-|', @pkgquery, '-a', '%n-%v\t%?r\t%c') >-+ or die "Couldn't read output from $pkgquery[0]!"; >-+ while (my $p = <PKGQUERY>) { >-+ chomp($p); >-+ push(@pkgs, [ split(/\t/, $p) ]); >- } >-- closedir DBDIR; >-+ close PKGQUERY; >- return @pkgs; >- } >- >-@@ -347,19 +334,14 @@ >- my %leaves; >- my @pkgs = get_packages(); >- foreach my $pkg (@pkgs) { >-- my ($file, $required, $commentfile) = @$pkg; >-+ my ($file, $required, $comment) = @$pkg; >- unless ($required) { >- if ($file =~ $exclpattern) { >- $leavestokeep{$file} = 1; >- } >- else { >-- # Read package's short description/comment >-- my $comment; >-- if ((-s $commentfile) && (open(COMMENT, $commentfile))) { >-- chomp($comment = <COMMENT>); >-- } >-- else { >-- $comment = 'No short description'; >-+ unless($comment) { >-+ $comment = 'No short description'; >- } >- $leaves{$file} = $comment; >- } >Index: files/extra-patch-pkg_cutleaves.1 >=================================================================== >--- files/extra-patch-pkg_cutleaves.1 (revision 376834) >+++ files/extra-patch-pkg_cutleaves.1 (working copy) >@@ -1,64 +0,0 @@ >-Index: pkg_cutleaves.1 >-=================================================================== >-RCS file: /home/ncvs/ports/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1,v >-retrieving revision 1.2 >-diff -u -r1.2 pkg_cutleaves.1 >---- pkg_cutleaves.1 25 Mar 2008 18:55:30 -0000 1.2 >-+++ pkg_cutleaves.1 6 Mar 2012 14:14:47 -0000 >-@@ -8,14 +8,14 @@ >- .Nd deinstall 'leaf' packages >- .Sh SYNOPSIS >- .Nm >--.Op Fl cFglRVx >-+.Op Fl cglRVx >- .Sh DESCRIPTION >- .Nm pkg_cutleaves >- finds installed >- .Dq Li "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_delete(1)). Once the packages marked for removal have been >-+pkg-delete(1)). Once the packages marked for removal have been >- flushed/deinstalled, you'll be asked if you want to do another run (i.e. to see >- packages that have become 'leaves' now because you've deinstalled the package(s) >- that depended on them. >-@@ -24,10 +24,6 @@ >- .Fl R >- below to bypass interactive dependency removal). In every run you will be shown >- only packages that you haven't marked for keeping, yet. >--.Pp >--Note that your package registry database should be up to date for this >--to work properly, so it might be a good idea to run pkgdb(1) before >--running >- .Nm . >- .Sh OPTIONS >- .Pp >-@@ -40,16 +36,6 @@ >- .Fl l >- parameter is given, too. >- .Pp >--.It Fl F >--Run >--.Dq Li "pkgdb -F" >--after each deinstallation run, to make sure the package registry database >--is up to date. ( >--.Ar Note: >--This is mostly for convenience; it shouldn't be necessary to run >--.Dq Li "pkgdb -F" >--after each run, but it doesn't hurt, either.) >--.Pp >- .It Fl L >- Interpret exclude file as a list of leaf packages that >- .Ar should >-@@ -147,8 +133,9 @@ >- .Xr vi 1 . >- .El >- .Sh SEE ALSO >--.Xr pkg_deinstall 1 , >--.Xr pkgdb 1 , >-+.Xr pkg 8 , >-+.Xr pkg-info 8 , >-+.Xe pkg-delete 8 , >- .Xr portsclean 1 >- .Sh AUTHOR >- .An Stefan Walter <sw@gegenunendlich.de> >Index: files/pkg_cutleaves >=================================================================== >--- files/pkg_cutleaves (revision 376834) >+++ files/pkg_cutleaves (working copy) >@@ -28,10 +28,9 @@ > > # Interactive script for deinstalling "leaf" packages > # >-# Syntax: pkg_cutleaves [-cFgLlRVx] >+# Syntax: pkg_cutleaves [-cgLlRVx] > # Options: > # -c: Show comments, too; only works with '-l' (ignored otherwise) >-# -F: Fix package db after each deinstallation run (via 'pkgdb -F') > # -g: Generate exclude list from kept/installed leaf packages > # -L: Interpret exclude file as list of packages that *should* be installed > # -l: List leaf packages only, don't ask if they should be deinstalled >@@ -43,15 +42,14 @@ > use Getopt::Std; > use strict; > >-my $dbdir = "/var/db/pkg"; > my $excludefile = "/usr/local/etc/pkg_leaves.exclude"; >-my $pkgdeinstall = "/usr/sbin/pkg_delete"; >-my @pkgdb_args = ("/usr/local/sbin/pkgdb", "-F"); >+my @pkgdeinstall = (qw{/usr/local/sbin/pkg delete -y}); >+my @pkgquery = (qw{/usr/local/sbin/pkg query}); > my $exclpattern; > my %leavestokeep; > my %opt; > >-getopts('cFgLlRVx', \%opt); >+getopts('cgLlRVx', \%opt); > set_excl_pattern(); > > # LIST MODE >@@ -77,7 +75,7 @@ > my ($file, $required) = @$pkg; > # Clobber any exclude patterns that match this package > for (my $i = 0; $i < @excludes; $i++) { >- if ($file =~ /\Q@excludes[$i]\E/) { >+ if ($file =~ /\Q$excludes[$i]\E/) { > splice(@excludes, $i--, 1); > } > } >@@ -219,7 +217,7 @@ > foreach my $leaf (sort keys %leavestocut) { > $noff++; > print "Deleting $leaf (package $noff of $ncuts).\n"; >- my @deinstall_args = ($pkgdeinstall, $leaf); >+ my @deinstall_args = (@pkgdeinstall, $leaf); > if ((my $status = system(@deinstall_args) >> 8) != 0) { > print STDERR "\n\n$0: pkg_deinstall returned $status - exiting, fix this first.\n\n"; > last ROUND; >@@ -227,15 +225,6 @@ > push @cutleaves, $leaf; > } > >- # Run 'pkgdb -F' if requested >- if ($opt{F}) { >- print "Running 'pkgdb -F'.\n"; >- if ((my $status = system(@pkgdb_args) >> 8) != 0) { >- print STDERR "\n\n$0: pkgdb returned $status - exiting, fix this first.\n\n"; >- last ROUND; >- } >- } >- > # Get new list of leaf packages and put them into a hash > %leaves = get_leaves(); > >@@ -328,15 +317,13 @@ > # > sub get_packages { > my @pkgs; >- opendir(DBDIR, $dbdir) >- or die "Can't open package db directory $dbdir!"; >- while (defined(my $file = readdir(DBDIR))) { >- my $path = join('/', $dbdir, $file); >- unless ($file =~ /^\.+$/o || !(-d $path)) { >- push @pkgs, [$file, -s $path . '/+REQUIRED_BY', join('/', $path, '+COMMENT')]; >- } >+ open(PKGQUERY, '-|', @pkgquery, '-a', '%n-%v\t%?r\t%c') >+ or die "Couldn't read output from $pkgquery[0]!"; >+ while (my $p = <PKGQUERY>) { >+ chomp($p); >+ push(@pkgs, [ split(/\t/, $p) ]); > } >- closedir DBDIR; >+ close PKGQUERY; > return @pkgs; > } > >@@ -347,20 +334,15 @@ > my %leaves; > my @pkgs = get_packages(); > foreach my $pkg (@pkgs) { >- my ($file, $required, $commentfile) = @$pkg; >+ my ($file, $required, $comment) = @$pkg; > unless ($required) { > if ($file =~ $exclpattern) { > $leavestokeep{$file} = 1; > } > else { >- # Read package's short description/comment >- my $comment; >- if ((-s $commentfile) && (open(COMMENT, $commentfile))) { >- chomp($comment = <COMMENT>); >+ unless($comment) { >+ $comment = 'No short description'; > } >- else { >- $comment = 'No short description'; >- } > $leaves{$file} = $comment; > } > } >Index: files/pkg_cutleaves.1 >=================================================================== >--- files/pkg_cutleaves.1 (revision 376834) >+++ files/pkg_cutleaves.1 (working copy) >@@ -8,7 +8,7 @@ > .Nd deinstall 'leaf' packages > .Sh SYNOPSIS > .Nm >-.Op Fl cFglRVx >+.Op Fl cglRVx > .Sh DESCRIPTION > .Nm pkg_cutleaves > finds installed >@@ -15,7 +15,7 @@ > .Dq Li "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_delete(1)). Once the packages marked for removal have been >+pkg-delete(1)). Once the packages marked for removal have been > flushed/deinstalled, you'll be asked if you want to do another run (i.e. to see > packages that have become 'leaves' now because you've deinstalled the package(s) > that depended on them. >@@ -24,10 +24,6 @@ > .Fl R > below to bypass interactive dependency removal). In every run you will be shown > only packages that you haven't marked for keeping, yet. >-.Pp >-Note that your package registry database should be up to date for this >-to work properly, so it might be a good idea to run pkgdb(1) before >-running > .Nm . > .Sh OPTIONS > .Pp >@@ -40,16 +36,6 @@ > .Fl l > parameter is given, too. > .Pp >-.It Fl F >-Run >-.Dq Li "pkgdb -F" >-after each deinstallation run, to make sure the package registry database >-is up to date. ( >-.Ar Note: >-This is mostly for convenience; it shouldn't be necessary to run >-.Dq Li "pkgdb -F" >-after each run, but it doesn't hurt, either.) >-.Pp > .It Fl L > Interpret exclude file as a list of leaf packages that > .Ar should >@@ -147,8 +133,9 @@ > .Xr vi 1 . > .El > .Sh SEE ALSO >-.Xr pkg_deinstall 1 , >-.Xr pkgdb 1 , >+.Xr pkg 8 , >+.Xr pkg-info 8 , >+.Xe pkg-delete 8 , > .Xr portsclean 1 > .Sh AUTHOR > .An Stefan Walter <sw@gegenunendlich.de>
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 196762
: 151679