From: Ian Jackson Date: Sat, 10 Oct 2020 12:19:22 +0000 (+0100) Subject: For revert: never symlink Cargo.toml X-Git-Tag: nailing-cargo/1.0.0~48 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=3786ac21ed0d37906256e26f352871679b1d9bf6;p=nailing-cargo.git For revert: never symlink Cargo.toml The statement in the comment was not true. The wrong CARGO_MANIFEST_DIR was coming from our setenvs() function. Signed-off-by: Ian Jackson --- diff --git a/nailing-cargo b/nailing-cargo index 1489f7f..e1118fe 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -624,7 +624,7 @@ END_BOTH if ($linkfarm_depth eq 'shallow') { $pre.= <<'END_SHALLOW'; clean () { find -lname "$src/*" -print0 | xargs -0r rm --; }; clean; - find "$src" -maxdepth 1 \! -name Cargo.lock -print0 | + find "$src" -maxdepth 1 \! -name Cargo.lock Cargo.toml -print0 | xargs -0r sh -ec 'for f in "$@"; do rm -rf "${f##*/}"; ln -sf -- "$f" .; @@ -657,11 +657,15 @@ END_FILES_FULL ' "$src"; END_DEEP } + # If Cargo.toml is a symlink, cargo dereferences it to + # find a wrong CARGO_MANIFEST_DIR. $pre .= <<'ENDLK' if $do_cargo_lock; - if test -e Cargo.lock; then - rm -f Cargo.lock; - cp -- "$src"/Cargo.lock .; - fi; + for f in Cargo.toml Cargo.lock; do + if test -e $f; then + rm -f $f; + cp -- "$src"/$f .; + fi; + done; ENDLK $post = <<'ENDCLEAN' if $oot_clean && !$just_linkfarm; clean;