Skip to content

Commit

Permalink
archive_dependencies.sh: Handle no dependencies (#463)
Browse files Browse the repository at this point in the history
If there are no dependencies utilised that we need to archive source for,
this breaks the build process since no dependencies-src.zip file is
created, and the Dockerfile has nothing to copy.

This changes the script such that it starts with an empty zip file, and
then appends dependencies if and when they exist.

Unblocks #457
  • Loading branch information
markmandel authored Jan 11, 2022
1 parent eadec2d commit ad54604
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions image/archive_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
# This should be reviewed before each release to make sure we're capturing all
# the dependencies we need.

rm dependencies-src.zip || true

dependencies=("slog-json")

zip="$(pwd)/dependencies-src.zip"

rm "$zip" || true

echo "Archiving dependencies to: $zip"

# create an empty zip, so we always have a file, even if we don't have dependencies
echo UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA== | base64 -d > "$zip"

pushd "$CARGO_HOME/registry/src"
for d in "${dependencies[@]}"; do
find . -type d -name "$d-*" | xargs -I {} zip -rv "$zip" "{}"
find . -type d -name "$d-*" | xargs -I {} zip -ruv "$zip" "{}"
done
popd

0 comments on commit ad54604

Please sign in to comment.