Richard W.M. Jones
2014-Apr-03 15:14 UTC
[Libguestfs] [PATCH] appliance: Avoid touching appliance/supermin.d directory.
This code is subtle, to say the least. When using 'supermin --build --if-newer', supermin will check if appliance/supermin.d is newer than tmp/.guestfs-UID/appliance.d, and only rebuild the full appliance if so. So we need to avoid touching appliance/supermin.d unless there's an actual change. Unfortunately simply by creating and then deleting temporary files under appliance/supermin.d we were touching appliance/supermin.d resulting in a full appliance rebuild after every 'make'. Supermin 4 actually visited every file in the supermin appliance and then every file in the full appliance and computed a checksum from them, which was slower over all but didn't suffer from this problem. Note the above only matters for developers building and running from the build directory (ie. using ./run commands). It doesn't affect libguestfs users. Rich.
Richard W.M. Jones
2014-Apr-03 15:14 UTC
[Libguestfs] [PATCH] appliance: Avoid touching appliance/supermin.d directory.
We must avoid touching appliance/supermin.d unless it is necessary, so that we avoid unnecessary rebuilds of the full appliance. Unfortunately since we created temporary files there, even if we didn't decide to keep those temporary files they would still end up touching supermin.d. To stop this, move the temporary files out. --- appliance/Makefile.am | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/appliance/Makefile.am b/appliance/Makefile.am index fac24ed..418a6f6 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -84,17 +84,20 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions rm -r tmp-d mv $@-t $@ -supermin.d/excludefiles: excludefiles.in Makefile +# Note we must avoid touching supermin.d if possible, so don't create +# the temporary files inside the supermin.d directory. + +$@supermin.d/excludefiles: excludefiles.in Makefile m4 $(PACKAGELIST_CPP_FLAGS) $< | \ - grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t - cmp -s $@ $@-t || mv $@-t $@ - rm -f $@-t + grep -v '^[[:space:]]*$$' | grep -v '^#' > excludefiles-t + cmp -s $@ excludefiles-t || mv excludefiles-t $@ + rm -f excludefiles-t supermin.d/hostfiles: hostfiles.in Makefile m4 $(PACKAGELIST_CPP_FLAGS) $< | \ - grep -v '^[[:space:]]*$$' | grep -v '^#' > $@-t - cmp -s $@ $@-t || mv $@-t $@ - rm -f $@-t + grep -v '^[[:space:]]*$$' | grep -v '^#' > hostfiles-t + cmp -s $@ hostfiles-t || mv hostfiles-t $@ + rm -f hostfiles-t supermin.d/init.tar.gz: init rm -f $@ $@-t -- 1.8.5.3