Package list debian-goodies / 698e1e4
find-dbgsym-packages: Reduce number of grep-aptavail calls The original code called grep-aptavail for each interesting build ID. This was very slow for binaries using many shared libraries. Instead, call grep-aptavail once to get all the needed data about interesting build IDs. Closes: #912319 Jakub Wilk authored 2 years ago Axel Beckert committed 1 year, 5 months ago
1 changed file(s) with 18 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
8080 %build_ids = get_build_ids_from_file($arg);
8181 }
8282
83 my %debs_from_id = get_debs_from_ids(keys %build_ids);
8384 foreach my $id (keys %build_ids) {
8485 my ($path, $name) = @{$build_ids{$id}};
8586
8687 next if $name =~ $vdso_regexp;
8788
88 my @p = get_debs_from_id($id);
89 my @p = @{$debs_from_id{$id} // []};
8990 if (scalar @p == 0) {
9091 @p = get_debs_from_path($path);
9192 if (scalar @p == 0) {
317318 return parse_eu_unstrip($output);
318319 }
319320
320 sub get_debs_from_id
321 {
322 my ($id) = @_;
323
321 sub get_debs_from_ids
322 {
323 my $id_regexp = join('|', @_);
324 my %map;
324325 my $output;
325 $output = capturex([0, 1], qw(grep-aptavail --no-field-names --show-field Package --field Build-IDs --pattern), $id);
326
327 my %pkgs = map { $_ => 1 } split(/\n/, $output);
328 return sort keys %pkgs;
326 $output = capturex([0, 1], qw(grep-aptavail --no-field-names --show-field Package --show-field Build-IDs --field Build-IDs --eregex --pattern), $id_regexp);
327 while ($output =~ /\G(\S+)\n(\S+(?: \S+)*)\n\n/gc) {
328 my $pkg = $1;
329 my $ids = $2;
330 while ($ids =~ m/\b($id_regexp)\b/g) {
331 push @{$map{$1}}, $pkg;
332 }
333 }
334 if (length $output != (pos $output // 0)) {
335 die "Cannot parse grep-aptavail output";
336 }
337 return %map;
329338 }
330339
331340 sub get_debs_from_path