Fix dist-hook to enforce being at $(VERSION)
authorDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 27 Jun 2011 11:19:28 +0000 (12:19 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 27 Jun 2011 11:26:11 +0000 (12:26 +0100)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Makefile.am

index 13408e4..66d599e 100644 (file)
@@ -30,15 +30,19 @@ version.c: $(filter-out version.c, $(libopenconnect_la_SOURCES)) \
        @./version.sh
 
 dist-hook:
+       @if ! git rev-parse --verify v$(VERSION) > /dev/null; then \
+               echo "*** ERROR: Version v$(VERSION) is not tagged"; exit 1; fi
+       @if ! git diff --name-only --exit-code v$(VERSION) HEAD > /dev/null; then \
+               echo "*** ERROR: Git checkout not at version v$(VERSION)"; exit 1; fi
        @git update-index --refresh --unmerged
-       @if git diff-index --name-only HEAD | grep ^ ; then \
-               echo Uncommitted changes in above files; exit 1; fi
+       @if ! git diff-index --name-only --exit-code HEAD; then \
+               echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
 
  ifdef VERSION
 tag:
        @git update-index --refresh --unmerged
-       @if git diff-index --name-only HEAD | grep ^ ; then \
-               echo Uncommitted changes in above files; exit 1; fi
+       @if ! git diff-index --name-only --exit-code HEAD; then \
+               echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
        @sed 's/AC_INIT.*/AC_INIT(openconnect, $(VERSION))/' -i configure.ac
        @sed 's/^v=.*/v="v$(VERSION)"/' -i version.sh
        @( echo "s/Last modified: .*/Last modified: $(shell date)/" ;\