[PATCH 2/4] Create a basefile tarball and cache it for two days
From: Andrew Ruthven <puck@catalyst.net.nz>
---
Makefile | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 2ccb011..9f4a6d7 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ help:
@echo " WHERE <DIST> is buster or stretch"
@echo " And <CLOUD> is azure, ec2, gce, openstack, vagrant"
-_image.raw:
+_image.raw: config_space/basefiles/$(UPPER_DIST).tar.gz
@echo $(CLOUD) | egrep -q "$(VALID_CLOUDS)" || { \
echo "$(CLOUD) is an invalid. Valid clouds are $(VALID_CLOUDS)"; exit 1; }
@echo $(DIST) | egrep -q "$(VALID_DISTS)" || { \
@@ -37,11 +37,19 @@ _image.raw:
qemu-img convert -f raw -o subformat=fixed,force_size -O vpc \
$(CLOUD)-$(DIST)-image.raw $(CLOUD)-$(DIST)-image.vhd; fi
buster-image-%:
+ find config_space/basefiles -type f -atime +1 -print0 | xargs -0 -r rm
${MAKE} _image.raw CLOUD=$* DIST=buster
stretch-image-%:
+ find config_space/basefiles -type f -atime +1 -print0 | xargs -0 -r rm
${MAKE} _image.raw CLOUD=$* DIST=stretch
+config_space/basefiles/$(UPPER_DIST).tar.gz:
+ $(eval DIR := $(shell mktemp -d))
+ sudo debootstrap $(DIST) $(DIR) http://deb.debian.org/debian
+ (cd $(DIR); sudo tar cfz $(PWD)/$@ *)
+ sudo chown $(USER) $@
+ rm -rf $(DIR)
kvm-%:
bin/launch_kvm.sh --id $*-$(shell date +%s) \
@@ -49,5 +57,5 @@ kvm-%:
--img-url $(BUILDER_IMG)
cleanall:
- rm -rf *.raw *vhd
+ rm -rf *.raw *vhd config_space/basefiles/*
--
2.15.0.rc1
Reply to: