Skip to contentSkip to conversation

docker: Clean dangling tarball files

PATCH Applied Philippe Mathieu-Daudé 2 participants 2 messages Aug 18, 2018 – Aug 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docker: Clean dangling tarball files

When a container fails, it leaves a dangling tarball which name is based on a timestamp. Further uses of make won't clean those files, neither calling the 'docker-clean' target.

Use the .DELETE_ON_ERROR built-in target to let make remove those temporary tarballs in case of failure.

---
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)
tests/docker/Makefile.include +1 -0
index d3101afecd..6e03235ab9 100644
@@ -25,6 +25,7 @@ IMAGES ?= %
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
 DOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME)
 
+.DELETE_ON_ERROR: $(DOCKER_SRC_COPY)
 $(DOCKER_SRC_COPY):
 	@mkdir $@
 	$(if $(SRC_ARCHIVE), \
Signature · 1 line
2.18.0
Applied
#1 lore raw
Quoted 27 lines · Philippe Mathieu-Daudé

When a container fails, it leaves a dangling tarball which name is based on a timestamp. Further uses of make won't clean those files, neither calling the 'docker-clean' target.

Use the .DELETE_ON_ERROR built-in target to let make remove those temporary tarballs in case of failure.

---
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)
tests/docker/Makefile.include +1 -0
index d3101afecd..6e03235ab9 100644
@@ -25,6 +25,7 @@ IMAGES ?= %
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
 DOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME)
 
+.DELETE_ON_ERROR: $(DOCKER_SRC_COPY)
 $(DOCKER_SRC_COPY):
 	@mkdir $@
 	$(if $(SRC_ARCHIVE), \
Signature · 1 line
2.18.0

Queued, thanks.

Fam