Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up the following, requested by maya in ticket #1155:



details:   https://anonhg.NetBSD.org/src/rev/b4fcf4b35a4a
branches:  netbsd-9
changeset: 964227:b4fcf4b35a4a
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Dec 19 13:34:41 2020 +0000

description:
Pull up the following, requested by maya in ticket #1155:

        external/bsd/pkg_install/dist/add/perform.c     up to 1.8
        external/bsd/pkg_install/dist/lib/lib.h         up to 1.11
        external/bsd/pkg_install/dist/lib/parse-config.c up to 1.4
        external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in up to 1.4
        external/bsd/pkg_install/dist/lib/pkgdb.c       up to 1.5
        external/bsd/pkg_install/dist/lib/plist.c       up to 1.6
        external/bsd/pkg_install/dist/lib/version.h     up to 1.19
        doc/3RDPARTY                                    (manually modified)

Merge pkg_install 20201218.

Provide silent backwards compatibility for existing package installs
using /var/db/pkg.

diffstat:

 doc/3RDPARTY                                            |   8 ++--
 external/bsd/pkg_install/dist/add/perform.c             |  32 +++++++++++++---
 external/bsd/pkg_install/dist/lib/lib.h                 |   3 +-
 external/bsd/pkg_install/dist/lib/parse-config.c        |   6 ++-
 external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in |   6 ++-
 external/bsd/pkg_install/dist/lib/pkgdb.c               |  34 +++++++++++-----
 external/bsd/pkg_install/dist/lib/plist.c               |  23 ++++++-----
 external/bsd/pkg_install/dist/lib/version.h             |   4 +-
 8 files changed, 78 insertions(+), 38 deletions(-)

diffs (294 lines):

diff -r 8ad3dbd859bb -r b4fcf4b35a4a doc/3RDPARTY
--- a/doc/3RDPARTY      Fri Dec 18 12:29:41 2020 +0000
+++ b/doc/3RDPARTY      Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: 3RDPARTY,v 1.1640.2.21 2020/11/01 18:01:14 martin Exp $
+#      $NetBSD: 3RDPARTY,v 1.1640.2.22 2020/12/19 13:34:41 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1180,11 +1180,11 @@
 reachover Makefiles are in src/usr.sbin/pf.
 
 Package:       pkg_install
-Version:       20190405
-Current Vers:  20190405
+Version:       20201218
+Current Vers:  20201218
 Maintainer:    The pkgsrc developers
 Home Page:     http://www.pkgsrc.org/
-Date:          2019-01-09
+Date:          2020-12-18
 Mailing List:  tech-pkg%NetBSD.org@localhost
 Responsible:   joerg
 License:       BSD
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c       Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c       Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.6.4.1 2020/12/08 18:45:58 martin Exp $   */
+/*     $NetBSD: perform.c,v 1.6.4.2 2020/12/19 13:34:41 martin Exp $   */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.6.4.1 2020/12/08 18:45:58 martin Exp $");
+__RCSID("$NetBSD: perform.c,v 1.6.4.2 2020/12/19 13:34:41 martin Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -151,6 +151,15 @@
 {
     int i = 0;
 
+    /*
+     * If the user has set the CHECK_OS_VERSION variable to "no" then skip any
+     * uname version checks and assume they know what they are doing.  This can
+     * be useful on OS where the kernel version is not a good indicator of
+     * userland compatibility, or differs but retains ABI compatibility.
+     */
+    if (strcasecmp(check_os_version, "no") == 0)
+       return 1;
+
     /* returns 1 if host and package operating system match */
     if (strcmp(host, package) == 0)
        return 1;
@@ -1179,6 +1188,10 @@
                        continue;
 
                best_installed = find_best_matching_installed_pkg(p->name, 0);
+               if (best_installed == NULL) {
+                       warnx("Expected dependency %s still missing", p->name);
+                       return -1;
+               }
 
                for (i = 0; i < pkg->dep_length; ++i) {
                        if (strcmp(best_installed, pkg->dependencies[i]) == 0)
@@ -1225,6 +1238,8 @@
 static int
 start_replacing(struct pkg_task *pkg)
 {
+       int result = -1;
+
        if (preserve_meta_data_file(pkg, REQUIRED_BY_FNAME))
                return -1;
 
@@ -1241,14 +1256,19 @@
                        Destdir ? " -P ": "", Destdir ? Destdir : "",
                        pkg->other_version);
        }
-       if (!Fake)
-               fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(),
+       if (!Fake) {
+               result = fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(),
                    "-p", pkg->prefix,
                    Destdir ? "-P": "", Destdir ? Destdir : "",
                    pkg->other_version, NULL);
+               if (result != 0) {
+                       warnx("command failed: %s/pkg_delete -K %s -p %s %s%s%s",
+                             BINDIR, pkgdb_get_dir(), pkg->prefix, Destdir ? "-P" : " ",
+                             Destdir ? Destdir : "", pkg->other_version);
+               }
+       }
 
-       /* XXX Check return value and do what? */
-       return 0;
+       return result;
 }
 
 static int check_input(const char *line, size_t len)
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/lib/lib.h
--- a/external/bsd/pkg_install/dist/lib/lib.h   Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/lib.h   Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.9.4.1 2020/12/08 18:45:58 martin Exp $ */
+/* $NetBSD: lib.h,v 1.9.4.2 2020/12/19 13:34:42 martin Exp $ */
 
 /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
 
