Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition in package-bazel.sh #16614

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/package-bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ROOT="$(mktemp -d ${TMP_DIR%%/}/bazel.XXXXXXXX)"
RECOMP="$ROOT/recomp"
PACKAGE_DIR="$ROOT/pkg"
DEPLOY_UNCOMP="$ROOT/deploy-uncompressed.jar"
FILE_LIST="$ROOT/file.list"
mkdir -p "${PACKAGE_DIR}"
trap "rm -fr ${ROOT}" EXIT

Expand Down Expand Up @@ -101,14 +102,14 @@ fi
find . -type f | sort
# And install_base_key must be last.
echo install_base_key
) > files.list
) > $FILE_LIST

# Move these after the 'find' above.
cp $DEPLOY_JAR $PACKAGE_DIR/A-server.jar
cp $INSTALL_BASE_KEY $PACKAGE_DIR/install_base_key

# Zero timestamps.
(cd $PACKAGE_DIR; xargs touch -t 198001010000.00) < files.list
(cd $PACKAGE_DIR; xargs touch -t 198001010000.00) < $FILE_LIST

if [[ "$DEV_BUILD" -eq 1 ]]; then
# Create output zip with lowest compression, but fast.
Expand All @@ -117,6 +118,6 @@ else
# Create output zip with highest compression, but slow.
ZIP_ARGS="-q9DX@"
fi
(cd $PACKAGE_DIR; zip $ZIP_ARGS $WORKDIR/$OUT) < files.list
(cd $PACKAGE_DIR; zip $ZIP_ARGS $WORKDIR/$OUT) < $FILE_LIST