svn commit: r377401 - in head/ports-mgmt/pkg_cutleaves: . files
Mathieu Arnold
mat at FreeBSD.org
Mon Jan 19 12:48:07 UTC 2015
Author: mat
Date: Mon Jan 19 12:48:05 2015
New Revision: 377401
URL: https://svnweb.freebsd.org/changeset/ports/377401
QAT: https://qat.redports.org/buildarchive/r377401/
Log:
Remove pkg_install support.
PR: 196762
Submitted by: mat
Approved by: stefan
Sponsored by: Absolight
Deleted:
head/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves
head/ports-mgmt/pkg_cutleaves/files/extra-patch-pkg_cutleaves.1
Modified:
head/ports-mgmt/pkg_cutleaves/Makefile
head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves
head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1
Modified: head/ports-mgmt/pkg_cutleaves/Makefile
==============================================================================
--- head/ports-mgmt/pkg_cutleaves/Makefile Mon Jan 19 12:40:12 2015 (r377400)
+++ head/ports-mgmt/pkg_cutleaves/Makefile Mon Jan 19 12:48:05 2015 (r377401)
@@ -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>
Modified: head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves
==============================================================================
--- head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves Mon Jan 19 12:40:12 2015 (r377400)
+++ head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves Mon Jan 19 12:48:05 2015 (r377401)
@@ -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 at 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;
}
Modified: head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1
==============================================================================
--- head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1 Mon Jan 19 12:40:12 2015 (r377400)
+++ head/ports-mgmt/pkg_cutleaves/files/pkg_cutleaves.1 Mon Jan 19 12:48:05 2015 (r377401)
@@ -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 e
.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 at gegenunendlich.de>
More information about the svn-ports-head
mailing list