Skip to content

Commit

Permalink
build: support relative cargo-vendor-dir path with non-existing
Browse files Browse the repository at this point in the history
Supports using CARGO_VENDOR_DIR=/tmp/bob/.. in case bob doesn't exist.
Probably won't ever happen but just in case :)

Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Apr 18, 2024
1 parent ddba1ec commit a06f37c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,18 @@ pre_fetch_cargo_deps() {

local outLink="--no-out-link"
local cargoVendorMsg=""
local cargoVendorDir=""
if [ -n "$CARGO_VENDOR_DIR" ]; then
if [ "$(realpath -s "$CARGO_VENDOR_DIR")" = "$(realpath -s "$SCRIPTDIR/..")" ]; then
if [ "$(realpath -ms "$CARGO_VENDOR_DIR")" = "$(realpath -ms "$SCRIPTDIR/..")" ]; then
cargoVendorDir="$CARGO_VENDOR_DIR/$GIT_BRANCH"
else
cargoVendorDir="$CARGO_VENDOR_DIR/$project/$GIT_BRANCH"
fi

cargoVendorMsg="into $(realpath -ms "$cargoVendorDir") "
outLink="--out-link "$cargoVendorDir""
fi

for (( attempt=1; attempt<=maxAttempt; attempt++ )); do
if $NIX_BUILD $outLink -A "$nixAttrPath"; then
[ -n "$cargoVendorDir" ] && cargoVendorMsg="into $(realpath -s "$cargoVendorDir") "
echo "Cargo vendored dependencies pre-fetched "$cargoVendorMsg"after $attempt attempt(s)"
return 0
fi
Expand Down

0 comments on commit a06f37c

Please sign in to comment.