pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib pkg_install-20201218
details: https://anonhg.NetBSD.org/pkgsrc/rev/16953526e394
branches: trunk
changeset: 443632:16953526e394
user: maya <maya%pkgsrc.org@localhost>
date: Fri Dec 18 17:10:54 2020 +0000
description:
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:
pkgtools/pkg_install/files/lib/pkgdb.c | 34 +++++++++++++++++++++----------
pkgtools/pkg_install/files/lib/version.h | 4 +-
2 files changed, 25 insertions(+), 13 deletions(-)
diffs (77 lines):
diff -r 6856f6fec4d7 -r 16953526e394 pkgtools/pkg_install/files/lib/pkgdb.c
--- a/pkgtools/pkg_install/files/lib/pkgdb.c Fri Dec 18 13:13:42 2020 +0000
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c Fri Dec 18 17:10:54 2020 +0000
@@ -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 @@
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 -r 6856f6fec4d7 -r 16953526e394 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h Fri Dec 18 13:13:42 2020 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h Fri Dec 18 17:10:54 2020 +0000
@@ -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_ */
Home |
Main Index |
Thread Index |
Old Index