From: Ian Jackson Date: Sat, 25 Jul 2020 15:53:46 +0000 (+0100) Subject: nailing-cargo: Work around cargo annoyance with workspaces X-Git-Tag: nailing-cargo/1.0.0~80 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8dbd084a86a3dff840a215211cf8304ee61a927a;p=nailing-cargo.git nailing-cargo: Work around cargo annoyance with workspaces When the invocation $subdir is a workspace, with -u, cargo complains that the packages in the linkfarm are different to the ones in the source area. Fix this by, in this case, adjusting those path references to point into the linkfarm. cargo seems to use realpath on one of these paths, so we must do so too, or cargo complains that two things are different which are literally two different paths to the very same symlink. With this change I am able to build lexpr-rs, both in its own right, and as a dependency. Closes #1. Signed-off-by: Ian Jackson --- diff --git a/nailing-cargo b/nailing-cargo index 354f1e7..f015b89 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -8,6 +8,7 @@ use strict; use POSIX; use Types::Serialiser; use File::Glob qw(bsd_glob GLOB_ERR GLOB_BRACE GLOB_NOMAGIC); +use Cwd qw(realpath); our %archmap = ( RPI => 'arm-unknown-linux-gnueabihf', @@ -430,7 +431,15 @@ sub calculate () { next unless defined $info; $deps->{$p} = $info = { } unless ref $info; delete $info->{version}; - $info->{path} = $worksphere.'/'.$packagemap{$p}; + my $newpath = $worksphere.'/'.$packagemap{$p}; + if ($cargo_lock_update and defined $oot_dir and + $newpath =~ m{^\Q$src_absdir\E(?=$|/)}) { + our $oot_subdir_realpath; + $oot_subdir_realpath //= Cwd::realpath "$oot_absdir/$subdir" + // die "$self: cannot resolve $oot_absdir/$subdir: $!"; + $newpath = $oot_subdir_realpath.$'; + } + $info->{path} = $newpath; } } my $nailing = "$mf.nailing~";