All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bertrand Marquis <bertrand.marquis@arm.com>
To: xen-devel@lists.xenproject.org
Cc: Doug Goldstein <cardoe@cardoe.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v1 4/4] automation: Add a clean rule for containers
Date: Wed, 24 Aug 2022 15:57:20 +0100	[thread overview]
Message-ID: <3942d90afde0714a7c4d28d92ed31624773cb933.1661352827.git.bertrand.marquis@arm.com> (raw)
In-Reply-To: <cover.1661352827.git.bertrand.marquis@arm.com>

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 <bertrand.marquis@arm.com>
---
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))))
-- 
2.25.1



  parent reply	other threads:[~2022-08-24 14:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 14:57 [PATCH v1 0/4] Yocto Gitlab CI Bertrand Marquis
2022-08-24 14:57 ` [PATCH v1 1/4] automation: Only filter build-*/ in gitignore Bertrand Marquis
2022-09-06 15:19   ` Jan Beulich
2022-08-24 14:57 ` [PATCH v1 2/4] automation: Add elements for Yocto test and run Bertrand Marquis
2022-08-24 14:57 ` [PATCH v1 3/4] automation: Add yocto containers with cache Bertrand Marquis
2022-08-24 14:57 ` Bertrand Marquis [this message]
2022-10-07 23:36 ` [PATCH v1 0/4] Yocto Gitlab CI Stefano Stabellini
2022-10-10 10:58   ` Bertrand Marquis
2022-10-11 12:57   ` Bertrand Marquis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3942d90afde0714a7c4d28d92ed31624773cb933.1661352827.git.bertrand.marquis@arm.com \
    --to=bertrand.marquis@arm.com \
    --cc=cardoe@cardoe.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.