Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/external/bsd/pkg_install Sync external/bsd/pkg_install wi...
details: https://anonhg.NetBSD.org/src/rev/726ffc2d97ae
branches: netbsd-9
changeset: 964211:726ffc2d97ae
user: martin <martin%NetBSD.org@localhost>
date: Tue Dec 08 18:45:58 2020 +0000
description:
Sync external/bsd/pkg_install with -current, requested by wiz in ticket #1140:
external/bsd/pkg_install/Makefile.inc up to 1.7
external/bsd/pkg_install/dist/add/perform.c up to 1.7
external/bsd/pkg_install/dist/admin/check.c up to 1.4
external/bsd/pkg_install/dist/admin/main.c up to 1.6
external/bsd/pkg_install/dist/admin/pkg_admin.1 up to 1.6
external/bsd/pkg_install/dist/create/perform.c up to 1.3
external/bsd/pkg_install/dist/create/pl.c up to 1.4
external/bsd/pkg_install/dist/info/perform.c up to 1.3
external/bsd/pkg_install/dist/lib/iterate.c up to 1.3
external/bsd/pkg_install/dist/lib/lib.h up to 1.10
external/bsd/pkg_install/dist/lib/license.c up to 1.10
external/bsd/pkg_install/dist/lib/pkgdb.c up to 1.4
external/bsd/pkg_install/dist/lib/plist.c up to 1.4
external/bsd/pkg_install/dist/lib/version.h up to 1.17
external/bsd/pkg_install/dist/lib/vulnerabilities-file.c up to 1.4
external/bsd/pkg_install/lib/Makefile up to 1.11
external/bsd/pkg_install/lib/config.h up to 1.3
Import pkg_info 20201205, move the default pkg database from /var/db/pkg
to ${PREFIX/pkgdb.
diffstat:
external/bsd/pkg_install/Makefile.inc | 4 +-
external/bsd/pkg_install/dist/add/perform.c | 104 ++++++---
external/bsd/pkg_install/dist/admin/check.c | 10 +-
external/bsd/pkg_install/dist/admin/main.c | 154 ++++++++++++--
external/bsd/pkg_install/dist/admin/pkg_admin.1 | 10 +-
external/bsd/pkg_install/dist/create/perform.c | 6 +-
external/bsd/pkg_install/dist/create/pl.c | 8 +-
external/bsd/pkg_install/dist/info/perform.c | 8 +-
external/bsd/pkg_install/dist/lib/iterate.c | 141 +++++++++++++-
external/bsd/pkg_install/dist/lib/lib.h | 25 ++-
external/bsd/pkg_install/dist/lib/license.c | 3 +-
external/bsd/pkg_install/dist/lib/pkgdb.c | 25 +-
external/bsd/pkg_install/dist/lib/plist.c | 13 +-
external/bsd/pkg_install/dist/lib/version.h | 4 +-
external/bsd/pkg_install/dist/lib/vulnerabilities-file.c | 6 +-
external/bsd/pkg_install/lib/Makefile | 5 +-
external/bsd/pkg_install/lib/config.h | 2 +
17 files changed, 419 insertions(+), 109 deletions(-)
diffs (truncated from 1006 to 300 lines):
diff -r 703ff24ed01e -r 726ffc2d97ae external/bsd/pkg_install/Makefile.inc
--- a/external/bsd/pkg_install/Makefile.inc Mon Dec 07 20:22:12 2020 +0000
+++ b/external/bsd/pkg_install/Makefile.inc Tue Dec 08 18:45:58 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.6 2019/02/07 23:53:20 mrg Exp $
+# $NetBSD: Makefile.inc,v 1.6.2.1 2020/12/08 18:45:58 martin Exp $
DIST= ${NETBSDSRCDIR}/external/bsd/pkg_install/dist
@@ -15,7 +15,7 @@
.include <bsd.own.mk>
# show_version() does not return
-.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
+.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
COPTS.main.c+= -Wno-error=implicit-fallthrough
COPTS.pkg_delete.c+= -Wno-error=implicit-fallthrough
.endif
diff -r 703ff24ed01e -r 726ffc2d97ae external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c Mon Dec 07 20:22:12 2020 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c Tue Dec 08 18:45:58 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.6 2018/03/25 04:04:36 sevan Exp $ */
+/* $NetBSD: perform.c,v 1.6.4.1 2020/12/08 18:45:58 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 2018/03/25 04:04:36 sevan Exp $");
+__RCSID("$NetBSD: perform.c,v 1.6.4.1 2020/12/08 18:45:58 martin Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -450,7 +450,7 @@
return -1;
}
*iter = '\0';
- pkg->other_version = find_best_matching_installed_pkg(pkgbase);
+ pkg->other_version = find_best_matching_installed_pkg(pkgbase, 0);
free(pkgbase);
if (pkg->other_version == NULL)
return 0;
@@ -505,10 +505,12 @@
continue;
if (pkg_match(p->name, pkg->pkgname) == 1)
continue; /* Both match, ok. */
- warnx("Dependency of %s fulfilled by %s, but not by %s",
- iter, pkg->other_version, pkg->pkgname);
- if (!ForceDepending)
+ if (!ForceDepending) {
+ warnx("Dependency of %s fulfilled by %s, "
+ "but not by %s", iter, pkg->other_version,
+ pkg->pkgname);
status = -1;
+ }
break;
}
free_plist(&plist);
@@ -979,7 +981,8 @@
setenv(PKG_REFCOUNT_DBDIR_VNAME, config_pkg_refcount_dbdir, 1);
if (Verbose)
- printf("Running install with PRE-INSTALL for %s.\n", pkg->pkgname);
+ printf("Running install with %s for %s.\n", argument,
+ pkg->pkgname);
if (Fake)
return 0;
@@ -1102,6 +1105,40 @@
return status;
}
+/*
+ * Install a required dependency and verify its installation.
+ */
+static int
+install_depend_pkg(const char *dep)
+{
+ /* XXX check cyclic dependencies? */
+ if (Fake || NoRecord) {
+ if (!Force) {
+ warnx("Missing dependency %s\n", dep);
+ return 1;
+ }
+ warnx("Missing dependency %s, continuing", dep);
+ }
+
+ if (pkg_do(dep, 1, 0)) {
+ if (!ForceDepends) {
+ warnx("Can't install dependency %s", dep);
+ return 1;
+ }
+ warnx("Can't install dependency %s, continuing", dep);
+ }
+
+ if (find_best_matching_installed_pkg(dep, 0) == NULL) {
+ if (!ForceDepends) {
+ warnx("Just installed dependency %s disappeared", dep);
+ return 1;
+ }
+ warnx("Missing dependency %s ignored", dep);
+ }
+
+ return 0;
+}
+
static int
check_dependencies(struct pkg_task *pkg)
{
@@ -1112,6 +1149,9 @@
status = 0;
+ /*
+ * Recursively handle dependencies, installing as required.
+ */
for (p = pkg->plist.head; p != NULL; p = p->next) {
if (p->type == PLIST_IGNORE) {
p = p->next;
@@ -1119,43 +1159,27 @@
} else if (p->type != PLIST_PKGDEP)
continue;
- best_installed = find_best_matching_installed_pkg(p->name);
-
- if (best_installed == NULL) {
- /* XXX check cyclic dependencies? */
- if (Fake || NoRecord) {
- if (!Force) {
- warnx("Missing dependency %s\n",
- p->name);
- status = -1;
- break;
- }
- warnx("Missing dependency %s, continuing",
- p->name);
- continue;
- }
- if (pkg_do(p->name, 1, 0)) {
- if (ForceDepends) {
- warnx("Can't install dependency %s, "
- "continuing", p->name);
- continue;
- } else {
- warnx("Can't install dependency %s",
- p->name);
- status = -1;
- break;
- }
- }
- best_installed = find_best_matching_installed_pkg(p->name);
- if (best_installed == NULL && ForceDepends) {
- warnx("Missing dependency %s ignored", p->name);
- continue;
- } else if (best_installed == NULL) {
- warnx("Just installed dependency %s disappeared", p->name);
+ if (find_best_matching_installed_pkg(p->name, 0) == NULL) {
+ if (install_depend_pkg(p->name) != 0) {
status = -1;
break;
}
}
+ }
+
+ /*
+ * Now that all dependencies have been processed we can find the best
+ * matches for pkg_register_depends() to store in our +REQUIRED_BY.
+ */
+ for (p = pkg->plist.head; p != NULL; p = p->next) {
+ if (p->type == PLIST_IGNORE) {
+ p = p->next;
+ continue;
+ } else if (p->type != PLIST_PKGDEP)
+ continue;
+
+ best_installed = find_best_matching_installed_pkg(p->name, 0);
+
for (i = 0; i < pkg->dep_length; ++i) {
if (strcmp(best_installed, pkg->dependencies[i]) == 0)
break;
diff -r 703ff24ed01e -r 726ffc2d97ae external/bsd/pkg_install/dist/admin/check.c
--- a/external/bsd/pkg_install/dist/admin/check.c Mon Dec 07 20:22:12 2020 +0000
+++ b/external/bsd/pkg_install/dist/admin/check.c Tue Dec 08 18:45:58 2020 +0000
@@ -1,5 +1,8 @@
-/* $NetBSD: check.c,v 1.2 2017/04/20 13:18:23 joerg Exp $ */
+/* $NetBSD: check.c,v 1.2.14.1 2020/12/08 18:45:58 martin Exp $ */
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#else
#if HAVE_CONFIG_H
#include "config.h"
#endif
@@ -7,7 +10,8 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: check.c,v 1.2 2017/04/20 13:18:23 joerg Exp $");
+#endif
+__RCSID("$NetBSD: check.c,v 1.2.14.1 2020/12/08 18:45:58 martin Exp $");
/*-
* Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
@@ -77,7 +81,7 @@
static int checkpattern_fn(const char *, void *);
/*
- * Assumes CWD is in /var/db/pkg/<pkg>!
+ * Assumes CWD is in the database directory ($PREFIX/pkgdb/<pkg>)!
*/
static void
check1pkg(const char *pkgdir, int *filecnt, int *pkgcnt)
diff -r 703ff24ed01e -r 726ffc2d97ae external/bsd/pkg_install/dist/admin/main.c
--- a/external/bsd/pkg_install/dist/admin/main.c Mon Dec 07 20:22:12 2020 +0000
+++ b/external/bsd/pkg_install/dist/admin/main.c Tue Dec 08 18:45:58 2020 +0000
@@ -1,5 +1,8 @@
-/* $NetBSD: main.c,v 1.3.4.1 2019/10/21 20:09:22 martin Exp $ */
+/* $NetBSD: main.c,v 1.3.4.2 2020/12/08 18:45:58 martin Exp $ */
+#ifdef HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#else
#if HAVE_CONFIG_H
#include "config.h"
#endif
@@ -7,7 +10,8 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.3.4.1 2019/10/21 20:09:22 martin Exp $");
+#endif
+__RCSID("$NetBSD: main.c,v 1.3.4.2 2020/12/08 18:45:58 martin Exp $");
/*-
* Copyright (c) 1999-2019 The NetBSD Foundation, Inc.
@@ -90,6 +94,25 @@
size_t packages;
};
+/*
+ * A hashed list of +REQUIRED_BY entries.
+ */
+struct reqd_by_entry {
+ char *pkgname;
+ SLIST_ENTRY(reqd_by_entry) entries;
+};
+SLIST_HEAD(reqd_by_entry_head, reqd_by_entry);
+
+/*
+ * A hashed list of packages that contain +REQUIRED_BY entries.
+ */
+struct pkg_reqd_by {
+ char *pkgname;
+ struct reqd_by_entry_head required_by[PKG_HASH_SIZE];
+ SLIST_ENTRY(pkg_reqd_by) entries;
+};
+SLIST_HEAD(pkg_reqd_by_head, pkg_reqd_by);
+
static const char Options[] = "C:K:SVbd:qs:v";
int quiet, verbose;
@@ -280,37 +303,79 @@
}
static void
-add_required_by(const char *pattern, const char *required_by)
+add_required_by(const char *pattern, const char *pkgname, struct pkg_reqd_by_head *hash)
{
- char *best_installed, *path;
- int fd;
- size_t len;
+ struct pkg_reqd_by_head *phead;
+ struct pkg_reqd_by *pkg;
+ struct reqd_by_entry_head *ehead;
+ struct reqd_by_entry *entry;
+ char *best_installed;
+ int i;
- best_installed = find_best_matching_installed_pkg(pattern);
+ best_installed = find_best_matching_installed_pkg(pattern, 1);
if (best_installed == NULL) {
- warnx("Dependency %s of %s unresolved", pattern, required_by);
+ warnx("Dependency %s of %s unresolved", pattern, pkgname);
return;
}
- path = pkgdb_pkg_file(best_installed, REQUIRED_BY_FNAME);
- free(best_installed);
+ /*
+ * Find correct reqd_by head based on hash of best_installed, which is
+ * the package in question that we are adding +REQUIRED_BY entries for.
+ */
+ phead = &hash[PKG_HASH_ENTRY(best_installed)];
+
+ /*
+ * Look for an existing entry in this hash list.
+ */
Home |
Main Index |
Thread Index |
Old Index