From 3786ac21ed0d37906256e26f352871679b1d9bf6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 10 Oct 2020 13:19:22 +0100 Subject: [PATCH] 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 --- nailing-cargo | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; -- 2.30.2