Skip to content
Snippets Groups Projects
Commit 9f91e053 authored by Ryan Gonzalez's avatar Ryan Gonzalez
Browse files

dh_setup_copyright: Strip trailing '/@/...' from Rust CUs

https://github.com/rust-lang/rust/pull/92024 appends a build-specific
suffix to each compilation unit name in order to ensure they're all
unique. Thus, in order to get the original filenames, we need to strip
that suffix off.

In order to ensure the SBOM contains the right paths, we also write the
modified sources back to the bin2sources file.

infrastructure/apertis-issues#456



Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
parent 207bb465
No related branches found
No related tags found
3 merge requests!31Merge changes from apertis/v2024-updates into apertis/v2024,!28Backport v2024 <- v2025dev2: dh_setup_copyright: Strip trailing '/@/...' from Rust CUs,!27dh_setup_copyright: Strip trailing '/@/...' from Rust CUs (and some perf fixes)
......@@ -198,9 +198,15 @@ sub process_external_sources {
my $added_referenced_srcpackages = 0;
my $sources = decode_json $sources_data;
my $sources_changed = 0;
while (my ($file, $info) = each %$sources) {
foreach my $unit (@{$info->{'units'}}) {
if (($unit->{'comp_name'} =~ s|/@/.*||) && !$sources_changed) {
print "Stripping trailing '/@/...' from Rust compilation units\n";
$sources_changed = 1;
}
my $comp_dir = $unit->{'comp_dir'};
my $comp_name = $unit->{'comp_name'};
......@@ -229,6 +235,13 @@ sub process_external_sources {
}
}
if ($sources_changed) {
print "Saving edited dwarf2sources output\n";
open my $sources_handle, '>', $fname_list or die "Failed to open $fname_list: $!";
print $sources_handle encode_json($sources);
close $sources_handle;
}
if (%$external_sources_to_packages) {
my $count = scalar %$external_sources_to_packages;
print "Adding metadata for $count external source file(s)\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment