build(qemu): fix grep portability and document container-only rm -rf

Use 'CONFIG_VIRTIO_MEM=' prefix match instead of '\b' word boundary in
grep -v: \b is a GNU extension not guaranteed by POSIX, making the
ppc64le VIRTIO_MEM exclusion unreliable on non-GNU grep implementations.

Add a comment on the rm -rf call to make clear this script always runs
inside a dedicated build container, so deleting a relative path is safe.

Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
Zvonko Kaiser
2026-07-14 18:46:04 +00:00
parent 4ccf554486
commit 9cfa15fd1f

View File

@@ -26,6 +26,8 @@ HYPERVISOR_NAME="${HYPERVISOR_NAME:-}"
PREFIX="${PREFIX:-}"
PKGVERSION=${PKGVERSION:-}
# This script always runs inside a dedicated build container (see
# static-build/qemu/Dockerfile), so rm -rf of a relative path is safe.
rm -rf qemu
git clone --depth=1 "${QEMU_REPO}" qemu
pushd qemu
@@ -85,7 +87,7 @@ elif [[ "${ARCH}" == "aarch64" ]]; then
elif [[ "${ARCH}" == "ppc64le" ]]; then
# VIRTIO_MEM depends on VIRTIO_MEM_SUPPORTED, which is only selected on
# arm/i386/s390x — ppc64 PSeries does not support virtio-mem.
_PPC64_DEVS=$(printf '%s' "${_COMMON_DEVS}" | grep -v 'VIRTIO_MEM\b')
_PPC64_DEVS=$(printf '%s' "${_COMMON_DEVS}" | grep -v 'CONFIG_VIRTIO_MEM=')
printf 'CONFIG_PSERIES=y\n%s\n' "${_PPC64_DEVS}" \
>> configs/devices/ppc64-softmmu/default.mak
unset _PPC64_DEVS