pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/32827: pkg_info improvement
>Number: 32827
>Category: pkg
>Synopsis: add -A option to pkg_info to make it only show Application
>packages (that are not required by anybody)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Feb 13 21:50:00 +0000 2006
>Originator: Iain Hibbert
>Release: NetBSD 3.99.15
>Organization:
http://maps.google.com/maps?q=ireland&ll=52.2711,-9.8630&spn=0.0244,0.0822&t=k
>Environment:
System: NetBSD galant 3.99.15 NetBSD 3.99.15 (GALANT) #52: Mon Feb 13 10:28:09
GMT 2006 plunky@galant:/home/plunky/src/sys/arch/i386/compile/GALANT i386
Architecture: i386
Machine: i386
>Description:
Using 'pkg_info -u' to get a list of packages to install does not always
work well when the stupid user has been updating packages manually. This
patch adds an -A for Application option that causes pkg_info to only print
packages that do not have any other packages depending on them (ie Apps)
This patch doesnt work completely either, since build dependencies show
up in the list but that could be a feature if you look at it hard enough..
% pkg_info -A | wc -l
64
% pkg_info -a | wc -l
260
% pkg_info -u | wc -l
169
iain
>How-To-Repeat:
>Fix:
Index: usr.sbin/pkg_install/info/info.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/info/info.h,v
retrieving revision 1.21
diff -u -r1.21 info.h
--- usr.sbin/pkg_install/info/info.h 3 Nov 2005 21:16:41 -0000 1.21
+++ usr.sbin/pkg_install/info/info.h 13 Feb 2006 21:32:38 -0000
@@ -56,6 +56,7 @@
enum which {
WHICH_ALL,
WHICH_USER,
+ WHICH_APPS,
WHICH_LIST
};
Index: usr.sbin/pkg_install/info/main.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.47
diff -u -r1.47 main.c
--- usr.sbin/pkg_install/info/main.c 5 Nov 2005 13:11:02 -0000 1.47
+++ usr.sbin/pkg_install/info/main.c 13 Feb 2006 21:32:38 -0000
@@ -50,7 +50,7 @@
#include "lib.h"
#include "info.h"
-static const char Options[] = ".aBbcDde:fFhIiK:kLl:mNnpQ:qRrsSuvV";
+static const char Options[] = ".AaBbcDde:fFhIiK:kLl:mNnpQ:qRrsSuvV";
int Flags = 0;
enum which Which = WHICH_LIST;
@@ -88,6 +88,10 @@
case '.': /* for backward compatibility */
break;
+ case 'A':
+ Which = WHICH_APPS;
+ break;
+
case 'a':
Which = WHICH_ALL;
break;
@@ -218,13 +222,13 @@
if (argc == 0 && !Flags && !CheckPkg) {
/* No argument or relevant flags specified - assume -I */
Flags = SHOW_INDEX;
- /* assume -a if neither -u nor -a is given */
+ /* assume -a if none of -u, -A nor -a is given */
if (Which == WHICH_LIST)
Which = WHICH_ALL;
}
if (argc != 0 && Which != WHICH_LIST) {
- warnx("can't use both -a/-u and package name");
+ warnx("can't use both -A/-a/-u and package name");
usage();
}
Index: usr.sbin/pkg_install/info/perform.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/info/perform.c,v
retrieving revision 1.67
diff -u -r1.67 perform.c
--- usr.sbin/pkg_install/info/perform.c 23 Nov 2005 04:59:14 -0000 1.67
+++ usr.sbin/pkg_install/info/perform.c 13 Feb 2006 21:32:40 -0000
@@ -386,6 +386,16 @@
exit(1);
}
+static Boolean
+is_orphan(const char *path)
+{
+ char buf[MaxPathSize];
+
+ (void)snprintf(buf, sizeof(buf), "%s/%s", path, REQUIRED_BY_FNAME);
+
+ return isemptyfile(buf);
+}
+
int
pkg_perform(lpkg_head_t *pkghead)
{
@@ -426,7 +436,8 @@
continue;
if (Which == WHICH_ALL
- || !is_automatic_installed(tmp2))
+ || (Which == WHICH_USER &&
!is_automatic_installed(tmp2))
+ || (Which == WHICH_APPS &&
is_orphan(tmp2)))
err_cnt += pkg_do(dp->d_name);
}
(void) closedir(dirp);
Index: usr.sbin/pkg_install/info/pkg_info.1
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/info/pkg_info.1,v
retrieving revision 1.50
diff -u -r1.50 pkg_info.1
--- usr.sbin/pkg_install/info/pkg_info.1 3 Nov 2005 21:16:41 -0000
1.50
+++ usr.sbin/pkg_install/info/pkg_info.1 13 Feb 2006 21:32:40 -0000
@@ -31,7 +31,7 @@
.Op Fl l Ar prefix
.Ar pkg-name ...
.Nm
-.Op Fl a | Fl u
+.Op Fl A | Fl a | Fl u
.Op flags
.Nm
.Op Fl Q Ar variable
@@ -58,6 +58,9 @@
.Pp
The following command-line options are supported:
.Bl -tag -width indent
+.It Fl A
+Show information for packages which have no other packages depending on
+them.
.It Fl a
Show information for all currently installed packages.
See also
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index