From 0d0503b22f4c56b148f000708759d36def66cc06 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 28 Dec 2009 12:01:49 +0100
Subject: [PATCH] Improve the dist build rule

This changes the 'dist' rule to also do a check that the archive can
build all the programs and passes the check test itself, and shows the
sha1sum at the end automatically.
---
 Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 4a701120d..f50150ac6 100644
--- a/Makefile
+++ b/Makefile
@@ -62,6 +62,7 @@ Ganeti/HTools/Version.hs: Ganeti/HTools/Version.hs.in version
 	sed -e "s/%ver%/$$(cat version)/" < $< > $@
 
 dist: regen-version Ganeti/HTools/Version.hs doc
+	set -e ; \
 	VN=$$(cat version|sed 's/^v//') ; \
 	PFX="ganeti-htools-$$VN" ; \
 	ANAME="$$PFX.tar" ; \
@@ -70,7 +71,13 @@ dist: regen-version Ganeti/HTools/Version.hs doc
 	tar -r -f $$ANAME --owner root --group root \
 	    --transform="s,^,$$PFX/," version apidoc $(DOCS) ; \
 	gzip -v9 $$ANAME ; \
-	tar tzvf $$ANAME.gz
+	TMPDIR=$$(mktemp -d) ; \
+	tar xzf $$ANAME.gz -C $$TMPDIR; \
+	(cd $$TMPDIR/$$PFX; make; make clean; make check); \
+	rm -rf $$TMPDIR ; \
+	tar tzvf $$ANAME.gz ; \
+	sha1sum $$ANAME.gz ; \
+	echo "Archive $$ANAME.gz created."
 
 check: test
 	rm -f *.tix *.mix
-- 
GitLab