release: Rework VM package selection using sets

Filtering the list of packages broke with the introduction of package
sets, since we excluded FreeBSD-src.* but still included
FreeBSD-set-src, which transitively included the FreeBSD-src and
FreeBSD-src-sys packages.  This could be fixed by excluding package
sets, but that would be fragile, potentially breaking upgrades if
new packages are introduced.

Instead, start with an explicit set of package sets:
	base, base-dbg
	lib32, lib32-dbg
	kernels, kernels-dbg
	tests
and filter the package sets; the EC2 "small" and "builder" AMIs
filter out everything except "base" and "kernels".

Note that using FreeBSD-set-kernels may pose a problem in the future
if we start shipping packages for multiple differently-configured
kernels.  That will be addressed if and when that problem arises.

Reviewed by:	ivy
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52922
This commit is contained in:
Colin Percival committed 2025-10-06 12:40:07 -07:00
1 parent 2b6c5f041f
commit 2d184465e8
3 files changed
+12 -13

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ vm_extra_filter_base_packages() {
grep -v \
-e '.*-dbg$' \
-e '.*-lib32$' \
-e '^FreeBSD-tests.*'
-e '^FreeBSD-set-tests'
}
# Packages to install into the image we're creating. In addition to packages
+1 -1
View File
@@ -19,7 +19,7 @@ vm_extra_filter_base_packages() {
grep -v \
-e '.*-dbg$' \
-e '.*-lib32$' \
-e '^FreeBSD-tests.*'
-e '^FreeBSD-set-tests'
}
# Packages to install into the image we're creating. In addition to packages
+10 -11
View File
@@ -70,15 +70,15 @@ vm_copy_base() {
return 0
}
vm_filter_base_packages() {
# Reads a list of all base system packages from stdin.
# Writes a list of base system packages to install to stdout.
grep -v -e '^FreeBSD-src.*' -e '^FreeBSD-kernel.*'
# There are several kernel variants available in separate packages.
# For VMs it is sufficient to install only the generic kernel.
echo "FreeBSD-kernel-man"
echo "FreeBSD-kernel-generic"
echo "FreeBSD-kernel-generic-dbg"
vm_base_packages_list() {
# Output a list of package sets equivalent to what we get from
# "installworld installkernel distribution", aka. the full base
# system.
for S in base lib32 kernels; do
echo FreeBSD-set-$S
echo FreeBSD-set-$S-dbg
done
echo FreeBSD-set-tests
}
vm_extra_filter_base_packages() {
@@ -99,8 +99,7 @@ vm_install_base() {
pkg_cmd="$pkg_cmd -o METALOG=METALOG"
fi
$pkg_cmd update
selected=$($pkg_cmd rquery -U -r FreeBSD-base %n | \
vm_filter_base_packages | vm_extra_filter_base_packages)
selected=$(vm_base_packages_list | vm_extra_filter_base_packages)
$pkg_cmd install -U -r FreeBSD-base $selected
else
cd ${WORLDDIR} && \