Module Name:    src
Committed By:   wiz
Date:           Sat Dec 12 11:00:57 UTC 2020

Modified Files:
        src/external/bsd/pkg_install/dist/add: perform.c
        src/external/bsd/pkg_install/dist/lib: lib.h parse-config.c
            pkg_install.conf.5.in version.h

Log Message:
merge pkg_install-20201212


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/pkg_install/dist/add/perform.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/pkg_install/dist/lib/lib.h
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/pkg_install/dist/lib/parse-config.c \
    src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
cvs rdiff -u -r1.17 -r1.18 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/external/bsd/pkg_install/dist/add/perform.c
diff -u src/external/bsd/pkg_install/dist/add/perform.c:1.7 src/external/bsd/pkg_install/dist/add/perform.c:1.8
--- src/external/bsd/pkg_install/dist/add/perform.c:1.7	Wed Dec  2 13:53:50 2020
+++ src/external/bsd/pkg_install/dist/add/perform.c	Sat Dec 12 11:00:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: perform.c,v 1.7 2020/12/02 13:53:50 wiz Exp $	*/
+/*	$NetBSD: perform.c,v 1.8 2020/12/12 11:00:57 wiz 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.7 2020/12/02 13:53:50 wiz Exp $");
+__RCSID("$NetBSD: perform.c,v 1.8 2020/12/12 11:00:57 wiz Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <[email protected]>
@@ -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.10 src/external/bsd/pkg_install/dist/lib/lib.h:1.11
--- src/external/bsd/pkg_install/dist/lib/lib.h:1.10	Wed Dec  2 13:53:50 2020
+++ src/external/bsd/pkg_install/dist/lib/lib.h	Sat Dec 12 11:00:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.10 2020/12/02 13:53:50 wiz Exp $ */
+/* $NetBSD: lib.h,v 1.11 2020/12/12 11:00:57 wiz 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.4
--- 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 12 11:00:57 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.4 2020/12/12 11:00:57 wiz 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.4 2020/12/12 11:00:57 wiz Exp $");
 
 /*-
  * Copyright (c) 2008, 2009 Joerg Sonnenberger <[email protected]>.
@@ -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.4
--- 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 12 11:00:57 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.4 2020/12/12 11:00:57 wiz 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/version.h
diff -u src/external/bsd/pkg_install/dist/lib/version.h:1.17 src/external/bsd/pkg_install/dist/lib/version.h:1.18
--- src/external/bsd/pkg_install/dist/lib/version.h:1.17	Sat Dec  5 16:21:26 2020
+++ src/external/bsd/pkg_install/dist/lib/version.h	Sat Dec 12 11:00:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: version.h,v 1.17 2020/12/05 16:21:26 wiz Exp $	*/
+/*	$NetBSD: version.h,v 1.18 2020/12/12 11:00:57 wiz 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 20201212
 
 #endif /* _INST_LIB_VERSION_H_ */

Reply via email to