build_packages: Exclude OEM sysext packages when running eclean packages

Also simplify the exclusion mechanism while we're at it.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
James Le Cuirot 2026-02-04 14:29:31 +00:00
parent aae53b1537
commit 85d9c51033
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137
2 changed files with 7 additions and 23 deletions

View File

@ -11,19 +11,3 @@ EXTRA_SYSEXTS=(
"python|dev-lang/python,dev-python/pip"
"zfs|sys-fs/zfs"
)
_get_unversioned_sysext_packages_unsorted() {
for sysext in "${EXTRA_SYSEXTS[@]}"; do
IFS="|" read -r _ PACKAGE_ATOMS _ <<< "$sysext"
IFS=,
for atom in $PACKAGE_ATOMS; do
qatom "$atom" -F "%{CATEGORY}/%{PN}"
done
unset IFS
done
}
get_unversioned_sysext_packages() {
_get_unversioned_sysext_packages_unsorted | sort | uniq
}

View File

@ -291,6 +291,10 @@ fi
export KBUILD_BUILD_USER="${BUILD_USER:-build}"
export KBUILD_BUILD_HOST="${BUILD_HOST:-pony-truck.infra.kinvolk.io}"
# Gather a list of packages we build with --buildpkgonly to prevent them from
# getting cleaned by `eclean --deep packages` below.
eclean_excludes=$(mktemp) || die_notrace "Couldn't create temporary exclusions file for eclean"
# Build sysext packages from an array of sysext definitions.
# Usage: build_sysext_packages "description" "${SYSEXT_ARRAY[@]}"
# Array format: "name|packages|useflags|arches"
@ -307,6 +311,7 @@ build_sysext_packages() {
info "Building packages for $sysext_name sysext with USE=$useflags"
IFS=,
qatom -F "%{CATEGORY}/%{PN}" ${package_atoms} >> "${eclean_excludes}"
for package in $package_atoms; do
# --buildpkgonly does not install dependencies, so we install them
# separately before building the binary package
@ -375,13 +380,8 @@ if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_FALSE}" ]]; then
fi
fi
exclusions_file=$(mktemp)
if [ ! -f "$exclusions_file" ]; then
die_notrace "Couldn't create temporary exclusions file $exclusions_file for eclean"
fi
get_unversioned_sysext_packages > "$exclusions_file"
eclean-"$BOARD" -d --exclude-file="$exclusions_file" packages
rm -f "$exclusions_file"
eclean-"$BOARD" --deep --exclude-file="${eclean_excludes}" packages
rm -f "${eclean_excludes}"
# run eclean again, this time without the --deep option, to clean old versions
# of sysext packages (those, for which .ebuild file no longer exists)
eclean-"$BOARD" packages