tl;dr
I think it is time to change the default PKG_DBDIR to $PREFIX/pkgdb rather than the current transitional "use /var/db/pkg is present, else $PREFIX/pkgdb"
narrative:
Just had an entertaining time split brain /var/db/pkg and /usr/pkg/pkgdb on a fresh NetBSD-9.2 macppc box trying to use pkgin. /usr/sbin/pkg_add is set to use /var/db/pkg, and pkg_add from the pkg_install binary package is set to use the old /var/db/pkg
- rm /usr/pkg /var/db/pkg* (start clean)
- pkg_add {pathto}pkgin (/usr/sbin/pkg_add uses /usr/pkg/pkgdb)
- pkgin install doas (/usr/pkg/sbin/pkg_add uses /var/db/pkg)
I can set PKGDBDIR=/usr/pkg/pkgdb in /usr/pkg/etc/pkg_install.conf to avoid this, and (from discussions on
https://matrix.to/#/#pkgsrc:libera.chat ) having the binary package builder ensure /var/db/pkg is removed before rebuilding the binaries will resolve it, but I think the time has come to commit to the move to $PREFIX/pkgdb
People who want to keep using /var/db/pkg can be the ones to set PKGDBDIR
If we really want to avoid disrupting existing /var/db/pkg installs, then we could adjust the check for the presence of /var/db/pkg/pkgdb.byfile.db
Thanks
David