aboutsummaryrefslogtreecommitdiff
path: root/release/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/make-oci-image.sh2
-rwxr-xr-xrelease/scripts/make-pkg-package.sh41
-rwxr-xr-xrelease/scripts/pkgbase-stage.lua127
3 files changed, 71 insertions, 99 deletions
diff --git a/release/scripts/make-oci-image.sh b/release/scripts/make-oci-image.sh
index 8a620e9d8973..6e5ad69741f7 100644
--- a/release/scripts/make-oci-image.sh
+++ b/release/scripts/make-oci-image.sh
@@ -47,7 +47,7 @@ install_packages() {
# metadata for what was installed). This trims more than 40Mb from the
# resulting image.
env IGNORE_OSVERSION=yes ABI=${abi} pkg --rootdir ${rootdir} --repo-conf-dir ${workdir}/repos \
- install -yq "$@" || exit $?
+ install -yq -g "$@" || exit $?
rm -rf ${rootdir}/var/db/pkg/repos
}
diff --git a/release/scripts/make-pkg-package.sh b/release/scripts/make-pkg-package.sh
index 68172c47f326..3a1b163bd591 100755
--- a/release/scripts/make-pkg-package.sh
+++ b/release/scripts/make-pkg-package.sh
@@ -1,26 +1,31 @@
#!/bin/sh
-#
-#
-# Simulate the build environment.
-eval $(make -C ${SRCDIR} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} buildenvvars)
+# Simulate the build environment. Note that we need to unset some variables
+# which are set in the src tree since they have different (unwanted) effects
+# in the ports tree.
+SRC_PKG_VERSION=${PKG_VERSION}
+PKG_ABI=$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)
+unset PKG_VERSION
+unset MAKEFLAGS
+unset PKGBASE
+# Ports interprets CROSS_TOOLCHAIN differently from src, and having this set
+# breaks the package-pkg build. For now, forcibly unset this and hope ports
+# can find a working compiler.
+if [ -n "$CROSS_TOOLCHAIN" ]; then
+ printf >&2 '%s: WARNING: CROSS_TOOLCHAIN will be ignored for the pkg build.\n' "$0"
+ unset CROSS_TOOLCHAIN
+fi
export WRKDIRPREFIX=/tmp/ports.${TARGET}
-export WSTAGEDIR=${WSTAGEDIR}
-export REPODIR=${REPODIR}
-export PKG_CMD=${PKG_CMD}
-export PKG_VERSION=${PKG_VERSION}
-export OSVERSION=${OSVERSION}
-export WRKDIR=$(make -C ${PORTSDIR}/ports-mgmt/pkg -V WRKDIR)
+export DISTDIR=/tmp/distfiles
+export WRKDIR=$(make -C ${PORTSDIR}/ports-mgmt/pkg I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=YES -V WRKDIR)
make -C ${PORTSDIR}/ports-mgmt/pkg TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
- CONFIGURE_ARGS="--host=$(uname -m)-portbld-freebsd${REVISION}" \
- stage create-manifest
+ CONFIGURE_ARGS="--host=$(uname -m)-portbld-freebsd${REVISION} --prefix=${LOCALBASE}" \
+ I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=YES \
+ BATCH=YES stage create-manifest
-${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh \
- create -v -m ${WRKDIR}/.metadir/ \
+${PKG_CMD} -o ABI=${PKG_ABI} \
+ create -v -m ${WRKDIR}/.metadir.pkg/ \
-r ${WRKDIR}/stage \
-p ${WRKDIR}/.PLIST.mktmp \
- -o ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
-mkdir -p ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/
-cd ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/ && \
- ln -s ../pkg-*.txz
+ -o ${REPODIR}/${PKG_ABI}/${SRC_PKG_VERSION}
diff --git a/release/scripts/pkgbase-stage.lua b/release/scripts/pkgbase-stage.lua
index 1b48b4faede3..efc4f8af0cbf 100755
--- a/release/scripts/pkgbase-stage.lua
+++ b/release/scripts/pkgbase-stage.lua
@@ -18,87 +18,59 @@ local function capture(command)
return output:match("(.-)\n$") or output
end
-local function append_list(list, other)
- for _, item in ipairs(other) do
- table.insert(list, item)
- end
-end
-
-- Returns a list of packages to be included in the given media
local function select_packages(pkg, media, all_libcompats)
- local components = {
- kernel = {},
- kernel_dbg = {},
- base = {},
- base_dbg = {},
- src = {},
- tests = {},
+ -- Note: if you update this list, you must also update the list in
+ -- usr.sbin/bsdinstall/scripts/pkgbase.in.
+ local kernel_packages = {
+ -- Most architectures use this
+ ["FreeBSD-kernel-generic"] = true,
+ -- PowerPC uses either of these, depending on platform
+ ["FreeBSD-kernel-generic64"] = true,
+ ["FreeBSD-kernel-generic64le"] = true,
}
- for compat in all_libcompats:gmatch("%S+") do
- components["lib" .. compat] = {}
- components["lib" .. compat .. "_dbg"] = {}
- end
-
+ local components = {}
local rquery = capture(pkg .. "rquery -U -r FreeBSD-base %n")
for package in rquery:gmatch("[^\n]+") do
- if package == "FreeBSD-src" or package:match("^FreeBSD%-src%-.*") then
- table.insert(components["src"], package)
- elseif package == "FreeBSD-tests" or package:match("^FreeBSD%-tests%-.*") then
- table.insert(components["tests"], package)
- elseif package:match("^FreeBSD%-kernel%-.*") and
- package ~= "FreeBSD-kernel-man"
- then
- -- Kernels other than FreeBSD-kernel-generic are ignored
- if package == "FreeBSD-kernel-generic" then
- table.insert(components["kernel"], package)
- elseif package == "FreeBSD-kernel-generic-dbg" then
- table.insert(components["kernel_dbg"], package)
- end
- elseif package:match(".*%-dbg$") then
- table.insert(components["base_dbg"], package)
- else
- local found = false
- for compat in all_libcompats:gmatch("%S+") do
- if package:match(".*%-dbg%-lib" .. compat .. "$") then
- table.insert(components["lib" .. compat .. "_dbg"], package)
- found = true
- break
- elseif package:match(".*%-lib" .. compat .. "$") then
- table.insert(components["lib" .. compat], package)
- found = true
- break
- end
- end
- if not found then
- table.insert(components["base"], package)
- end
+ local set = package:match("^FreeBSD%-set%-(.*)$")
+ if set then
+ components[set] = package
+ elseif kernel_packages[package] then
+ components["kernel"] = package
+ elseif kernel_packages[package:match("(.*)%-dbg$")] then
+ components["kernel-dbg"] = package
+ elseif package == "pkg" then
+ components["pkg"] = package
end
end
- assert(#components["kernel"] == 1)
- assert(#components["base"] > 0)
+ assert(components["kernel"])
+ assert(components["base"])
+ assert(components["pkg"])
local selected = {}
if media == "disc" then
- append_list(selected, components["base"])
- append_list(selected, components["kernel"])
- append_list(selected, components["kernel_dbg"])
- append_list(selected, components["src"])
- append_list(selected, components["tests"])
+ table.insert(selected, components["pkg"])
+ table.insert(selected, components["base"])
+ table.insert(selected, components["kernel"])
+ table.insert(selected, components["kernel-dbg"])
+ table.insert(selected, components["src"])
+ table.insert(selected, components["tests"])
for compat in all_libcompats:gmatch("%S+") do
- append_list(selected, components["lib" .. compat])
+ table.insert(selected, components["lib" .. compat])
end
else
assert(media == "dvd")
- append_list(selected, components["base"])
- append_list(selected, components["base_dbg"])
- append_list(selected, components["kernel"])
- append_list(selected, components["kernel_dbg"])
- append_list(selected, components["src"])
- append_list(selected, components["tests"])
+ table.insert(selected, components["pkg"])
+ table.insert(selected, components["base"])
+ table.insert(selected, components["base-dbg"])
+ table.insert(selected, components["kernel"])
+ table.insert(selected, components["kernel-dbg"])
+ table.insert(selected, components["src"])
+ table.insert(selected, components["tests"])
for compat in all_libcompats:gmatch("%S+") do
- append_list(selected, components["lib" .. compat])
- append_list(selected, components["lib" .. compat .. "_dbg"])
+ table.insert(selected, components["lib" .. compat])
+ table.insert(selected, components["lib" .. compat .. "-dbg"])
end
end
@@ -109,31 +81,26 @@ 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])
-
- 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())
+ -- 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 INSTALL_AS_USER=1 -o PKG_DBDIR=./pkgdb -R ./pkgbase-repo-conf "
+ "-o ABI=" .. ABI .. " " ..
+ "-o INSTALL_AS_USER=1 -o PKG_DBDIR=" .. PKGDB .. " -R " .. repo_dir .. " "
assert(os.execute(pkg .. "update"))
local packages = select_packages(pkg, media, all_libcompats)
- assert(os.execute(pkg .. "fetch -o " .. target .. " " .. table.concat(packages, " ")))
+ assert(os.execute(pkg .. "fetch -d -o " .. target .. " " .. table.concat(packages, " ")))
assert(os.execute(pkg .. "repo " .. target))
end