Skip to content

Commit

Permalink
build-release-tarball: Stop using .gitattributes.
Browse files Browse the repository at this point in the history
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 zulip#129.
  • Loading branch information
timabbott committed Oct 12, 2017
1 parent e749deb commit bfaf0fb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
14 changes: 0 additions & 14 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 13 additions & 7 deletions tools/build-release-tarball
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions tools/release-tarball-exclude.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bfaf0fb

Please sign in to comment.