diff options
author | wiz <wiz@pkgsrc.org> | 2020-12-02 10:22:39 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2020-12-02 10:22:39 +0000 |
commit | 1411c5f921f6851c5ff615b622680c8824ff4863 (patch) | |
tree | 03e1b7d580180b7caeb414c5db7418dbd3d6f9f7 /pkgtools | |
parent | 0d9ec1dd67278084e7516e19ea30c795efda6d9b (diff) | |
download | pkgsrc-1411c5f921f6851c5ff615b622680c8824ff4863.tar.gz |
*: move default database directory from /var/db/pkg to ${PREFIX}/pkgdb
As discussed in August 2020 and previously on pkgsrcCon 2019.
Ok pkgsrc-pmc@
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_install/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/admin/check.c | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/admin/pkg_admin.1 | 10 | ||||
-rwxr-xr-x | pkgtools/pkg_install/files/configure | 4 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/configure.ac | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/Makefile.in | 3 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/pkgdb.c | 24 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
8 files changed, 36 insertions, 25 deletions
diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile index 7f83ddc51fc..9b0dfda7040 100644 --- a/pkgtools/pkg_install/Makefile +++ b/pkgtools/pkg_install/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.231 2020/08/09 21:40:42 rillig Exp $ +# $NetBSD: Makefile,v 1.232 2020/12/02 10:22:39 wiz Exp $ # Notes to package maintainers: # @@ -81,7 +81,7 @@ MAKE_ENV+= OPSYS=${OPSYS} MAKE_ENV+= CATMAN_SECTION_SUFFIX=${CATMAN_SECTION_SUFFIX:Q} MAKE_ENV+= MANINSTALL=${MANINSTALL:Q} -PKG_DBDIR?= /var/db/pkg +PKG_DBDIR?= ${PREFIX}/pkgdb EGDIR= ${PREFIX}/share/examples/pkg_install PLIST_SUBST+= PKG_DBDIR=${PKG_DBDIR} diff --git a/pkgtools/pkg_install/files/admin/check.c b/pkgtools/pkg_install/files/admin/check.c index dd0012b207b..20630c2139e 100644 --- a/pkgtools/pkg_install/files/admin/check.c +++ b/pkgtools/pkg_install/files/admin/check.c @@ -1,4 +1,4 @@ -/* $NetBSD: check.c,v 1.10 2010/01/22 13:30:41 joerg Exp $ */ +/* $NetBSD: check.c,v 1.11 2020/12/02 10:22:39 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: check.c,v 1.10 2010/01/22 13:30:41 joerg Exp $"); +__RCSID("$NetBSD: check.c,v 1.11 2020/12/02 10:22:39 wiz Exp $"); /*- * Copyright (c) 1999-2008 The NetBSD Foundation, Inc. @@ -77,7 +77,7 @@ __RCSID("$NetBSD: check.c,v 1.10 2010/01/22 13:30:41 joerg Exp $"); 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 --git a/pkgtools/pkg_install/files/admin/pkg_admin.1 b/pkgtools/pkg_install/files/admin/pkg_admin.1 index 4848fc246f7..798642ea54f 100644 --- a/pkgtools/pkg_install/files/admin/pkg_admin.1 +++ b/pkgtools/pkg_install/files/admin/pkg_admin.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_admin.1,v 1.38 2019/10/11 11:57:41 joerg Exp $ +.\" $NetBSD: pkg_admin.1,v 1.39 2020/12/02 10:22:39 wiz Exp $ .\" .\" Copyright (c) 1999-2019 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 8, 2019 +.Dd August 22, 2020 .Dt PKG_ADMIN 1 .Os .Sh NAME @@ -295,9 +295,9 @@ See .Xr pkg_install.conf 5 for options, that can also be specified using the environment. .Sh FILES -.Bl -tag -width /var/db/pkg/pkgdb.byfile.db -compact -.It Pa /var/db/pkg/pkgdb.byfile.db -.It Pa /var/db/pkg/\*[Lt]pkg\*[Gt]/+CONTENTS +.Bl -tag -width @PREFIX@/pkgdb/pkgdb.byfile.db -compact +.It Pa @PREFIX@/pkgdb/pkgdb.byfile.db +.It Pa @PREFIX@/pkgdb/\*[Lt]pkg\*[Gt]/+CONTENTS .El .Sh SEE ALSO .Xr pkg_add 1 , diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure index 5d6e0dbc86f..fa68c853d68 100755 --- a/pkgtools/pkg_install/files/configure +++ b/pkgtools/pkg_install/files/configure @@ -1344,7 +1344,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pkgdbdir=DIR Where to put the pkg database (/var/db/pkg) + --with-pkgdbdir=DIR Where to put the pkg database (PREFIX/pkgdb) --with-ssl Enable OpenSSL based signature support Some influential environment variables: @@ -4025,7 +4025,7 @@ AUTOHEADER=${AUTOHEADER-"$srcdir/missing --run autoheader"} if test "${with_pkgdbdir+set}" = set; then : withval=$with_pkgdbdir; pkgdbdir="$with_pkgdbdir" else - pkgdbdir="/var/db/pkg" + pkgdbdir="${prefix}/pkgdb" fi diff --git a/pkgtools/pkg_install/files/configure.ac b/pkgtools/pkg_install/files/configure.ac index 7146d456418..9721ee2ab18 100644 --- a/pkgtools/pkg_install/files/configure.ac +++ b/pkgtools/pkg_install/files/configure.ac @@ -1,4 +1,4 @@ -dnl $NetBSD: configure.ac,v 1.43 2020/07/01 10:15:20 jperkin Exp $ +dnl $NetBSD: configure.ac,v 1.44 2020/12/02 10:22:39 wiz Exp $ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) AC_INIT([pkg_install], [20200701], [joerg@NetBSD.org]) @@ -39,9 +39,9 @@ AC_SUBST(AUTOHEADER) dnl Set the default pkg dbdir AC_ARG_WITH(pkgdbdir, -[ --with-pkgdbdir=DIR Where to put the pkg database (/var/db/pkg)], +[ --with-pkgdbdir=DIR Where to put the pkg database (PREFIX/pkgdb)], [ pkgdbdir="$with_pkgdbdir" ], -[ pkgdbdir="/var/db/pkg" ]) +[ pkgdbdir="${prefix}/pkgdb" ]) AC_SUBST(pkgdbdir) AC_ARG_WITH(ssl, diff --git a/pkgtools/pkg_install/files/lib/Makefile.in b/pkgtools/pkg_install/files/lib/Makefile.in index bb1e7e7cec1..d9957a0284b 100644 --- a/pkgtools/pkg_install/files/lib/Makefile.in +++ b/pkgtools/pkg_install/files/lib/Makefile.in @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.in,v 1.36 2017/04/19 21:42:50 joerg Exp $ +# $NetBSD: Makefile.in,v 1.37 2020/12/02 10:22:39 wiz Exp $ srcdir= @srcdir@ @@ -32,6 +32,7 @@ OBJS= automatic.o conflicts.o dewey.o fexec.o file.o \ str.o var.o version.o vulnerabilities-file.o xwrapper.o CPPFLAGS+= -DSYSCONFDIR=\"$(sysconfdir)\" +CPPFLAGS+= -DPREFIX=\"$(prefix)\" .if !empty(BOOTSTRAP) CPPFLAGS+= -DBOOTSTRAP diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c index 5e7df9a9b57..f024b65f884 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.39 2010/04/20 21:22:38 joerg Exp $ */ +/* $NetBSD: pkgdb.c,v 1.40 2020/12/02 10:22:39 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: pkgdb.c,v 1.39 2010/04/20 21:22:38 joerg Exp $"); +__RCSID("$NetBSD: pkgdb.c,v 1.40 2020/12/02 10:22:39 wiz Exp $"); /*- * Copyright (c) 1999-2010 The NetBSD Foundation, Inc. @@ -70,12 +70,9 @@ __RCSID("$NetBSD: pkgdb.c,v 1.39 2010/04/20 21:22:38 joerg Exp $"); * Where we put logging information by default if PKG_DBDIR is unset. */ #ifndef DEF_LOG_DIR -#define DEF_LOG_DIR "/var/db/pkg" +#define DEF_LOG_DIR PREFIX "/pkgdb" #endif -/* just in case we change the environment variable name */ -#define PKG_DBDIR "PKG_DBDIR" - static DB *pkgdbp; static char pkgdb_dir_default[] = DEF_LOG_DIR; static char *pkgdb_dir = pkgdb_dir_default; @@ -303,8 +300,21 @@ 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). */ + + 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 database and re-run this command:\n" + "\tmv /var/db/pkg " DEF_LOG_DIR); + } - return pkgdb_dir; + return pkgdb_dir; } /* diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 8c06dd49b04..66c9b6e2f13 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.179 2020/07/01 10:15:20 jperkin Exp $ */ +/* $NetBSD: version.h,v 1.180 2020/12/02 10:22:39 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 20200701 +#define PKGTOOLS_VERSION 20200828 #endif /* _INST_LIB_VERSION_H_ */ |