mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 07:22:20 +00:00
packaging/qemu: Add common code to apply patches
The qemu and qemu-virtiofs Dockerfile files repeat the code to apply patches based on QEMU stable branch being built. Instead, this adds a common script (qemu/apply_patches.sh) and make it called by the respective Dockerfile files. Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
edce2712cd
commit
512b38cf61
27
tools/packaging/qemu/apply_patches.sh
Executable file
27
tools/packaging/qemu/apply_patches.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 Red Hat, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This script apply the needed for Kata Containers patches on QEMU.
|
||||
# Note: It should be executed from inside the QEMU source directory.
|
||||
#
|
||||
set -e
|
||||
|
||||
script_dir="$(realpath $(dirname $0))"
|
||||
|
||||
qemu_version="$(cat VERSION)"
|
||||
stable_branch=$(echo $qemu_version | \
|
||||
awk 'BEGIN{FS=OFS="."}{print $1 "." $2 ".x"}')
|
||||
patches_dir="${script_dir}/patches/${stable_branch}"
|
||||
|
||||
echo "Handle patches for QEMU $qemu_version (stable ${stable_branch})"
|
||||
if [ -d $patches_dir ]; then
|
||||
for patch in $(find $patches_dir -name '*.patch'); do
|
||||
echo "Apply $patch"
|
||||
git apply "$patch"
|
||||
done
|
||||
else
|
||||
echo "No patches to apply"
|
||||
fi
|
@ -49,23 +49,16 @@ RUN cd .. && git clone "${QEMU_VIRTIOFS_REPO}" qemu-virtiofs
|
||||
RUN git checkout "${QEMU_VIRTIOFS_TAG}"
|
||||
|
||||
ADD scripts/configure-hypervisor.sh /root/configure-hypervisor.sh
|
||||
ADD qemu/patches/ /root/kata_qemu_patches
|
||||
ADD qemu /root/kata_qemu
|
||||
|
||||
# Apply experimental specific patches
|
||||
# Patches to quick fix virtiofs fork
|
||||
ENV VIRTIOFS_PATCHES_DIR=/root/kata_qemu_patches/${QEMU_VIRTIOFS_TAG}/
|
||||
ENV VIRTIOFS_PATCHES_DIR=/root/kata_qemu/patches/${QEMU_VIRTIOFS_TAG}/
|
||||
RUN find "${VIRTIOFS_PATCHES_DIR}" -name '*.patch' -type f |sort -t- -k1,1n > patches_virtiofs
|
||||
RUN echo "Patches to apply for virtiofs fixes:"
|
||||
RUN cat patches_virtiofs
|
||||
RUN [ ! -s patches_virtiofs ] || git apply $(cat patches_virtiofs)
|
||||
|
||||
RUN cat VERSION | awk 'BEGIN{FS=OFS="."}{print $1 "." $2 ".x"}' > stable_branch
|
||||
RUN echo "/root/kata_qemu_patches/$(cat stable_branch)/" > patches_qemu_dir
|
||||
RUN echo "patches dir $(cat patches_qemu_dir)"
|
||||
RUN find "$(cat patches_qemu_dir)" -name '*.patch' -type f |sort -t- -k1,1n > patches_qemu
|
||||
RUN echo "Patches to apply for qemu:"
|
||||
RUN cat patches_qemu
|
||||
RUN [ ! -s patches_qemu ] || git apply $(cat patches_qemu )
|
||||
RUN /root/kata_qemu/apply_patches.sh
|
||||
|
||||
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s kata-qemu | sed -e 's|--disable-seccomp||g' | xargs ./configure \
|
||||
--with-pkgversion=kata-static
|
||||
|
@ -48,15 +48,9 @@ RUN git clone https://github.com/qemu/capstone.git capstone
|
||||
RUN git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
|
||||
|
||||
ADD scripts/configure-hypervisor.sh /root/configure-hypervisor.sh
|
||||
ADD qemu/patches/ /root/kata_qemu_patches
|
||||
ADD qemu /root/kata_qemu
|
||||
|
||||
RUN \
|
||||
cat VERSION; \
|
||||
stable_branch=$(cat VERSION | awk 'BEGIN{FS=OFS="."}{print $1 "." $2 ".x"}');\
|
||||
for patch in $(find /root/kata_qemu_patches/${stable_branch}/ -name '*.patch'); do\
|
||||
echo "apply $patch";\
|
||||
git apply "$patch"; \
|
||||
done
|
||||
RUN /root/kata_qemu/apply_patches.sh
|
||||
|
||||
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s kata-qemu | xargs ./configure \
|
||||
--with-pkgversion=kata-static
|
||||
|
Loading…
Reference in New Issue
Block a user