summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2020-12-02 10:22:39 +0000
committerwiz <wiz@pkgsrc.org>2020-12-02 10:22:39 +0000
commit1411c5f921f6851c5ff615b622680c8824ff4863 (patch)
tree03e1b7d580180b7caeb414c5db7418dbd3d6f9f7
parent0d9ec1dd67278084e7516e19ea30c795efda6d9b (diff)
downloadpkgsrc-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@
-rw-r--r--mk/pbulk/pbulk.sh4
-rw-r--r--mk/pkgformat/pkg/depends.mk6
-rw-r--r--mk/pkgformat/pkg/pkgformat-vars.mk14
-rwxr-xr-xmk/pkgformat/pkg/register-dependencies6
-rw-r--r--pkgtools/pkg_install/Makefile4
-rw-r--r--pkgtools/pkg_install/files/admin/check.c6
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.110
-rwxr-xr-xpkgtools/pkg_install/files/configure4
-rw-r--r--pkgtools/pkg_install/files/configure.ac6
-rw-r--r--pkgtools/pkg_install/files/lib/Makefile.in3
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c24
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
12 files changed, 53 insertions, 38 deletions
diff --git a/mk/pbulk/pbulk.sh b/mk/pbulk/pbulk.sh
index 43628935809..a96dfcc144c 100644
--- a/mk/pbulk/pbulk.sh
+++ b/mk/pbulk/pbulk.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: pbulk.sh,v 1.8 2018/10/29 02:47:08 sevan Exp $
+# $NetBSD: pbulk.sh,v 1.9 2020/12/02 10:22:39 wiz Exp $
set -e
usage="usage: ${0##*/} [-lun] [-c mk.conf.fragment] [-d nodes]"
@@ -40,7 +40,7 @@ fi
# setting pkgdb directory:
if [ -n "$unprivileged" -o -n "${PREFIX}" ]; then
-: ${PKGDBDIR:=${PREFIX}/var/db/pkg}
+: ${PKGDBDIR:=${PREFIX}/pkgdb}
fi
# Do it early since adding it after it fails is problematic:
diff --git a/mk/pkgformat/pkg/depends.mk b/mk/pkgformat/pkg/depends.mk
index 76016be8886..8081cad644c 100644
--- a/mk/pkgformat/pkg/depends.mk
+++ b/mk/pkgformat/pkg/depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.11 2020/01/14 22:22:34 rillig Exp $
+# $NetBSD: depends.mk,v 1.12 2020/12/02 10:22:39 wiz Exp $
# This command prints out the dependency patterns for all full (run-time)
# dependencies of the package.
@@ -188,8 +188,12 @@ ${_RRDEPENDS_FILE}: ${_RDEPENDS_FILE}
# _pkgformat-install-dependencies:
# Installs any missing dependencies.
#
+# The ${TEST} at the beginning is for the default change for the
+# database directory from /var/db/pkg to ${PREFIX}/pkgdb in December 2020.
+#
_pkgformat-install-dependencies: .PHONY ${_DEPENDS_FILE}
${RUN} \
+ ${TEST} -n "${PKG_DBDIR_ERROR}" && ${ERROR_MSG} ${PKG_DBDIR_ERROR:Q} && exit 1; \
exec 3<&0; \
${CAT} ${_DEPENDS_FILE} | \
while read type pattern dir; do \
diff --git a/mk/pkgformat/pkg/pkgformat-vars.mk b/mk/pkgformat/pkg/pkgformat-vars.mk
index 6c046988ba2..b196f6bc812 100644
--- a/mk/pkgformat/pkg/pkgformat-vars.mk
+++ b/mk/pkgformat/pkg/pkgformat-vars.mk
@@ -1,4 +1,4 @@
-# $NetBSD: pkgformat-vars.mk,v 1.8 2020/01/12 23:38:42 joerg Exp $
+# $NetBSD: pkgformat-vars.mk,v 1.9 2020/12/02 10:22:39 wiz Exp $
#
# This Makefile fragment is included indirectly by bsd.prefs.mk and
# defines some variables which must be defined earlier than where
@@ -16,7 +16,11 @@ USE_TOOLS+= date
.endif
# This is the package database directory for the default view.
-PKG_DBDIR?= /var/db/pkg
+PKG_DBDIR?= ${PREFIX}/pkgdb
+
+.if exists(/var/db/pkg) && !exists(${PKG_DBDIR})
+PKG_DBDIR_ERROR= The default package database directory has changed. Please run: mv /var/db/pkg ${PKG_DBDIR}
+.endif
# _PKG_DBDIR is the actual packages database directory where we register
# packages.
@@ -32,11 +36,7 @@ PKG_INFO_CMD?= ${PKG_TOOLS_BIN}/pkg_info
LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfarm
# Latest versions of tools required for correct pkgsrc operation.
-.if !empty(USE_PKG_ADMIN_DIGEST:M[Yy][Ee][Ss])
-PKGTOOLS_REQD= 20191008
-.else
-PKGTOOLS_REQD= 20100914
-.endif
+PKGTOOLS_REQD= 20200828
# Latest version of pkg_install required to extract packages
PKGTOOLS_VERSION_REQD= 20091115
diff --git a/mk/pkgformat/pkg/register-dependencies b/mk/pkgformat/pkg/register-dependencies
index 148ef8ac340..9b7d19afa26 100755
--- a/mk/pkgformat/pkg/register-dependencies
+++ b/mk/pkgformat/pkg/register-dependencies
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: register-dependencies,v 1.1 2011/10/15 00:23:09 reed Exp $
+# $NetBSD: register-dependencies,v 1.2 2020/12/02 10:22:39 wiz Exp $
#
######################################################################
#
@@ -18,14 +18,14 @@
# ENVIRONMENT
# PKG_DBDIR
# This is the package meta-data directory in which the
-# packages are registered. By default, this is /var/db/pkg.
+# packages are registered. By default, this is ${PREFIX}/pkgdb .
#
######################################################################
: ${AWK:=awk}
: ${CP:=cp}
: ${ECHO:=echo}
-: ${PKG_DBDIR:=/var/db/pkg}
+: ${PKG_DBDIR:=${PREFIX}/pkgdb}
: ${RM:=rm}
: ${TEST:=test}
: ${TOUCH:=touch}
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_ */