Implement "make dist" based on git ls-files
authorSebastian Pipping <sebastian@pipping.org>
Fri, 24 Dec 2010 21:54:22 +0000 (22:54 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Fri, 24 Dec 2010 22:08:58 +0000 (23:08 +0100)
HACKING
Makefile

diff --git a/HACKING b/HACKING
index f1facd3344a2c7337de35052aa8e1b5c877fc9cf..f9ff7c503142fed6225795940f5449a6d01b826e 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -15,6 +15,5 @@ Rolling a release:
 - Bump the version in the main genkernel file.
 - echangelog commit the bump
 - git tag -a -m "Tag release $PV" v${PV}
-- git archive --prefix genkernel-$PV/ --format tar -o /tmp/genkernel-${PV}.tar v${PV}
-- bzip2 -9v /tmp/genkernel-${PV}.tar
-- upload /tmp/genkernel-${PV}.tar.bz2 to the hosting.
+- make dist
+- upload genkernel-${PV}.tar.bz2 to the hosting.
index ec7e55cbf42abc69ec4b66059c75507ae9a8cfb4..74c5bb97a6a8d85fae8388264e4f759298720301 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,8 @@
 PACKAGE_VERSION = `/bin/fgrep GK_V= genkernel | sed "s/.*GK_V='\([^']\+\)'/\1/"`
+distdir = genkernel-$(PACKAGE_VERSION)
+
+# Add off-Git/generated files here that need to be shipped with releases
+EXTRA_DIST = genkernel.8
 
 genkernel.8: doc/genkernel.8.txt doc/asciidoc.conf Makefile
        a2x --conf-file=doc/asciidoc.conf --attribute="genkernelversion=$(PACKAGE_VERSION)" \
@@ -6,3 +10,18 @@ genkernel.8: doc/genkernel.8.txt doc/asciidoc.conf Makefile
 
 clean:
        rm -f genkernel.8
+
+check-git-repository:
+       git diff --quiet || { echo 'STOP, you have uncommitted changes in the working directory' ; false ; }
+       git diff --cached --quiet || { echo 'STOP, you have uncommitted changes in the index' ; false ; }
+
+dist: check-git-repository genkernel.8
+       rm -Rf "$(distdir)" "$(distdir)".tar "$(distdir)".tar.bz2
+       mkdir "$(distdir)"
+       git ls-files -z | xargs -0 cp --no-dereference --parents --target-directory="$(distdir)" \
+               $(EXTRA_DIST)
+       tar cf "$(distdir)".tar "$(distdir)"
+       bzip2 -9v "$(distdir)".tar
+       rm -Rf "$(distdir)"
+
+.PHONY: clean check-git-repository dist