diff options
author | Jonathan Bauer | 2018-02-21 17:04:04 +0100 |
---|---|---|
committer | Jonathan Bauer | 2018-02-22 11:32:19 +0100 |
commit | 2f9339b2af81994e4a4cdf5869dcbc9dee4b436f (patch) | |
tree | 2c4520f27f3ce42c0d34c41ff9fdc171cd62e67f /Makefile | |
parent | [ubuntu-17.10] add symlink to generic ubuntu preseed (diff) | |
download | packer-templates-2f9339b2af81994e4a4cdf5869dcbc9dee4b436f.tar.gz packer-templates-2f9339b2af81994e4a4cdf5869dcbc9dee4b436f.tar.xz packer-templates-2f9339b2af81994e4a4cdf5869dcbc9dee4b436f.zip |
Makefile: new target clean_failed candidate
uses the fact that packer deletes the output directory if the build
fails, hence it is enough to check for the presence of
<flavor>.<timestamp>/build to detect whether a build was successful or
not.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -99,7 +99,7 @@ ifdef VERBOSE endif -.PHONY: help clean_except_last clean_bases clean_all +.PHONY: help clean_except_last clean_bases clean_all clean_failed help: @@ -170,6 +170,18 @@ clean_except_last: | xargs -r -0 -n1 rm -rf; ) +clean_failed: + @-$(foreach template,$(TEMPLATES),\ + test -d $(template) && \ + find $(template)/* \ + -maxdepth 0 \ + -type d \ + -not -name base \ + -print0 \ + | xargs -r -0 -n1 -i \ + $(SHELL) -c 'test -d "{}/build" || rm -rf "{}"') + + clean_bases: @-$(foreach template,$(TEMPLATES),\ test -d $(template) && rm -rf $(template)/base;) |