git: da62a299de31 - stable/15 - release: Pass ABI to pkgbase-stage.lua

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Sun, 14 Sep 2025 02:05:29 UTC
The branch stable/15 has been updated by cperciva:

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

commit da62a299de313964b9a9be2709e04eff857da5ca
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-09-14 02:01:26 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-09-14 02:05:21 +0000

    release: Pass ABI to pkgbase-stage.lua
    
    We then pass ABI from pkgbase-stage.lua to pkg(8); without this,
    cross-building releases with PKGBASE enabled fails with
    
    pkg: wrong architecture: ...
    pkg: repository FreeBSD-base contains packages with wrong ABI: ...
    
    MFC after:      1 minute
    Discussed with: emaste, jrtc27
    Sponsored by:   https://www.patreon.com/c/cperciva
    
    (cherry picked from commit 340e68fd7c0d62cac1f0876b6475a89df5065db5)
---
 release/Makefile                  | 2 +-
 release/scripts/pkgbase-stage.lua | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/release/Makefile b/release/Makefile
index 6fd3b2f61325..d0177c8aae5f 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -213,7 +213,7 @@ disc1: ${PKGBASE_REPO}
 	${.CURDIR}/scripts/pkgbase-stage.lua disc \
 	    ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
 	    ${.TARGET}/usr/freebsd-packages/offline \
-	    "${_ALL_libcompats}"
+	    "${_ALL_libcompats}" ${PKG_ABI}
 	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 1b48b4faede3..a12ec372d1a9 100755
--- a/release/scripts/pkgbase-stage.lua
+++ b/release/scripts/pkgbase-stage.lua
@@ -115,6 +115,8 @@ local function main()
 	local target = assert(arg[3])
 	-- =hitespace separated list of all libcompat names (e.g. "32")
 	local all_libcompats = assert(arg[4])
+	-- ABI of repository
+	local ABI = assert(arg[5])
 
 	assert(os.execute("mkdir -p pkgbase-repo-conf"))
 	local f <close> = assert(io.open("pkgbase-repo-conf/FreeBSD-base.conf", "w"))
@@ -127,6 +129,7 @@ local function main()
 	assert(f:close())
 
 	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 "
 
 	assert(os.execute(pkg .. "update"))