build-system: use signed tag to make tar file, if available.
authorDavid Bremner <bremner@debian.org>
Sun, 3 Jul 2011 20:28:47 +0000 (17:28 -0300)
committerDavid Bremner <bremner@debian.org>
Sun, 17 Jul 2011 13:59:41 +0000 (10:59 -0300)
This as the advantage that "make VERSION=n.m dist" will work correctly
even if the wrong branch happens to be checked out.

Makefile.local

index 990f8204cf1b01e52a54a956195050a2fc9fd69e..7fc68163f9858af52bc5fba70c5df14184b0fa7f 100644 (file)
@@ -61,7 +61,13 @@ endif
 endif
 
 $(TAR_FILE):
-       git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ HEAD > $(TAR_FILE).tmp
+       if git tag -v $(VERSION) >/dev/null 2>&1; then \
+           ref=$(VERSION); \
+        else \
+           ref="HEAD" ; \
+          echo "Warning: No signed tag for $(VERSION)"; \
+       fi ; \
+       git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ $$ref > $(TAR_FILE).tmp
        echo $(VERSION) > version.tmp
        tar --append -f $(TAR_FILE).tmp --transform s_^_$(PACKAGE)-$(VERSION)/_  --transform 's_.tmp$$__' version.tmp
        rm version.tmp