summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authormaya <maya@pkgsrc.org>2020-12-18 17:10:54 +0000
committermaya <maya@pkgsrc.org>2020-12-18 17:10:54 +0000
commitf29030bec68df914911814c558458a678af8f1d1 (patch)
treee8bfda2b0bd38ac29473221f886745a385ad32d5 /pkgtools/pkg_install
parenteb5fa9d5d4d78b0ceb5baabfcf7358b7b419da2c (diff)
downloadpkgsrc-f29030bec68df914911814c558458a678af8f1d1.tar.gz
pkg_install-20201218
- Support continuing to install to /var/db/pkg if it exists and the new pkgdb doesn't. In the future, we can warn about this once we have tested advice that we can give to users who want to move the location of pkgdb. - Don't do anything about /var/db/pkg on non-NetBSD-base. This creates conflicts with other package managers that also install to /var/db/pkg.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c34
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 25 insertions, 13 deletions
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index 52e3fa93acf..4b743a0ff77 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.41 2020/12/05 16:17:41 wiz Exp $ */
+/* $NetBSD: pkgdb.c,v 1.42 2020/12/18 17:10:54 maya 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.41 2020/12/05 16:17:41 wiz Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.42 2020/12/18 17:10:54 maya 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/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index e1fdef9ade7..94ca3817212 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.184 2020/12/11 15:55:35 wiz Exp $ */
+/* $NetBSD: version.h,v 1.185 2020/12/18 17:10:54 maya 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 20201212
+#define PKGTOOLS_VERSION 20201218
#endif /* _INST_LIB_VERSION_H_ */