Module Name: src Committed By: martin Date: Sat Dec 19 13:34:42 UTC 2020
Modified Files: src/doc [netbsd-9]: 3RDPARTY src/external/bsd/pkg_install/dist/add [netbsd-9]: perform.c src/external/bsd/pkg_install/dist/lib [netbsd-9]: lib.h parse-config.c pkg_install.conf.5.in pkgdb.c plist.c version.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.1640.2.21 -r1.1640.2.22 src/doc/3RDPARTY cvs rdiff -u -r1.6.4.1 -r1.6.4.2 \ src/external/bsd/pkg_install/dist/add/perform.c cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/external/bsd/pkg_install/dist/lib/lib.h cvs rdiff -u -r1.3 -r1.3.2.1 \ src/external/bsd/pkg_install/dist/lib/parse-config.c cvs rdiff -u -r1.3 -r1.3.14.1 \ src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in cvs rdiff -u -r1.2.14.1 -r1.2.14.2 \ src/external/bsd/pkg_install/dist/lib/pkgdb.c \ src/external/bsd/pkg_install/dist/lib/plist.c cvs rdiff -u -r1.14.2.2 -r1.14.2.3 \ src/external/bsd/pkg_install/dist/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: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1640.2.21 src/doc/3RDPARTY:1.1640.2.22 --- src/doc/3RDPARTY:1.1640.2.21 Sun Nov 1 18:01:14 2020 +++ src/doc/3RDPARTY Sat Dec 19 13:34:41 2020 @@ -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 @@ definition (files.pf). userland code is 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-...@netbsd.org Responsible: joerg License: BSD Index: src/external/bsd/pkg_install/dist/add/perform.c diff -u src/external/bsd/pkg_install/dist/add/perform.c:1.6.4.1 src/external/bsd/pkg_install/dist/add/perform.c:1.6.4.2 --- src/external/bsd/pkg_install/dist/add/perform.c:1.6.4.1 Tue Dec 8 18:45:58 2020 +++ src/external/bsd/pkg_install/dist/add/perform.c Sat Dec 19 13:34:41 2020 @@ -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 <gr...@netbsd.org> @@ -151,6 +151,15 @@ compatible_platform(const char *opsys, c { 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 @@ check_dependencies(struct pkg_task *pkg) 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 @@ preserve_meta_data_file(struct pkg_task 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 @@ start_replacing(struct pkg_task *pkg) 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) Index: src/external/bsd/pkg_install/dist/lib/lib.h diff -u src/external/bsd/pkg_install/dist/lib/lib.h:1.9.4.1 src/external/bsd/pkg_install/dist/lib/lib.h:1.9.4.2 --- src/external/bsd/pkg_install/dist/lib/lib.h:1.9.4.1 Tue Dec 8 18:45:58 2020 +++ src/external/bsd/pkg_install/dist/lib/lib.h Sat Dec 19 13:34:42 2020 @@ -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 *cert_chain_file; 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; Index: src/external/bsd/pkg_install/dist/lib/parse-config.c diff -u src/external/bsd/pkg_install/dist/lib/parse-config.c:1.3 src/external/bsd/pkg_install/dist/lib/parse-config.c:1.3.2.1 --- src/external/bsd/pkg_install/dist/lib/parse-config.c:1.3 Sat Apr 6 00:05:47 2019 +++ src/external/bsd/pkg_install/dist/lib/parse-config.c Sat Dec 19 13:34:42 2020 @@ -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 <jo...@netbsd.org>. @@ -66,6 +66,7 @@ const char *cert_chain_file; 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 @@ static struct config_variable { { "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 }, Index: src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in diff -u src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in:1.3 src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in:1.3.14.1 --- src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in:1.3 Thu Apr 20 13:18:23 2017 +++ src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in Sat Dec 19 13:34:42 2020 @@ -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 @@ Missing license conditions are considere 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". Index: src/external/bsd/pkg_install/dist/lib/pkgdb.c diff -u src/external/bsd/pkg_install/dist/lib/pkgdb.c:1.2.14.1 src/external/bsd/pkg_install/dist/lib/pkgdb.c:1.2.14.2 --- src/external/bsd/pkg_install/dist/lib/pkgdb.c:1.2.14.1 Tue Dec 8 18:45:58 2020 +++ src/external/bsd/pkg_install/dist/lib/pkgdb.c Sat Dec 19 13:34:42 2020 @@ -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 @@ 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: src/external/bsd/pkg_install/dist/lib/plist.c diff -u src/external/bsd/pkg_install/dist/lib/plist.c:1.2.14.1 src/external/bsd/pkg_install/dist/lib/plist.c:1.2.14.2 --- src/external/bsd/pkg_install/dist/lib/plist.c:1.2.14.1 Tue Dec 8 18:45:58 2020 +++ src/external/bsd/pkg_install/dist/lib/plist.c Sat Dec 19 13:34:42 2020 @@ -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 @@ delete_package(Boolean ign_err, package_ 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; + } } } } Index: src/external/bsd/pkg_install/dist/lib/version.h diff -u src/external/bsd/pkg_install/dist/lib/version.h:1.14.2.2 src/external/bsd/pkg_install/dist/lib/version.h:1.14.2.3 --- src/external/bsd/pkg_install/dist/lib/version.h:1.14.2.2 Tue Dec 8 18:45:58 2020 +++ src/external/bsd/pkg_install/dist/lib/version.h Sat Dec 19 13:34:42 2020 @@ -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_ */