From bfaf0fb3b2c3ece777bbad32f736bb7c1b6c90e8 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 11 Oct 2017 21:20:06 -0700 Subject: [PATCH] build-release-tarball: Stop using .gitattributes. Unfortunately, GitHub's web UI for generating release tarballs uses `.gitattributes` to control what files to download, and thus if you downloaded a source tarball for older Zulip versions using the GitHub web UI, you'd be missing important files. We fix this for future releases by moving the blacklist out of .gitattributes. Fixes #129. --- .gitattributes | 14 -------------- tools/build-release-tarball | 20 +++++++++++++------- tools/release-tarball-exclude.txt | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 tools/release-tarball-exclude.txt diff --git a/.gitattributes b/.gitattributes index 8417763f2a..0caaea4cc1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,17 +9,3 @@ *.png binary *.otf binary *.tif binary -.gitignore export-ignore -.gitattributes export-ignore -/static/assets export-ignore -/corporate export-ignore -/static export-ignore -/tools export-ignore -/zilencer export-ignore -/templates/corporate export-ignore -/templates/zilencer export-ignore -/puppet/zulip_internal export-ignore -/zproject/test_settings.py export-ignore -/zerver/fixtures export-ignore -/zerver/tests export-ignore -/frontend_tests export-ignore diff --git a/tools/build-release-tarball b/tools/build-release-tarball index cfd105819a..7d5542e86a 100755 --- a/tools/build-release-tarball +++ b/tools/build-release-tarball @@ -41,23 +41,29 @@ if ! git diff --exit-code >/dev/null; then exit 1 fi -TMP_CHECKOUT=$TMPDIR/$prefix/ +TMP_CHECKOUT=$TMPDIR/$prefix TARBALL=$TMPDIR/$prefix.tar +BASEDIR=$(pwd) # .gitattributes lists the files that are not exported git archive -o "$TARBALL" "--prefix=$prefix/" HEAD +cd "$TMPDIR" +tar -xf "$TARBALL" +for i in `cat "$TMP_CHECKOUT"/tools/release-tarball-exclude.txt`; do + rm -r --interactive=never "$TMP_CHECKOUT/$i"; +done +tar -cf "$TARBALL" "$prefix" +rm -rf "$prefix" if tar -tf "$TARBALL" | grep -q -e ^zerver/tests; then - echo "Excluded files remain in tarball!"; - echo "Versions of git 1.8.1.1 - 1.8.1.6 have broken .gitattributes syntax"; - exit 1; -else - echo "Check for excluded files passed"; + echo "BUG: Excluded files remain in tarball!" + exit 1 fi +cd "$BASEDIR" # Check out a temporary full copy of the index to generate static files -git checkout-index -f -a --prefix "$TMP_CHECKOUT" +git checkout-index -f -a --prefix "$TMP_CHECKOUT/" cd "$TMP_CHECKOUT" # create var/log directory in the new temporary checkout diff --git a/tools/release-tarball-exclude.txt b/tools/release-tarball-exclude.txt new file mode 100644 index 0000000000..7ea333a273 --- /dev/null +++ b/tools/release-tarball-exclude.txt @@ -0,0 +1,15 @@ +.gitignore +.gitattributes +static/assets +corporate/ +static/ +tools/ +zilencer/ +templates/corporate +templates/zilencer +puppet/zulip_ops +zproject/dev_settings.py +zproject/test_settings.py +zerver/fixtures +zerver/tests +frontend_tests