From d9958618a9fef31cbd18e885ceaf8117c593418c Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Fri, 24 Jun 2022 22:59:18 +0000 Subject: [PATCH] build-release-tarball: Use OUTPUT_DIR environment variable, if set. --- tools/build-release-tarball | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/build-release-tarball b/tools/build-release-tarball index 4ff4887ddc..df177b6e7b 100755 --- a/tools/build-release-tarball +++ b/tools/build-release-tarball @@ -36,17 +36,17 @@ GITID=$(git rev-parse HEAD) umask 022 -TMPDIR=$(mktemp -d) -TARBALL=$TMPDIR/$prefix.tar +OUTPUT_DIR=${OUTPUT_DIR:-$(mktemp -d)} +TARBALL=$OUTPUT_DIR/$prefix.tar BASEDIR=$(pwd) git archive -o "$TARBALL" "--prefix=$prefix/" HEAD -cd "$TMPDIR" +cd "$OUTPUT_DIR" tar -xf "$TARBALL" while read -r i; do - rm -r --interactive=never "${TMPDIR:?}/$prefix/$i" -done <"$TMPDIR/$prefix/tools/release-tarball-exclude.txt" + rm -r --interactive=never "${OUTPUT_DIR:?}/$prefix/$i" +done <"$OUTPUT_DIR/$prefix/tools/release-tarball-exclude.txt" tar -cf "$TARBALL" "$prefix" rm -rf "$prefix" @@ -58,7 +58,7 @@ fi cd "$BASEDIR" # Check out a temporary full copy of the index to generate static files -git checkout-index -f -a --prefix "$TMPDIR/$prefix/" +git checkout-index -f -a --prefix "$OUTPUT_DIR/$prefix/" # Add the Git version information file ./tools/cache-zulip-git-version @@ -75,9 +75,9 @@ if [[ "$version" =~ ^[0-9]+\.[0-9]+$ ]]; then exit 1 fi fi -mv zulip-git-version "$TMPDIR/$prefix/" +mv zulip-git-version "$OUTPUT_DIR/$prefix/" -cd "$TMPDIR/$prefix" +cd "$OUTPUT_DIR/$prefix" ln -s "$BASEDIR/zulip-py3-venv" . @@ -110,7 +110,7 @@ find prod-static/serve/generated/emoji/images/emoji/ -regex '.*\.[0-9a-f]+\.png' echo "$GITID" >build_id echo "$version" >version -cd "$TMPDIR" +cd "$OUTPUT_DIR" tar --append -f "$TARBALL" "$prefix/prod-static" "$prefix/build_id" "$prefix/version" "$prefix/zulip-git-version" "$prefix/locale" "$prefix/staticfiles.json" "$prefix/templates/zerver/emails/compiled" "$prefix/webpack-stats-production.json" @@ -119,4 +119,6 @@ rm -rf "$prefix" gzip "$TARBALL" set +x -echo "Generated $TARBALL.gz" +TARBALL="$TARBALL.gz" + +echo "Generated $TARBALL"