@@ -447,6 +447,7 @@
 extern const char *certs_packages;
 extern const char *certs_pkg_vulnerabilities;
 extern const char *check_eol;
+extern const char *check_os_version;
 extern const char *check_vulnerabilities;
 extern const char *config_file;
 extern const char *config_pkg_dbdir;
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/lib/parse-config.c
--- a/external/bsd/pkg_install/dist/lib/parse-config.c  Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/parse-config.c  Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse-config.c,v 1.3 2019/04/06 00:05:47 sevan Exp $   */
+/*     $NetBSD: parse-config.c,v 1.3.2.1 2020/12/19 13:34:42 martin Exp $      */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: parse-config.c,v 1.3 2019/04/06 00:05:47 sevan Exp $");
+__RCSID("$NetBSD: parse-config.c,v 1.3.2.1 2020/12/19 13:34:42 martin Exp $");
 
 /*-
  * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -66,6 +66,7 @@
 const char *certs_packages;
 const char *certs_pkg_vulnerabilities;
 const char *check_eol = "yes";
+const char *check_os_version = "yes";
 const char *check_vulnerabilities;
 static const char *config_cache_connections;
 static const char *config_cache_connections_host;
@@ -100,6 +101,7 @@
        { "CERTIFICATE_CHAIN", &cert_chain_file },
        { "CHECK_LICENSE", &do_license_check },
        { "CHECK_END_OF_LIFE", &check_eol },
+       { "CHECK_OS_VERSION", &check_os_version },
        { "CHECK_VULNERABILITIES", &check_vulnerabilities },
        { "DEFAULT_ACCEPTABLE_LICENSES", &default_acceptable_licenses },
        { "GPG", &gpg_cmd },
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
--- a/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in   Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in   Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_install.conf.5.in,v 1.3 2017/04/20 13:18:23 joerg Exp $
+.\"    $NetBSD: pkg_install.conf.5.in,v 1.3.14.1 2020/12/19 13:34:42 martin Exp $
 .\"
 .\" Copyright (c) 2008, 2009, 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -93,6 +93,10 @@
 During vulnerability checks, consider packages that have reached end-of-life
 as vulnerable.
 This option is enabled by default.
+.It Dv CHECK_OS_VERSION
+If "no", pkg_add will not warn if the host OS version does not exactly match
+the OS version the package was built on.
+The default is "yes".
 .It Dv CHECK_OSABI
 If "no", osabi package does not check OS version.
 The default is "yes".
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/lib/pkgdb.c
--- a/external/bsd/pkg_install/dist/lib/pkgdb.c Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/pkgdb.c Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pkgdb.c,v 1.2.14.1 2020/12/08 18:45:58 martin Exp $    */
+/*     $NetBSD: pkgdb.c,v 1.2.14.2 2020/12/19 13:34:42 martin 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.2.14.1 2020/12/08 18:45:58 martin Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.2.14.2 2020/12/19 13:34:42 martin Exp $");
 
 /*-
  * Copyright (c) 1999-2010 The NetBSD Foundation, Inc.
@@ -300,20 +300,32 @@
 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;
 }
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/lib/plist.c
--- a/external/bsd/pkg_install/dist/lib/plist.c Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/plist.c Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: plist.c,v 1.2.14.1 2020/12/08 18:45:58 martin Exp $    */
+/*     $NetBSD: plist.c,v 1.2.14.2 2020/12/19 13:34:42 martin Exp $    */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: plist.c,v 1.2.14.1 2020/12/08 18:45:58 martin Exp $");
+__RCSID("$NetBSD: plist.c,v 1.2.14.2 2020/12/19 13:34:42 martin Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -637,15 +637,16 @@
                                                                        fail = FAIL;
                                                                        goto pkgdb_cleanup;
                                                                }
-                                                       }
-                                                       memcpy(&buf[SymlinkHeaderLen], tmp2, cc);
-                                                       buf[SymlinkHeaderLen + cc] = 0x0;
-                                                       if (strcmp(buf, p->next->name) != 0) {
-                                                               printf("symlink %s is not same as recorded value, %s: %s\n",
-                                                                   buf, Force ? "deleting anyway" : "not deleting", tmp);
-                                                               if (!Force) {
-                                                                       fail = FAIL;
-                                                                       goto pkgdb_cleanup;
+                                                       } else {
+                                                               memcpy(&buf[SymlinkHeaderLen], tmp2, cc);
+                                                               buf[SymlinkHeaderLen + cc] = 0x0;
+                                                               if (strcmp(buf, p->next->name) != 0) {
+                                                                       printf("symlink %s is not same as recorded value, %s: %s\n",
+                                                                           buf, Force ? "deleting anyway" : "not deleting", tmp);
+                                                                       if (!Force) {
+                                                                               fail = FAIL;
+                                                                               goto pkgdb_cleanup;
+                                                                       }
                                                                }
                                                        }
                                                }
diff -r 8ad3dbd859bb -r b4fcf4b35a4a external/bsd/pkg_install/dist/lib/version.h
--- a/external/bsd/pkg_install/dist/lib/version.h       Fri Dec 18 12:29:41 2020 +0000
+++ b/external/bsd/pkg_install/dist/lib/version.h       Sat Dec 19 13:34:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.14.2.2 2020/12/08 18:45:58 martin Exp $  */
+/*     $NetBSD: version.h,v 1.14.2.3 2020/12/19 13:34:42 martin 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 20201205
+#define PKGTOOLS_VERSION 20201218
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index