]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
scripts: pack all submodules with make-archive.sh
authorPetr Špaček <petr.spacek@nic.cz>
Tue, 28 Nov 2017 10:27:43 +0000 (11:27 +0100)
committerPetr Špaček <petr.spacek@nic.cz>
Tue, 28 Nov 2017 11:27:41 +0000 (12:27 +0100)
It does not make sense to create "distribution" tarball with dirty
working tree or missing submodules, so this is now forbidden.
make-archive.sh requires clean working tree and all submodules.

Packing all submodules prevents us from releasing incomplete tarball,
especially around release time.

Distributions like Fedora are gradually getting ability to run
integration test suites so it does not hurt to pack everything including
test.

scripts/make-archive.sh

index 4a66f17f9953e3c13156d3648bc24b656582e0a1..1f8b41eadaea8ff2fb10c758484c0832565ccea3 100755 (executable)
@@ -1,13 +1,15 @@
 #!/bin/sh -e
 # Create a distribution tarball, like 'make dist' from autotools.
+cd "$(git rev-parse --show-toplevel)"
 ver="$(git describe | sed 's/^v//')"
-# 'git ls-files --recurse-submodules' fails, unfortunately
-files="$(
-       git ls-files
-       cd modules/policy/lua-aho-corasick/
-       git ls-files | sed 's|^|modules/policy/lua-aho-corasick/|'
-       )"
+test 0 -ne $(git status --porcelain | wc -l) && \
+       echo "Git working tree is dirty, make it clean first" && \
+       exit 1
+git submodule status --recursive | grep -q '^[^ ]' && \
+       echo "Git submodules are dirty, run: git submodule update --recursive --init" && \
+       exit 2
+
+# 'git ls-files --recurse-submodules' works only if modules are initialized
 name="knot-resolver-$ver"
-tar caf "$name.tar.xz" --no-recursion --transform "s|^|$name/|" -- $files
+tar caf "$name.tar.xz" --no-recursion --transform "s|^|$name/|" -- $(git ls-files --recurse-submodules)
 echo "$name.tar.xz"
-