mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
packaging/qemu: Build and package completely in the container
Currently QEMU is built inside the container, its tarball pulled to the host, files removed then packaged again. Instead, let's run all those steps inside the container and the resulting tarball will be the final version. For that end, it is introduced the qemu-build-post.sh script which will remove the uneeded files and create the tarball. The patterns for directories on qemu.blacklist had to be changed to work properly with `find -path`. Fixes #1168 Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
28
tools/packaging/static-build/scripts/qemu-build-post.sh
Executable file
28
tools/packaging/static-build/scripts/qemu-build-post.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This script process QEMU post-build.
|
||||
#
|
||||
set -e
|
||||
|
||||
script_dir="$(realpath $(dirname $0))"
|
||||
source "${script_dir}/../qemu.blacklist"
|
||||
|
||||
if [[ -z "${QEMU_TARBALL}" || -z "${QEMU_DESTDIR}" ]]; then
|
||||
echo "$0: needs QEMU_TARBALL and QEMU_DESTDIR exported"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd "${QEMU_DESTDIR}"
|
||||
# Remove files to reduce the surface.
|
||||
echo "INFO: remove uneeded files"
|
||||
for pattern in ${qemu_black_list[@]}; do
|
||||
find . -path "$pattern" | xargs rm -rfv
|
||||
done
|
||||
|
||||
echo "INFO: create the tarball"
|
||||
tar -czvf "${QEMU_TARBALL}" *
|
||||
popd
|
||||
Reference in New Issue
Block a user