From: Ian Jackson Date: Sat, 25 Jul 2020 16:56:26 +0000 (+0100) Subject: nailing-cargo: Record $org_subdir in %packagemap and %manifests X-Git-Tag: nailing-cargo/1.0.0~76 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=411496ebea94d03c5ece6b6cf31578f9d6cebb9a;p=nailing-cargo.git nailing-cargo: Record $org_subdir in %packagemap and %manifests No functional change yet. Signed-off-by: Ian Jackson --- diff --git a/nailing-cargo b/nailing-cargo index 108d259..840eba3 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -336,7 +336,7 @@ sub read_manifest ($$$) { "$self: warning: $subdir, $why: missing package.name in $try, ignoring\n"; next; } - $manifests{$manifest} = $toml if $p; + $manifests{$manifest} = [ $toml, $org_subdir ] if $p; return ($p, $ws); } return undef; @@ -415,7 +415,7 @@ sub readorigs () { "$self: warning: honouring Cargo.nail packages.$subdir=$p even though $subdir contains package $gotpackage!\n"; } die if defined $packagemap{$p}; - $packagemap{$p} = $subdir; + $packagemap{$p} = [ $subdir, $subdir ]; } foreach my $subdir (@{ $nail->{subdirs} }) { my ($gotpackage,$ws) = read_manifest($subdir, $subdir, "from [subdirs]"); @@ -425,22 +425,22 @@ sub readorigs () { unless $ws; next; } - $packagemap{$gotpackage} //= $subdir; + $packagemap{$gotpackage} //= [ $subdir, $subdir ]; } while (my ($subdir, $org_subdir, $why) = @{ shift @queued_paths or [] }) { next if $manifests{"../$subdir/Cargo.toml"}; my ($gotpackage, $ws) = read_manifest($subdir, $org_subdir, $why); next unless $gotpackage; - $packagemap{$gotpackage} //= $subdir; + $packagemap{$gotpackage} //= [ $subdir, $org_subdir ]; } } sub calculate () { foreach my $p (sort keys %packagemap) { - print STDERR "$self: package $p in $packagemap{$p}\n" if $verbose>=2; + print STDERR "$self: package $p in $packagemap{$p}[0]\n" if $verbose>=2; } foreach my $mf (keys %manifests) { - my $toml = $manifests{$mf}; + my ($toml, $mf_org_subdir) = @{ $manifests{$mf} }; foreach my $deps (get_dependency_tables $toml) { next unless $deps; foreach my $p (keys %packagemap) { @@ -448,7 +448,7 @@ sub calculate () { next unless defined $info; $deps->{$p} = $info = { } unless ref $info; delete $info->{version}; - my $newpath = $worksphere.'/'.$packagemap{$p}; + my $newpath = $worksphere.'/'.$packagemap{$p}[0]; if ($cargo_lock_update and defined $oot_dir and $newpath =~ m{^\Q$src_absdir\E(?=$|/)}) { our $oot_subdir_realpath;