Skip to content

Commit

Permalink
Move the pkgdb compatibility error to a NetBSD-specific file to avoid
Browse files Browse the repository at this point in the history
breakage for users who have other package managers that use /var/db/pkg
(Reported by Frederic Cambus on FreeBSD, OpenBSD)

Adjust warning: specifying PKGDB_DIR in mk.conf should be sufficient
for building packages for the compatibility pkgdb location.

This is still an error message, because:
- While we can handle the existing references of PKGDB_DIR, new ones
might be created.
- It is a minor inconvenience to people building packages from source.
  • Loading branch information
coypoop committed Dec 18, 2020
1 parent fdebf49 commit ce75854
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 1 addition & 5 deletions mk/pkgformat/pkg/pkgformat-vars.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: pkgformat-vars.mk,v 1.10 2020/12/03 10:04:48 wiz Exp $
# $NetBSD: pkgformat-vars.mk,v 1.11 2020/12/18 17:14:58 maya Exp $
#
# This Makefile fragment is included indirectly by bsd.prefs.mk and
# defines some variables which must be defined earlier than where
Expand All @@ -18,10 +18,6 @@ USE_TOOLS+= date
# This is the package database directory for the default view.
PKG_DBDIR?= ${LOCALBASE}/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.
#
Expand Down
10 changes: 9 additions & 1 deletion mk/platform/NetBSD.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: NetBSD.mk,v 1.61 2020/12/14 21:45:43 js Exp $
# $NetBSD: NetBSD.mk,v 1.62 2020/12/18 17:14:58 maya Exp $
#
# Variable definitions for the NetBSD operating system.

Expand Down Expand Up @@ -165,6 +165,14 @@ _OPSYS_SUPPORTS_SSP= yes
_OPSYS_SUPPORTS_STACK_CHECK= yes
.endif

_OLD_DEFAULT_PKGDB_DIR= /var/db/pkg
.if exists(${_OLD_DEFAULT_PKGDB_DIR}) && \
(${PKG_DBDIR:U${OLD_DEFAULT_PKGDB_DIR}} != ${_OLD_DEFAULT_PKGDB_DIR})
PKG_DBDIR_ERROR= Compatibility pkgdb location exists, but PKG_DBDIR not specified. \
This may cause unexpected issues. To avoid problems, add \
PKG_DBDIR=${_OLD_DEFAULT_PKGDB_DIR} to /etc/mk.conf.
.endif

_OPSYS_SUPPORTS_CWRAPPERS= yes

# use readelf in check/bsd.check-vars.mk
Expand Down

0 comments on commit ce75854

Please sign in to comment.