fedora-cosmic: drop hardware/VM packages not needed on the target host
Trim NVIDIA, Intel GPU/audio/platform, other wireless vendors and VM guest packages from the cloned upstream manifests, and block linux-firmware's recommends of them via a generated exclude list. Keeps amd-gpu-firmware, amd-ucode-firmware, iwlwifi-mvm-firmware (AX200) and alsa-sof-firmware.
This commit is contained in:
@@ -83,6 +83,45 @@ gpgcheck=0
|
||||
EOF
|
||||
}
|
||||
|
||||
# Drop packages listed in a blocklist from the cloned upstream package
|
||||
# manifests. rpm-ostree refuses (fatally) to exclude a package that an included
|
||||
# manifest declares, so remove those lines at the source instead.
|
||||
trim_upstream_packages() {
|
||||
local root="$1"
|
||||
local blocklist="$2"
|
||||
local f
|
||||
for f in "${root}"/packages/*.yaml; do
|
||||
[[ -f "${f}" ]] || continue
|
||||
awk '
|
||||
NR == FNR {
|
||||
if ($0 ~ /^[[:space:]]*#/ || $0 ~ /^[[:space:]]*$/) next
|
||||
skip[$0] = 1
|
||||
next
|
||||
}
|
||||
{
|
||||
line = $0
|
||||
sub(/^[[:space:]]*-[[:space:]]*/, "", line)
|
||||
if (line in skip) next
|
||||
print
|
||||
}
|
||||
' "${blocklist}" "${f}" > "${f}.tmp"
|
||||
mv "${f}.tmp" "${f}"
|
||||
done
|
||||
}
|
||||
|
||||
# Generate an exclude-packages snippet from the same blocklist. This blocks the
|
||||
# removed packages from being pulled back in as recommends (e.g. linux-firmware
|
||||
# recommends the split firmware packages).
|
||||
generate_exclude_yaml() {
|
||||
local blocklist="$1"
|
||||
local out="$2"
|
||||
{
|
||||
echo "# Generated by build.sh from $(basename "${blocklist}") - do not edit."
|
||||
echo "exclude-packages:"
|
||||
grep -vE '^[[:space:]]*(#|$)' "${blocklist}" | sed 's/^/ - /'
|
||||
} > "${out}"
|
||||
}
|
||||
|
||||
case "${BUILD_MODE}" in
|
||||
upstream)
|
||||
[[ -n "${UPSTREAM_REPO}" ]] || { echo "UPSTREAM_REPO not set in ${CONF}" >&2; exit 1; }
|
||||
@@ -106,6 +145,12 @@ case "${BUILD_MODE}" in
|
||||
setup_token2_repo "${BUILD_DIR}/upstream"
|
||||
fi
|
||||
|
||||
if [[ -f "${IMAGE_DIR}/upstream-exclude.txt" ]]; then
|
||||
trim_upstream_packages "${BUILD_DIR}/upstream" "${IMAGE_DIR}/upstream-exclude.txt"
|
||||
generate_exclude_yaml "${IMAGE_DIR}/upstream-exclude.txt" \
|
||||
"${BUILD_DIR}/upstream/hardware-exclude.yaml"
|
||||
fi
|
||||
|
||||
MANIFEST="${BUILD_DIR}/upstream/manifest.yaml"
|
||||
;;
|
||||
standalone)
|
||||
|
||||
Reference in New Issue
Block a user