The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=523fece9d11e5d084c1d20d10d05971f5354d343
commit 523fece9d11e5d084c1d20d10d05971f5354d343 Author: Colin Percival <cperc...@freebsd.org> AuthorDate: 2025-09-27 01:23:20 +0000 Commit: Colin Percival <cperc...@freebsd.org> CommitDate: 2025-09-27 04:08:00 +0000 pkgbase-stage: Use unique PKG_DBDIR Prior to this commit, pkgbase-stage.lua used a hard-coded PKG_DBDIR "./pkgdb"; unfortunately this creates a race condition if we start building disc1.iso and dvd1.iso at the same time pkg: sqlite error while executing CREATE TABLE licenses [...] in file pkgdb.c:2330: table licenses already exists since pkg checks to see if the pkgdb is initialized and initializes it if not. Use separate pkgdb-disc1 and pkgdb-dvd directories. MFC after: 1 minute Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D52755 --- release/Makefile | 6 +++--- release/scripts/pkgbase-stage.lua | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/release/Makefile b/release/Makefile index d131a36157d7..82617c1f4dd7 100644 --- a/release/Makefile +++ b/release/Makefile @@ -134,7 +134,7 @@ CLEANFILES+= ${I}.xz .if defined(WITH_DVD) && !empty(WITH_DVD) CLEANFILES+= pkg-stage .endif -CLEANDIRS= dist pkgdb pkgbase-repo pkgbase-repo-dir ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd +CLEANDIRS= dist pkgdb-dvd pkgdb-disc1 pkgbase-repo pkgbase-repo-dir ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd beforeclean: chflags -R noschg . .include <bsd.obj.mk> @@ -229,7 +229,7 @@ disc1: ${PKGBASE_REPO_DIR} ${.CURDIR}/scripts/pkgbase-stage.lua disc \ ${.OBJDIR}/pkgbase-repo-dir \ ${.TARGET}/usr/freebsd-packages/offline \ - "${_ALL_libcompats}" ${PKG_ABI} + "${_ALL_libcompats}" ${PKG_ABI} ${.OBJDIR}/pkgdb-disc1 cp ${.CURDIR}/scripts/FreeBSD-base-offline.conf \ ${.TARGET}/usr/freebsd-packages/repos/ mtree -c -p ${.TARGET}/usr/freebsd-packages | \ @@ -329,7 +329,7 @@ dvd: ${PKGBASE_REPO_DIR} ${.CURDIR}/scripts/pkgbase-stage.lua dvd \ ${.OBJDIR}/pkgbase-repo-dir \ ${.TARGET}/usr/freebsd-packages/offline \ - "${_ALL_libcompats}" ${PKG_ABI} + "${_ALL_libcompats}" ${PKG_ABI} ${.OBJDIR}/pkgdb-dvd cp ${.CURDIR}/scripts/FreeBSD-base-offline.conf \ ${.TARGET}/usr/freebsd-packages/repos/ mtree -c -p ${.TARGET}/usr/freebsd-packages | \ diff --git a/release/scripts/pkgbase-stage.lua b/release/scripts/pkgbase-stage.lua index 80de4ec80d20..efc4f8af0cbf 100755 --- a/release/scripts/pkgbase-stage.lua +++ b/release/scripts/pkgbase-stage.lua @@ -89,10 +89,12 @@ local function main() local all_libcompats = assert(arg[4]) -- ABI of repository local ABI = assert(arg[5]) + -- pkgdb to use + local PKGDB = assert(arg[6]) local pkg = "pkg -o ASSUME_ALWAYS_YES=yes -o IGNORE_OSVERSION=yes " .. "-o ABI=" .. ABI .. " " .. - "-o INSTALL_AS_USER=1 -o PKG_DBDIR=./pkgdb -R " .. repo_dir .. " " + "-o INSTALL_AS_USER=1 -o PKG_DBDIR=" .. PKGDB .. " -R " .. repo_dir .. " " assert(os.execute(pkg .. "update"))