Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pkgviews]: src/usr.sbin/pkg_install If "-n" is passed to pkg_delete(1), ...



details:   https://anonhg.NetBSD.org/src/rev/cb48e2efc3bf
branches:  pkgviews
changeset: 534253:cb48e2efc3bf
user:      jlam <jlam%NetBSD.org@localhost>
date:      Sun Aug 17 22:02:20 2003 +0000

description:
If "-n" is passed to pkg_delete(1), then we're just faking deinstallation,
so don't remove the +VIEWS registration in the depoted package.

If we're removing a package from a view using pkg_delete(1), then don't
bother trying to remove the package from dependencies' +REQUIRED_BY files
since pkg_delete(1) would try to remove them from the dependencies in the
view, and they may just not be in the view at all.

Teach pkg_view(1) to not copy the +REQUIRED_BY file from the depoted
package into PKG_DBDIR when adding a package to a view; the information
just isn't relevant to a package in a view.  Also teach pkg_view(1) to not
delete the package if there _is_ a +REQUIRED_BY file present, since its
presence implies that there is an "overwrite" package that depends on that
package in the view.

Bump the version to 20030810.

diffstat:

 usr.sbin/pkg_install/delete/perform.c |  32 ++++++++++++++++++++------------
 usr.sbin/pkg_install/lib/version.h    |   4 ++--
 usr.sbin/pkg_install/view/pkg_view.sh |  15 +++++++++++++--
 3 files changed, 35 insertions(+), 16 deletions(-)

diffs (108 lines):

diff -r 05ca42889ba1 -r cb48e2efc3bf usr.sbin/pkg_install/delete/perform.c
--- a/usr.sbin/pkg_install/delete/perform.c     Sun Aug 17 04:55:20 2003 +0000
+++ b/usr.sbin/pkg_install/delete/perform.c     Sun Aug 17 22:02:20 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.36.2.7 2003/08/16 22:11:22 jlam Exp $    */
+/*     $NetBSD: perform.c,v 1.36.2.8 2003/08/17 22:02:20 jlam Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.36.2.7 2003/08/16 22:11:22 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.36.2.8 2003/08/17 22:02:20 jlam Exp $");
 #endif
 #endif
 
@@ -758,17 +758,25 @@
                "(perhaps the packing list is incorrectly specified?)", pkg);
        }
        if (!isemptyfile(DEPOT_FNAME)) {
-               (void) unview(pkg);
+               if (Verbose)
+                       printf("Attempting to remove the %s registration on package `%s'\n", VIEWS_FNAME, pkg);
+               if (!Fake)
+                       (void) unview(pkg);
        }
-       /* Remove this package from the +REQUIRED_BY list of the packages this depends on */
-       for (p = Plist.head; p; p = p->next) {
-               if (p->type != PLIST_PKGDEP)
-                       continue;
-               if (Verbose)
-                       printf("Attempting to remove dependency on package `%s'\n", p->name);
-               if (!Fake)
-                       findmatchingname((tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR,
-                           p->name, undepend, pkg);
+       /*
+        * If this isn't a package in a view, then remove this package
+        * from the +REQUIRED_BY list of the packages this depends on.
+        */
+       if (!fexists(DEPOT_FNAME)) {
+               for (p = Plist.head; p; p = p->next) {
+                       if (p->type != PLIST_PKGDEP)
+                               continue;
+                       if (Verbose)
+                               printf("Attempting to remove dependency on package `%s'\n", p->name);
+                       if (!Fake)
+                               findmatchingname((tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR,
+                                   p->name, undepend, pkg);
+               }
        }
        if (Recurse_down) {
                /* Also remove the packages further down, now that there's
diff -r 05ca42889ba1 -r cb48e2efc3bf usr.sbin/pkg_install/lib/version.h
--- a/usr.sbin/pkg_install/lib/version.h        Sun Aug 17 04:55:20 2003 +0000
+++ b/usr.sbin/pkg_install/lib/version.h        Sun Aug 17 22:02:20 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.13.4.9 2003/08/17 04:55:23 jlam Exp $    */
+/*     $NetBSD: version.h,v 1.13.4.10 2003/08/17 22:02:21 jlam Exp $   */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -33,6 +33,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20030809"
+#define PKGTOOLS_VERSION "20030810"
 
 #endif /* _INST_LIB_VERSION_H_ */
diff -r 05ca42889ba1 -r cb48e2efc3bf usr.sbin/pkg_install/view/pkg_view.sh
--- a/usr.sbin/pkg_install/view/pkg_view.sh     Sun Aug 17 04:55:20 2003 +0000
+++ b/usr.sbin/pkg_install/view/pkg_view.sh     Sun Aug 17 22:02:20 2003 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: pkg_view.sh,v 1.1.2.21 2003/08/17 04:55:23 jlam Exp $
+# $NetBSD: pkg_view.sh,v 1.1.2.22 2003/08/17 22:02:21 jlam Exp $
 
 #
 # Copyright (c) 2001 Alistair G. Crooks.  All rights reserved.
@@ -149,7 +149,13 @@
                        ($grepprog -v '^'${pkg_dbdir}'$' ${temp} || true; echo ${pkg_dbdir}) > ${depot_pkg_dbdir}/$1/+VIEWS
                        $rmprog ${temp}
                        $mkdirprog -p ${pkg_dbdir}/$1
-                       (cd ${depot_pkg_dbdir}/$1; $paxprog -rwpe '-s|\./\+VIEWS$||' ./+* ${pkg_dbdir}/$1)
+                       #
+                       # Copy all of the metadata files except for +VIEWS,
+                       # which is only for the depoted package, and
+                       # +REQUIRED_BY, which is irrelevant for a package in
+                       # a view.
+                       #
+                       (cd ${depot_pkg_dbdir}/$1; $paxprog -rwpe '-s|\./\+VIEWS$||' '-s|\./\+REQUIRED_BY$||' ./+* ${pkg_dbdir}/$1)
                        $sedprog -e 's|'${depot_pkg_dbdir}/$1'|'${targetdir}'|g' < ${depot_pkg_dbdir}/$1/+CONTENTS > ${pkg_dbdir}/$1/+CONTENTS
                        echo "${depot_pkg_dbdir}/$1" > ${pkg_dbdir}/$1/+DEPOT
                        if [ -f ${pkg_dbdir}/$1/+INSTALL ]; then
@@ -174,6 +180,11 @@
                        if [ "${verbose}" = "yes" ]; then
                                echo "Deleting package $1 from $viewstr in ${viewbase}."
                        fi
+                       if [ -f ${pkg_dbdir}/$1/+REQUIRED_BY ]; then
+                               (echo "pkg_view: package \`$1' is required by other packages:"
+                               $sedprog -e 's|^|       |' ${pkg_dbdir}/$1/+REQUIRED_BY) 1>&2
+                               exit 1
+                       fi
                        if [ -f ${pkg_dbdir}/$1/+DEINSTALL ]; then
                                $chmodprog +x ${pkg_dbdir}/$1/+DEINSTALL
                                $envprog -i PKG_PREFIX=${targetdir} ${pkg_dbdir}/$1/+DEINSTALL $1 VIEW-DEINSTALL



Home | Main Index | Thread Index | Old Index