]> rtime.felk.cvut.cz Git - hercules2020/hercules-compiler.git/commitdiff
Create orig.tar.gz from git index rather than from worktree
authorMichal Sojka <sojka@ritchie.ciirc.cvut.cz>
Sun, 6 May 2018 08:19:03 +0000 (10:19 +0200)
committerMichal Sojka <sojka@ritchie.ciirc.cvut.cz>
Sun, 6 May 2018 08:19:03 +0000 (10:19 +0200)
Makefile

index 5878c5226e92b50169f502b341c7f67bff065e7f..a1706a4b9bff1bc4cb3be10620638f6b9c284028 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,14 @@ install: all
 clean:
        rm -rf build
 
+define tar_concat
+$(foreach subarch,$(shell git submodule --quiet foreach 'echo $$toplevel/../$(prefix)-$$path.tar'),tar --concatenate --file=../$(prefix).tar $(subarch)
+)
+endef
+
 create-orig-tgz: prefix=$(notdir $(CURDIR))
 create-orig-tgz:
-       git ls-files --recurse-submodules | sed "s#^#$(prefix)/#" | \
-       tar -c -C.. -z -f "../$(prefix)_$(shell dpkg-parsechangelog --show-field Version|sed -e s/-.*//).orig.tar.gz" --verbatim-files-from --files-from=-
+       git archive --format=tar --prefix=$(prefix)/ -o ../$(prefix).tar HEAD
+       git submodule foreach 'git archive --format=tar --prefix=$(prefix)/$$path/ -o $$toplevel/../$(prefix)-$$path.tar HEAD'
+       $(tar_concat)
+       gzip -c ../$(prefix).tar > "../$(prefix)_$(shell dpkg-parsechangelog --show-field Version|sed -e s/-.*//).orig.tar.gz"