Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Oct 2025 16:53:42 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: 6e93fa6a6cca - stable/15 - release: create pkgbase repo config from Makefile
Message-ID:  <202510031653.593GrgoE064190@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=6e93fa6a6cca88e1d5beb58766991d7f2b223827

commit 6e93fa6a6cca88e1d5beb58766991d7f2b223827
Author:     Isaac Freund <ifreund@freebsdfoundation.org>
AuthorDate: 2025-07-24 08:43:33 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-03 16:49:34 +0000

    release: create pkgbase repo config from Makefile
    
    This will allow the VM image build scripts to use the same repository
    config file for installing base system packages at build time.
    
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D51482
    
    (cherry picked from commit f4f0308440d2321fa9172dab1029f16a70289e4e)
---
 release/Makefile                  | 22 +++++++++++++++-------
 release/scripts/pkgbase-stage.lua | 18 ++++--------------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/release/Makefile b/release/Makefile
index 6aec279cf161..27a5d58c828d 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-dvd pkgdb-disc1 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-dir ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
 beforeclean:
 	chflags -R noschg .
 .include <bsd.obj.mk>
@@ -195,8 +195,10 @@ dvd: packagesystem
 .endif
 
 .if !defined(NOPKGBASE) || empty(NOPKGBASE)
-PKGBASE_REPO=	pkgbase-repo
-PKG_ABI=	$$(${PKG_CMD} -o ABI_FILE=${.TARGET}/usr/bin/uname config ABI)
+PKGBASE_REPO_DIR= pkgbase-repo-dir
+WSTAGEDIR!=	${IMAKE} -f Makefile.inc1 -C ${WORLDDIR} -V WSTAGEDIR
+PKG_ABI_FILE=	${WSTAGEDIR}/usr/bin/uname
+PKG_ABI=	$$(${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI)
 .endif
 
 pkgbase-repo:
@@ -205,7 +207,13 @@ pkgbase-repo:
 	( ${IMAKE} -C ${WORLDDIR} packages REPODIR=${.OBJDIR}/pkgbase-repo \
 	    INCLUDE_PKG_IN_PKGBASE_REPO=YES BOOTSTRAP_PKG_FROM_PORTS=YES )
 
-disc1: ${PKGBASE_REPO}
+pkgbase-repo-dir: pkgbase-repo
+	mkdir -p pkgbase-repo-dir
+	printf "FreeBSD-base: { url: "file://%s", enabled: yes }" \
+	    ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
+	    > pkgbase-repo-dir/FreeBSD-base.conf
+
+disc1: ${PKGBASE_REPO_DIR}
 # Install system
 	mkdir -p ${.TARGET}
 	( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
@@ -219,7 +227,7 @@ disc1: ${PKGBASE_REPO}
 # Create offline pkgbase repo on release media
 	mkdir -p ${.TARGET}/usr/freebsd-packages/repos/
 	${.CURDIR}/scripts/pkgbase-stage.lua disc \
-	    ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
+	    ${.OBJDIR}/pkgbase-repo-dir \
 	    ${.TARGET}/usr/freebsd-packages/offline \
 	    "${_ALL_libcompats}" ${PKG_ABI} ${.OBJDIR}/pkgdb-disc1
 	cp ${.CURDIR}/scripts/FreeBSD-base-offline.conf \
@@ -307,7 +315,7 @@ bootonly:
 	echo "./boot/loader.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
 	echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
 
-dvd: ${PKGBASE_REPO}
+dvd: ${PKGBASE_REPO_DIR}
 # Install system
 	mkdir -p ${.TARGET}
 	( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
@@ -317,7 +325,7 @@ dvd: ${PKGBASE_REPO}
 # Create offline pkgbase repo on release media
 	mkdir -p ${.TARGET}/usr/freebsd-packages/repos/
 	${.CURDIR}/scripts/pkgbase-stage.lua dvd \
-	    ${.OBJDIR}/pkgbase-repo/${PKG_ABI}/latest \
+	    ${.OBJDIR}/pkgbase-repo-dir \
 	    ${.TARGET}/usr/freebsd-packages/offline \
 	    "${_ALL_libcompats}" ${PKG_ABI} ${.OBJDIR}/pkgdb-dvd
 	cp ${.CURDIR}/scripts/FreeBSD-base-offline.conf \
diff --git a/release/scripts/pkgbase-stage.lua b/release/scripts/pkgbase-stage.lua
index 56cb2dc758ec..efc4f8af0cbf 100755
--- a/release/scripts/pkgbase-stage.lua
+++ b/release/scripts/pkgbase-stage.lua
@@ -81,30 +81,20 @@ local function main()
 	-- Determines package subset selected
 	local media = assert(arg[1])
 	assert(media == "disc" or media == "dvd")
-	-- Local repository to fetch from
-	local source = assert(arg[2])
+	-- Directory containing FreeBSD-base repository config
+	local repo_dir = assert(arg[2])
 	-- Directory to create new repository
 	local target = assert(arg[3])
-	-- =hitespace separated list of all libcompat names (e.g. "32")
+	-- Whitespace separated list of all libcompat names (e.g. "32")
 	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"))
-	assert(f:write(string.format([[
-	FreeBSD-base: {
-	  url: "file://%s",
-	  enabled: yes
-	}
-	]], source)))
-	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 "
+	    "-o INSTALL_AS_USER=1 -o PKG_DBDIR=" .. PKGDB .. " -R " .. repo_dir .. " "
 
 	assert(os.execute(pkg .. "update"))
 



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