From 82f29222294e5a1410c445016b60f0c7d7a77b27 Mon Sep 17 00:00:00 2001 From: agc Date: Fri, 9 Oct 1998 09:35:39 +0000 Subject: [PATCH] Fix a bug in pkg_info -f with @pkgcfl entries. --- usr.sbin/pkg_install/create/pkg_create.1 | 7 +++--- usr.sbin/pkg_install/info/perform.c | 6 ++--- usr.sbin/pkg_install/info/show.c | 12 ++++++--- usr.sbin/pkg_install/lib/lib.h | 31 +++++++++++++++++------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1 index 54ca3e0809e0..228ea9aa6fd9 100644 --- a/usr.sbin/pkg_install/create/pkg_create.1 +++ b/usr.sbin/pkg_install/create/pkg_create.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_create.1,v 1.9 1998/10/09 09:22:16 agc Exp $ +.\" $NetBSD: pkg_create.1,v 1.10 1998/10/09 09:35:39 agc Exp $ .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. @@ -86,9 +86,8 @@ or, if preceded by .Cm - , the argument itself. .It Fl O -Go into a `packing list Only' mode. This is a custom hack for the -.Em "FreeBSD Ports Collection" -and is used to do `fake pkg_add' operations when a port is installed. +Go into a `packing list Only' mode. +This is used to do `fake pkg_add' operations when a package is installed. In such cases, it is necessary to know what the final, adjusted packing list will look like. .It Fl v diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index 0cf28cfa314d..18613806e4d1 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -1,11 +1,11 @@ -/* $NetBSD: perform.c,v 1.15 1998/10/08 12:58:00 agc Exp $ */ +/* $NetBSD: perform.c,v 1.16 1998/10/09 09:35:39 agc Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.15 1998/10/08 12:58:00 agc Exp $"); +__RCSID("$NetBSD: perform.c,v 1.16 1998/10/09 09:35:39 agc Exp $"); #endif #endif @@ -154,7 +154,7 @@ pkg_do(char *pkg) if ((Flags & SHOW_DISPLAY) && fexists(DISPLAY_FNAME)) show_file("Install notice:\n", DISPLAY_FNAME); if (Flags & SHOW_PLIST) - show_plist("Packing list:\n", &plist, (plist_t) - 1); + show_plist("Packing list:\n", &plist, PLIST_SHOW_ALL); if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME)) show_file("Install script:\n", INSTALL_FNAME); if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME)) diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index 26a5802f1cc7..e0f6f1eadf74 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -1,11 +1,11 @@ -/* $NetBSD: show.c,v 1.5 1997/10/17 14:54:20 lukem Exp $ */ +/* $NetBSD: show.c,v 1.6 1998/10/09 09:35:39 agc Exp $ */ #include #ifndef lint #if 0 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp"; #else -__RCSID("$NetBSD: show.c,v 1.5 1997/10/17 14:54:20 lukem Exp $"); +__RCSID("$NetBSD: show.c,v 1.6 1998/10/09 09:35:39 agc Exp $"); #endif #endif @@ -76,7 +76,7 @@ show_index(char *title, char *fname) fclose(fp); } -/* Show a packing list item type. If type is -1, show all */ +/* Show a packing list item type. If type is PLIST_SHOW_ALL, show all */ void show_plist(char *title, Package *plist, plist_t type) { @@ -87,7 +87,7 @@ show_plist(char *title, Package *plist, plist_t type) printf("%s%s", InfoPrefix, title); p = plist->head; while (p) { - if (p->type != type && type != -1) { + if (p->type != type && type != PLIST_SHOW_ALL) { p = p->next; continue; } @@ -166,6 +166,10 @@ show_plist(char *title, Package *plist, plist_t type) printf(Quiet ? "@dirrm %s\n" : "\tDeinstall directory remove: %s\n", p->name); break; + case PLIST_PKGCFL: + printf(Quiet ? "@pkgcfl %s\n" : "\tPackage conflicts with: %s\n", p->name); + break; + default: cleanup(0); errx(2, "unknown command type %d (%s)", p->type, p->name); diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 365fa9ddee77..1463f7039b4e 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.12 1998/10/09 09:22:17 agc Exp $ */ +/* $NetBSD: lib.h,v 1.13 1998/10/09 09:35:40 agc Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -80,14 +80,27 @@ /* The name of the "prefix" environment variable given to scripts */ #define PKG_PREFIX_VNAME "PKG_PREFIX" -enum _plist_t { - PLIST_FILE, PLIST_CWD, PLIST_CMD, PLIST_CHMOD, - PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE, - PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY, - PLIST_PKGDEP, PLIST_MTREE, PLIST_DIR_RM, PLIST_IGNORE_INST, - PLIST_OPTION, PLIST_PKGCFL -}; -typedef enum _plist_t plist_t; +typedef enum _plist_t { + PLIST_SHOW_ALL = -1, + PLIST_FILE, + PLIST_CWD, + PLIST_CMD, + PLIST_CHMOD, + PLIST_CHOWN, + PLIST_CHGRP, + PLIST_COMMENT, + PLIST_IGNORE, + PLIST_NAME, + PLIST_UNEXEC, + PLIST_SRC, + PLIST_DISPLAY, + PLIST_PKGDEP, + PLIST_MTREE, + PLIST_DIR_RM, + PLIST_IGNORE_INST, + PLIST_OPTION, + PLIST_PKGCFL +} plist_t; /* Types */ typedef unsigned int Boolean;