aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rwxr-xr-xsupport/download/git17
1 files changed, 14 insertions, 3 deletions
diff --git a/support/download/git b/support/download/git
index 2d9892341f..d8094d2601 100755
--- a/support/download/git
+++ b/support/download/git
@@ -65,9 +65,20 @@ if ! _git fetch origin "'${cset}:${cset}'" >/dev/null 2>&1; then
printf "Could not fetch special ref '%s'; assuming it is not special.\n" "${cset}"
fi
-_git archive --prefix="'${basename}/'" -o "'${output}.tmp'" --format=tar "'${cset}'"
+# Checkout the required changeset.
+_git checkout -q "'${cset}'"
+
+# Get date of commit to generate a reproducible archive.
+# %cD is RFC2822, so it's fully qualified, with TZ and all.
+date="$( _git show --no-patch --pretty=format:%cD )"
+
+# We do not need the .git dir and other gitfiles to generate the tarball
+find . \( -name .git -o -name .gitmodules -o -name .gitignore \) \
+ -exec rm -rf {} +
-# Not really required, but here for consistency
popd >/dev/null
-gzip -n <"${output}.tmp" >"${output}"
+# Generate the archive, sort with the C locale so that it is reproducible
+tar cf - --numeric-owner --owner=0 --group=0 --mtime="${date}" \
+ -T <(find "${basename}" -not -type d |LC_ALL=C sort) \
+|gzip -n >"${output}"