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 <ijackson@chiark.greenend.org.uk>
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',
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~";