From 8dbd084a86a3dff840a215211cf8304ee61a927a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Jul 2020 16:53:46 +0100 Subject: [PATCH] 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 --- nailing-cargo | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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~"; -- 2.30.2