aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt
diff options
context:
space:
mode:
authormat <mat@FreeBSD.org>2015-01-19 20:48:05 +0800
committermat <mat@FreeBSD.org>2015-01-19 20:48:05 +0800
commitdcefac58fe21d10694d04e18e90ebb7c46d7c0fc (patch)
treed4c940a3d33ad98e5228e50f9b29578323c538ed /ports-mgmt
parentff40a287769bd54506659f80882cb3c94c7d0f84 (diff)
downloadfreebsd-ports-gnome-dcefac58fe21d10694d04e18e90ebb7c46d7c0fc.tar.gz
freebsd-ports-gnome-dcefac58fe21d10694d04e18e90ebb7c46d7c0fc.tar.zst
freebsd-ports-gnome-dcefac58fe21d10694d04e18e90ebb7c46d7c0fc.zip
Remove pkg_install support.
PR: 196762 Submitted by: mat Approved by: stefan Sponsored by: Absolight
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/pkg_cutleaves/Makefile19
-rw-r--r--ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves117
-rw-r--r--ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves.164
-rw-r--r--ports-mgmt/pkg_cutleaves/files/pkg_cutleaves48
-rw-r--r--ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.123
5 files changed, 21 insertions, 250 deletions
diff --git a/ports-mgmt/pkg_cutleaves/Makefile b/ports-mgmt/pkg_cutleaves/Makefile
index 37cc6ba7dd9c..1c959f370a8a 100644
--- a/ports-mgmt/pkg_cutleaves/Makefile
+++ b/ports-mgmt/pkg_cutleaves/Makefile
@@ -17,13 +17,6 @@ WRKSRC= ${WRKDIR}
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,25 +25,15 @@ post-patch:
@${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},' \
-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>
diff --git a/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves b/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves
deleted file mode 100644
index 997850013632..000000000000
--- a/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves
+++ /dev/null
@@ -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;
- }
diff --git a/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves.1 b/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves.1
deleted file mode 100644
index 4c48ee43c6e6..000000000000
--- a/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves.1
+++ /dev/null
@@ -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>
diff --git a/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves b/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves
index 8ba34bef2035..e9f1660a835a 100644
--- a/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves
+++ b/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves
@@ -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 File::Temp qw/ tempfile /;
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 @@ elsif ($opt{L}) {
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 @@ else {
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 @@ else {
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_excludelist {
#
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 @@ sub get_leaves {
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;
}
diff --git a/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1 b/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1
index 10242df60708..7d3aed46e75a 100644
--- a/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1
+++ b/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1
@@ -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 @@ see
.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 @@ descriptions. Will be ignored unless the
.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 @@ will be invoked instead of the default editor
.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>