From patchwork Wed Aug 24 14:57:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bertrand Marquis X-Patchwork-Id: 12953693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8344CC32796 for ; Wed, 24 Aug 2022 14:58:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.392780.631354 (Exim 4.92) (envelope-from ) id 1oQrpK-0004Yr-7a; Wed, 24 Aug 2022 14:57:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 392780.631354; Wed, 24 Aug 2022 14:57:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpK-0004Yi-4t; Wed, 24 Aug 2022 14:57:54 +0000 Received: by outflank-mailman (input) for mailman id 392780; Wed, 24 Aug 2022 14:57:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpI-0004Xz-M6 for xen-devel@lists.xenproject.org; Wed, 24 Aug 2022 14:57:52 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 1fab54b6-23bd-11ed-bd2e-47488cf2e6aa; Wed, 24 Aug 2022 16:57:51 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4E44911FB; Wed, 24 Aug 2022 07:57:54 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C9823F67D; Wed, 24 Aug 2022 07:57:49 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1fab54b6-23bd-11ed-bd2e-47488cf2e6aa From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v1 1/4] automation: Only filter build-*/ in gitignore Date: Wed, 24 Aug 2022 15:57:17 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 ...because there are some script in automation corresponding to the build-* filter (build-test.sh and build-each-commit.sh) Signed-off-by: Bertrand Marquis Acked-by: Jan Beulich --- Changes in v1: - instead of removing build-*, replace it by build-*/ (suggested by Jan) - rename patch accordingly --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e3fe06cd13ed..27881c976432 100644 --- a/.gitignore +++ b/.gitignore @@ -38,13 +38,13 @@ dist stubdom/*.tar.gz autom4te.cache/ +build-*/ config.log config.status config.cache config/Toplevel.mk config/Paths.mk -build-* dist/* docs/tmp.* docs/html/ From patchwork Wed Aug 24 14:57:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bertrand Marquis X-Patchwork-Id: 12953696 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C2F5C00140 for ; Wed, 24 Aug 2022 14:58:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.392782.631365 (Exim 4.92) (envelope-from ) id 1oQrpL-0004gw-01; Wed, 24 Aug 2022 14:57:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 392782.631365; Wed, 24 Aug 2022 14:57:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpK-0004gC-N5; Wed, 24 Aug 2022 14:57:54 +0000 Received: by outflank-mailman (input) for mailman id 392782; Wed, 24 Aug 2022 14:57:53 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpJ-0004Xz-FB for xen-devel@lists.xenproject.org; Wed, 24 Aug 2022 14:57:53 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 2042d4a4-23bd-11ed-bd2e-47488cf2e6aa; Wed, 24 Aug 2022 16:57:51 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 316F4139F; Wed, 24 Aug 2022 07:57:55 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60E8D3F67D; Wed, 24 Aug 2022 07:57:50 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2042d4a4-23bd-11ed-bd2e-47488cf2e6aa From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Doug Goldstein , Stefano Stabellini Subject: [PATCH v1 2/4] automation: Add elements for Yocto test and run Date: Wed, 24 Aug 2022 15:57:18 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Add a container suitable to run yocto kirkstone build based on ubuntu 22.04. It contains all packages required by Yocto and a checkout of the layers required to build Xen with Yocto. Add a build script to build and run xen on qemu using Yocto. The script supports arm32, arm64 and x86_64 and checks that dom0 is properly booting. At this stage this does not run any guest on top of dom0. The build script is currently in the same directory than the docker files so that it can be included directly in the image. This is required for the next step which creates images with an initial cache content to speed up testing. Signed-off-by: Bertrand Marquis --- Changes in v1: - add --image command line argument to build-yocto.sh to allow building something different than xen-image-minimal. - modify dockerfile to have one layer per line and make it easier to add other. I kept the for loop to keep the number of docker steps lower - update commit message to warn that no guest are tested. - fix build-yocto script to properly return with an error if expect script ends up in timeout or EOF. --- automation/build/yocto/build-yocto.sh | 328 ++++++++++++++++++++ automation/build/yocto/kirkstone.dockerfile | 100 ++++++ 2 files changed, 428 insertions(+) create mode 100755 automation/build/yocto/build-yocto.sh create mode 100644 automation/build/yocto/kirkstone.dockerfile diff --git a/automation/build/yocto/build-yocto.sh b/automation/build/yocto/build-yocto.sh new file mode 100755 index 000000000000..669359daa52e --- /dev/null +++ b/automation/build/yocto/build-yocto.sh @@ -0,0 +1,328 @@ +#!/bin/bash +# +# Yocto meta virtualization build and run script +# +# This script is building Yocto xen-image-minimal for qemu targets and run +# them using runqemu inside yocto to check that dom0 is booting properly +# The build is using a local xen source tree so that specific patches can be +# tested. +# In order to optimize the build time, a build cache is used so that only xen +# packages and its dependencies are rebuilt (qemu and final image mainly). +# + +# Directories +YOCTODIR="$HOME/yocto-layers" +CACHEDIR="$HOME/yocto-cache" +LOGDIR="$HOME/logs" +XENDIR="$HOME/xen" +BUILDDIR="$HOME/build" + +# what yocto bsp we support +TARGET_SUPPORTED="qemuarm qemuarm64 qemux86-64" +VERBOSE="n" +TARGETLIST="" + +# actions to do +do_clean="n" +do_build="y" +do_run="y" +do_localsrc="n" +build_result=0 + +# layers to include in the project +build_layerlist="poky/meta poky/meta-poky poky/meta-yocto-bsp \ + meta-openembedded/meta-oe meta-openembedded/meta-python \ + meta-openembedded/meta-filesystems \ + meta-openembedded/meta-networking meta-virtualization" + +# yocto image to build +build_image="xen-image-minimal" + +function print_progress() { + echo -n "$(date +%T) $*" +} + +function run_task() { + local task_name="$1" + local task_target="$2" + + task_log="${task_name//project_}-${task_target}" + + mkdir -p "${LOGDIR}" + print_progress + echo -n "${task_name//project_} ${task_target}: " + if [ "${VERBOSE}" = "n" ]; then + $@ > "${LOGDIR}/${task_log}.log" 2>&1 + else + $@ 2>&1 | tee "${LOGDIR}/${task_log}.log" + fi + + if [ ${?} -ne 0 ]; then + echo "Error" + build_result=$((build_result+1)) + return 1 + else + echo "OK" + return 0 + fi +} + +function project_create() { + target="${1:?}" + destdir="${BUILDDIR}/${target}" + + ( + # init yocto project + source ${YOCTODIR}/poky/oe-init-build-env "${destdir}" + + # add needed layers + for layer in ${build_layerlist}; do + bitbake-layers add-layer ${YOCTODIR}/${layer} || exit 1 + done + ) || return 1 + + # customize project configuration + cat <> "${destdir}/conf/local.conf" +# Yocto BSP +MACHINE = "${target}" + +# Use local cache to reuse previous builds results +SSTATE_DIR = "${CACHEDIR}/sstate-cache" +DL_DIR = "${CACHEDIR}/downloads" + +# Enable xen and virtualization +DISTRO_FEATURES = " virtualization xen ipv4" + +# Speed up run by not generating ssh host keys +IMAGE_INSTALL:append:pn-xen-image-minimal = " ssh-pregen-hostkeys" + +# Save some disk space +INHERIT += "rm_work" + +EOF + + if [ "${do_localsrc}" = "y" ]; then + XENVERS=$(grep -e "^XEN_REL" \ + "${YOCTODIR}"/meta-virtualization/recipes-extended/xen/xen_*.bb \ + 2> /dev/null | tr -d ' ' | tr -d '?' | tr -d '"' \ + | sed -e "s/.*=//" | sort -V | tail -n 1) + + XENBASE=$(dirname "$(realpath -m "${XENDIR}")") + XENSUB=$(basename "$(realpath -m "${XENDIR}")") + + cat <> "${destdir}/conf/local.conf" +# Use local sources for xen and xen-tools +FILESEXTRAPATHS:prepend:pn-xen := "${XENBASE}:" +FILESEXTRAPATHS:prepend:pn-xen-tools := "${XENBASE}:" + +SRC_URI:pn-xen = "file://${XENSUB}/;subdir=local-xen/" +SRC_URI:pn-xen-tools = "file://${XENSUB}/;subdir=local-xen/" + +PREFERRED_VERSION:pn-xen = "${XENVERS}%" +PREFERRED_VERSION:pn-xen-tools = "${XENVERS}%" + +S:pn-xen = "\${WORKDIR}/local-xen/${XENSUB}" +S:pn-xen-tools = "\${WORKDIR}/local-xen/${XENSUB}" + +SRCREV:pn-xen = "\${AUTOREV}" +SRCREV:pn-xen-tools = "\${AUTOREV}" + +SRCPV:pn-xen = "1" +SRCPV:pn-xen-tools = "1" + +# Disable all QA errors as the recipe is not up to date with changes in Xen +# when we use local sources +ERROR_QA:pn-xen = "arch" +ERROR_QA:pn-xen-tools = "arch" + +EOF + fi +} + +function project_build() { + target="${1:?}" + destdir="${BUILDDIR}/${target}" + + ( + source ${YOCTODIR}/poky/oe-init-build-env "${destdir}" + + bitbake "${build_image}" || exit 1 + ) || return 1 +} + +function project_clean() { + target="${1:?}" + destdir="${BUILDDIR}/${target}" + + rm -rf "${destdir}" +} + +function project_run() { + target="${1:?}" + destdir="${BUILDDIR}/${target}" + ( + source ${YOCTODIR}/poky/oe-init-build-env "${destdir}" > /dev/null 2>&1 + + /usr/bin/expect < X-Patchwork-Id: 12953695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA1AAC32793 for ; Wed, 24 Aug 2022 14:58:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.392781.631359 (Exim 4.92) (envelope-from ) id 1oQrpK-0004bm-JU; Wed, 24 Aug 2022 14:57:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 392781.631359; Wed, 24 Aug 2022 14:57:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpK-0004al-DR; Wed, 24 Aug 2022 14:57:54 +0000 Received: by outflank-mailman (input) for mailman id 392781; Wed, 24 Aug 2022 14:57:53 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpJ-0004EH-7f for xen-devel@lists.xenproject.org; Wed, 24 Aug 2022 14:57:53 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 20b1e5c8-23bd-11ed-9250-1f966e50362f; Wed, 24 Aug 2022 16:57:52 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EDA451596; Wed, 24 Aug 2022 07:57:55 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 43B0A3F67D; Wed, 24 Aug 2022 07:57:51 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 20b1e5c8-23bd-11ed-9250-1f966e50362f From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Doug Goldstein , Stefano Stabellini Subject: [PATCH v1 3/4] automation: Add yocto containers with cache Date: Wed, 24 Aug 2022 15:57:19 +0100 Message-Id: <4d0141062aaec36a7c74182729c2dcef95deded3.1661352827.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Create yocto containers for kirkstone with a builder step to fill the yocto cache by running the build script once. Those containers depend on the kirkstone.dockerfile container to be created and use it as base image. To run a build test on one image the following command must be called inside the container: build-yocto.sh --xen-dir=XENSRC TARGET where - XENSRC is the directory where xen sources are available in the container - TARGET is the build target (qemuarm64, qemuarm or qemux86_64) In case of error, the script will return an error code and the logs will be in /home/docker-build/logs. !!! The build of each container can take several hours depending on the network bandwith (for downloading all sources) and the amount of computing power on the machine where the docker images are created. !!! Signed-off-by: Bertrand Marquis --- Changes in v1: - fix dependency in Makefile --- automation/build/Makefile | 2 ++ .../build/yocto/kirkstone-qemuarm.dockerfile | 28 +++++++++++++++++++ .../yocto/kirkstone-qemuarm64.dockerfile | 28 +++++++++++++++++++ .../yocto/kirkstone-qemux86-64.dockerfile | 28 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 automation/build/yocto/kirkstone-qemuarm.dockerfile create mode 100644 automation/build/yocto/kirkstone-qemuarm64.dockerfile create mode 100644 automation/build/yocto/kirkstone-qemux86-64.dockerfile diff --git a/automation/build/Makefile b/automation/build/Makefile index a4b2b85178cf..b0dc68f00b70 100644 --- a/automation/build/Makefile +++ b/automation/build/Makefile @@ -16,5 +16,7 @@ help: $(DOCKER_CMD) push $(REGISTRY)/$(@D):$(@F); \ fi +$(subst .dockerfile,,$(wildcard yocto/kirkstone-*)): yocto/kirkstone + .PHONY: all all: $(CONTAINERS) diff --git a/automation/build/yocto/kirkstone-qemuarm.dockerfile b/automation/build/yocto/kirkstone-qemuarm.dockerfile new file mode 100644 index 000000000000..e3cdc4dcf333 --- /dev/null +++ b/automation/build/yocto/kirkstone-qemuarm.dockerfile @@ -0,0 +1,28 @@ +# Docker file to populate the initial sstate and download cache for yocto +# for a specific target +# +# This requires the build-yocto.sh script to be in the same directory as this +# dockerfile during the image creation +# +# Arguments that can be passed during image creation using --build-arg: +# "from_image=img" to select the docker image and tag to start from +# "target=qemuxxx": to select which target to build in this image + +ARG from_image=registry.gitlab.com/xen-project/xen/yocto:kirkstone + +FROM $from_image AS builder + +ARG target=qemuarm + +# This step can take one to several hours depending on your download bandwith +# and the speed of your computer +RUN /home/$USER_NAME/bin/build-yocto.sh $target + +FROM $from_image + +# Only copy the cache status +COPY --from=builder /home/$USER_NAME/yocto-cache /home/$USER_NAME/yocto-cache/. + +LABEL maintainer.name="The Xen Project " \ + maintainer.email="xen-devel@lists.xenproject.org" + diff --git a/automation/build/yocto/kirkstone-qemuarm64.dockerfile b/automation/build/yocto/kirkstone-qemuarm64.dockerfile new file mode 100644 index 000000000000..6045b6ac249f --- /dev/null +++ b/automation/build/yocto/kirkstone-qemuarm64.dockerfile @@ -0,0 +1,28 @@ +# Docker file to populate the initial sstate and download cache for yocto +# for a specific target +# +# This requires the build-yocto.sh script to be in the same directory as this +# dockerfile during the image creation +# +# Arguments that can be passed during image creation using --build-arg: +# "from_image=img" to select the docker image and tag to start from +# "target=qemuxxx": to select which target to build in this image + +ARG from_image=registry.gitlab.com/xen-project/xen/yocto:kirkstone + +FROM $from_image AS builder + +ARG target=qemuarm64 + +# This step can take one to several hours depending on your download bandwith +# and the speed of your computer +RUN /home/$USER_NAME/bin/build-yocto.sh $target + +FROM $from_image + +# Only copy the cache status +COPY --from=builder /home/$USER_NAME/yocto-cache /home/$USER_NAME/yocto-cache/. + +LABEL maintainer.name="The Xen Project " \ + maintainer.email="xen-devel@lists.xenproject.org" + diff --git a/automation/build/yocto/kirkstone-qemux86-64.dockerfile b/automation/build/yocto/kirkstone-qemux86-64.dockerfile new file mode 100644 index 000000000000..35e2fdeb1e82 --- /dev/null +++ b/automation/build/yocto/kirkstone-qemux86-64.dockerfile @@ -0,0 +1,28 @@ +# Docker file to populate the initial sstate and download cache for yocto +# for a specific target +# +# This requires the build-yocto.sh script to be in the same directory as this +# dockerfile during the image creation +# +# Arguments that can be passed during image creation using --build-arg: +# "from_image=img" to select the docker image and tag to start from +# "target=qemuxxx": to select which target to build in this image + +ARG from_image=registry.gitlab.com/xen-project/xen/yocto:kirkstone + +FROM $from_image AS builder + +ARG target=qemux86-64 + +# This step can take one to several hours depending on your download bandwith +# and the speed of your computer +RUN /home/$USER_NAME/bin/build-yocto.sh $target + +FROM $from_image + +# Only copy the cache status +COPY --from=builder /home/$USER_NAME/yocto-cache /home/$USER_NAME/yocto-cache/. + +LABEL maintainer.name="The Xen Project " \ + maintainer.email="xen-devel@lists.xenproject.org" + From patchwork Wed Aug 24 14:57:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bertrand Marquis X-Patchwork-Id: 12953694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0555C38142 for ; Wed, 24 Aug 2022 14:58:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.392783.631385 (Exim 4.92) (envelope-from ) id 1oQrpM-0005JV-Hd; Wed, 24 Aug 2022 14:57:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 392783.631385; Wed, 24 Aug 2022 14:57:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpM-0005Gy-Bf; Wed, 24 Aug 2022 14:57:56 +0000 Received: by outflank-mailman (input) for mailman id 392783; Wed, 24 Aug 2022 14:57:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oQrpK-0004Xz-FP for xen-devel@lists.xenproject.org; Wed, 24 Aug 2022 14:57:54 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 212b727c-23bd-11ed-bd2e-47488cf2e6aa; Wed, 24 Aug 2022 16:57:53 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B546415A1; Wed, 24 Aug 2022 07:57:56 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B8A53F67D; Wed, 24 Aug 2022 07:57:51 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 212b727c-23bd-11ed-bd2e-47488cf2e6aa From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Doug Goldstein , Stefano Stabellini Subject: [PATCH v1 4/4] automation: Add a clean rule for containers Date: Wed, 24 Aug 2022 15:57:20 +0100 Message-Id: <3942d90afde0714a7c4d28d92ed31624773cb933.1661352827.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Add make clean support to remove the containers from the local docker registry: - make clean: remove all images - clean-yocto/kirkstone-qemuarm: remove yocto kirkstone for qemuarm image Signed-off-by: Bertrand Marquis --- Changes in v1: - patch added --- automation/build/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/automation/build/Makefile b/automation/build/Makefile index b0dc68f00b70..9fbb49c8717e 100644 --- a/automation/build/Makefile +++ b/automation/build/Makefile @@ -4,6 +4,17 @@ REGISTRY := registry.gitlab.com/xen-project/xen CONTAINERS = $(subst .dockerfile,,$(wildcard */*.dockerfile)) DOCKER_CMD ?= docker +define CLEAN_RULE +.PHONY: clean-$(1) +clean-$(1): +ifneq ($$(shell docker image ls -q $(REGISTRY)/$(subst /,:,$(1))),) + docker image rm $(REGISTRY)/$(subst /,:,$(1)) +endif + +clean: clean-$(1) + +endef + help: @echo "Builds containers for building Xen based on different distros" @echo "To build one run 'make DISTRO/VERSION'. Available containers:" @@ -18,5 +29,9 @@ help: $(subst .dockerfile,,$(wildcard yocto/kirkstone-*)): yocto/kirkstone -.PHONY: all +.PHONY: all clean all: $(CONTAINERS) + +clean: + +$(eval $(foreach img,$(CONTAINERS),$(call CLEAN_RULE,$(img))))