2013-10-29 20:04:55 +01:00
|
|
|
#!/bin/sh -ex
|
|
|
|
|
2013-11-01 20:54:41 +01:00
|
|
|
GITID=$(git rev-parse HEAD)
|
|
|
|
|
2013-11-13 22:50:40 +01:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Usage: $0 <ZULIP_VERSION>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
version="$1"
|
|
|
|
prefix="zulip-server-$version"
|
|
|
|
|
2013-11-06 19:15:04 +01:00
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
2013-11-12 18:23:15 +01:00
|
|
|
TMPDIR=/tmp/enterprise-build
|
2013-11-06 19:15:04 +01:00
|
|
|
rm -Rf $TMPDIR
|
|
|
|
mkdir -p $TMPDIR
|
|
|
|
else
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
fi
|
|
|
|
|
2013-11-13 22:50:40 +01:00
|
|
|
TMP_CHECKOUT=$TMPDIR/$prefix/
|
|
|
|
TARBALL=$TMPDIR/$prefix.tar
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
# .gitattributes lists the files that are not exported
|
2013-11-13 22:50:40 +01:00
|
|
|
git archive -o $TARBALL --prefix=$prefix/ HEAD
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-13 00:46:35 +01:00
|
|
|
|
|
|
|
if tar -tf $TARBALL | grep -q -e zilencer -e zproject/local_settings.py -e puppet/zulip_internal; 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";
|
|
|
|
fi
|
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
# Check out a temporary full copy of the index to generate static files
|
|
|
|
git checkout-index -f -a --prefix $TMP_CHECKOUT
|
|
|
|
cd $TMP_CHECKOUT
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-12 20:37:23 +01:00
|
|
|
# Use default settings so there is no chance of leaking secrets
|
|
|
|
cp zproject/local_settings_template.py zproject/local_settings.py
|
|
|
|
|
|
|
|
# Some settings need values for it to work
|
|
|
|
cat >> zproject/local_settings.py <<EOF
|
|
|
|
DEBUG = False
|
|
|
|
LOCAL_DATABASE_PASSWORD = ''
|
|
|
|
SECRET_KEY = 'not_used_here'
|
|
|
|
EOF
|
|
|
|
|
2013-11-01 20:54:41 +01:00
|
|
|
# update-prod-static generates the prod-static directory.
|
|
|
|
# See COLLECTSTATIC in settings.py
|
|
|
|
./tools/update-prod-static
|
2013-11-13 22:50:40 +01:00
|
|
|
echo $GITID > build_id
|
|
|
|
echo $version > version
|
2013-11-01 20:54:41 +01:00
|
|
|
mv update-prod-static.log ..
|
|
|
|
|
2013-11-12 17:13:19 +01:00
|
|
|
cd $TMPDIR
|
|
|
|
|
2013-11-13 22:50:40 +01:00
|
|
|
tar --append -f $TARBALL $prefix/prod-static $prefix/build_id $prefix/version
|
2013-11-01 20:54:41 +01:00
|
|
|
|
2013-11-13 22:50:40 +01:00
|
|
|
rm -r $prefix
|
2013-11-12 17:13:19 +01:00
|
|
|
|
|
|
|
gzip $TARBALL
|
|
|
|
echo "Generated $TARBALL.gz"
|