Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Sep 2025 04:10:01 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d2b670b27f37 - stable/15 - pkgbase-stage: Use unique PKG_DBDIR
Message-ID:  <202509270410.58R4A1S4024499@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/15 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=d2b670b27f37df65d0db11182ed5a0873f6ad8e6

commit d2b670b27f37df65d0db11182ed5a0873f6ad8e6
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-09-27 01:23:20 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-09-27 04:09:37 +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
    
    (cherry picked from commit 523fece9d11e5d084c1d20d10d05971f5354d343)
---
 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 73ab2b7cb250..425223747148 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -133,7 +133,7 @@ CLEANFILES+=	${I}.xz
 .if defined(WITH_DVD) && !empty(WITH_DVD)
 CLEANFILES+=	pkg-stage
 .endif
-CLEANDIRS=	dist pkgdb pkgbase-repo pkgbase-repo-conf ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
+CLEANDIRS=	dist pkgdb-dvd pkgdb-disc1 pkgbase-repo pkgbase-repo-conf ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
 beforeclean:
 	chflags -R noschg .
 .include <bsd.obj.mk>
@@ -220,7 +220,7 @@ disc1: ${PKGBASE_REPO}
 	${.CURDIR}/scripts/pkgbase-stage.lua disc \
 	    ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
 	    ${.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 | \
@@ -318,7 +318,7 @@ dvd: ${PKGBASE_REPO}
 	${.CURDIR}/scripts/pkgbase-stage.lua dvd \
 	    ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
 	    ${.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 6845e0079b05..56cb2dc758ec 100755
--- a/release/scripts/pkgbase-stage.lua
+++ b/release/scripts/pkgbase-stage.lua
@@ -89,6 +89,8 @@ 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])
 
 	assert(os.execute("mkdir -p pkgbase-repo-conf"))
 	local f <close> = assert(io.open("pkgbase-repo-conf/FreeBSD-base.conf", "w"))
@@ -102,7 +104,7 @@ local function main()
 
 	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 ./pkgbase-repo-conf "
+	    "-o INSTALL_AS_USER=1 -o PKG_DBDIR=" .. PKGDB .. " -R ./pkgbase-repo-conf "
 
 	assert(os.execute(pkg .. "update"))
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509270410.58R4A1S4024499>