diff options
| author | martin <martin@NetBSD.org> | 2020-12-19 13:34:41 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2020-12-19 13:34:41 +0000 |
| commit | 9f95c5d1b34afaebc9829cbff810f72cd873aa25 (patch) | |
| tree | 87bd7c34e12dac4287c4ba3c11c5f5de365cd099 /external | |
| parent | 445f6d510353b7860e5ad734571908abf23146ef (diff) | |
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 (limited to 'external')
| -rw-r--r-- | external/bsd/pkg_install/dist/add/perform.c | 32 | ||||
| -rw-r--r-- | external/bsd/pkg_install/dist/lib/lib.h | 3 | ||||
| -rw-r--r-- | external/bsd/pkg_install/dist/lib/parse-config.c | 6 | ||||
| -rw-r--r-- | external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in | 6 | ||||
| -rw-r--r-- | external/bsd/pkg_install/dist/lib/pkgdb.c | 34 | ||||
| -rw-r--r-- | external/bsd/pkg_install/dist/lib/plist.c | 23 | ||||
| -rw-r--r-- | external/bsd/pkg_install/dist/lib/version.h | 4 |
7 files changed, 74 insertions, 34 deletions
diff --git a/external/bsd/pkg_install/dist/add/perform.c b/external/bsd/pkg_install/dist/add/perform.c index 87cd185367d..da2d89837e5 100644 --- a/external/bsd/pkg_install/dist/add/perform.c +++ b/external/bsd/pkg_install/dist/add/perform.c @@ -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> @@ -151,6 +151,15 @@ compatible_platform(const char *opsys, const char *host, const char *package) { 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 *pkg, const char *name) 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) diff --git a/external/bsd/pkg_install/dist/lib/lib.h b/external/bsd/pkg_install/dist/lib/lib.h index 0c78c728785..15c77eedefc 100644 --- a/external/bsd/pkg_install/dist/lib/lib.h +++ b/external/bsd/pkg_install/dist/lib/lib.h @@ -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; diff --git a/external/bsd/pkg_install/dist/lib/parse-config.c b/external/bsd/pkg_install/dist/lib/parse-config.c index 3e3ebc7f872..db0205c1bc2 100644 --- a/external/bsd/pkg_install/dist/lib/parse-config.c +++ b/external/bsd/pkg_install/dist/lib/parse-config.c @@ -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>. @@ -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 }, diff --git a/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in b/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in index a402d320b00..08126e1f75a 100644 --- a/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in +++ b/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in @@ -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 considered an error. 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 --git a/external/bsd/pkg_install/dist/lib/pkgdb.c b/external/bsd/pkg_install/dist/lib/pkgdb.c index 61bcad78504..0069fadeae6 100644 --- a/external/bsd/pkg_install/dist/lib/pkgdb.c +++ b/external/bsd/pkg_install/dist/lib/pkgdb.c @@ -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; } diff --git a/external/bsd/pkg_install/dist/lib/plist.c b/external/bsd/pkg_install/dist/lib/plist.c index aeb6c330b6c..61a31ac0790 100644 --- a/external/bsd/pkg_install/dist/lib/plist.c +++ b/external/bsd/pkg_install/dist/lib/plist.c @@ -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_t *pkg, Boolean NoDeleteFiles, 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 --git a/external/bsd/pkg_install/dist/lib/version.h b/external/bsd/pkg_install/dist/lib/version.h index b26a4d73c8c..5ab422db65d 100644 --- a/external/bsd/pkg_install/dist/lib/version.h +++ b/external/bsd/pkg_install/dist/lib/version.h @@ -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_ */ |
