pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/pkg_install/files/lib



Module Name:    pkgsrc
Committed By:   maya
Date:           Fri Dec 18 17:10:54 UTC 2020

Modified Files:
        pkgsrc/pkgtools/pkg_install/files/lib: pkgdb.c version.h

Log Message:
pkg_install-20201218

- Support continuing to install to /var/db/pkg if it exists and the
new pkgdb doesn't.
In the future, we can warn about this once we have tested advice that
we can give to users who want to move the location of pkgdb.

- Don't do anything about /var/db/pkg on non-NetBSD-base.
This creates conflicts with other package managers that also install to
/var/db/pkg.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c
cvs rdiff -u -r1.184 -r1.185 pkgsrc/pkgtools/pkg_install/files/lib/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c
diff -u pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c:1.41 pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c:1.42
--- pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c:1.41  Sat Dec  5 16:17:41 2020
+++ pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c       Fri Dec 18 17:10:54 2020
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkgdb.c,v 1.41 2020/12/05 16:17:41 wiz Exp $   */
+/*     $NetBSD: pkgdb.c,v 1.42 2020/12/18 17:10:54 maya Exp $  */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: pkgdb.c,v 1.41 2020/12/05 16:17:41 wiz Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.42 2020/12/18 17:10:54 maya Exp $");
 
 /*-
  * Copyright (c) 1999-2010 The NetBSD Foundation, Inc.
@@ -300,20 +300,32 @@ pkgdb_refcount_dir(void)
 const char *
 pkgdb_get_dir(void)
 {
-       /* Except for the return at this end, this code is for
-          migration from the previous location /var/db/pkg to the new
-          default (December 2020). */
+
+#ifdef NETBSD
+       /* 
+        * NetBSD upgrade case.
+        * NetBSD used to ship pkg_install with /var/db/pkg as
+        * the default. We support continuing to install to
+        * this location.
+        *
+        * This is NetBSD-specific because we can't assume that
+        * /var/db/pkg is pkgsrc-owned on other systems (OpenBSD,
+        * FreeBSD...)
+        *
+        * XXX: once postinstall is taught to automatically
+        * handle migration, we can deprecate this behaviour.
+        */
+
+#define PREVIOUS_LOG_DIR       "/var/db/pkg"
+       static char pkgdb_dir_previous[] = PREVIOUS_LOG_DIR;
 
        struct stat sb;
        if (strcmp(pkgdb_dir, DEF_LOG_DIR) == 0 &&
            stat(pkgdb_dir, &sb) == -1 && errno == ENOENT &&
-           stat("/var/db/pkg", &sb) == 0) {
-               errx(EXIT_FAILURE,
-                    "The default PKG_DBDIR has changed, but this installation still uses the old one.\n"
-                    "Please move the databases and re-run this command:\n"
-                    "\tmv /var/db/pkg " DEF_LOG_DIR "\n"
-                    "\tmv /var/db/pkg.refcount " DEF_LOG_DIR ".refcount");
+           stat(PREVIOUS_LOG_DIR, &sb) == 0) {
+               return pkgdb_dir_previous;
        }
+#endif
 
         return pkgdb_dir;
 }

Index: pkgsrc/pkgtools/pkg_install/files/lib/version.h
diff -u pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.184 pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.185
--- pkgsrc/pkgtools/pkg_install/files/lib/version.h:1.184       Fri Dec 11 15:55:35 2020
+++ pkgsrc/pkgtools/pkg_install/files/lib/version.h     Fri Dec 18 17:10:54 2020
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.184 2020/12/11 15:55:35 wiz Exp $        */
+/*     $NetBSD: version.h,v 1.185 2020/12/18 17:10:54 maya Exp $       */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION 20201212
+#define PKGTOOLS_VERSION 20201218
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index