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

dh_setup_copyright: Improve perf of handling non-existent source files


find_package_providing_path would try to look up the source package for
every incoming file, even if the file doesn't actually exist on disk.
This is largely useless, because dpkg-query only finds matches for
*installed* packages anyway, so just skip calling it at all for
non-existent files.

Signed-off-by: default avatarRyan Gonzalez <ryan.gonzalez@collabora.com>
parent 9f91e053
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)
......@@ -94,7 +94,11 @@ sub find_package_providing_path {
return $package eq PATH_HAS_NO_PACKAGE ? undef : $package;
}
($package) = `dpkg-query -S "$path" 2>/dev/null` =~ /^([^\s:]+):(?:[^\s:]+:)? /;
# Skip non-existent files, since dpkg-query only works on installed packages
# anyway.
if (-e $path) {
($package) = `dpkg-query -S "$path" 2>/dev/null` =~ /^([^\s:]+):(?:[^\s:]+:)? /;
}
if (!defined $package) {
$external_files_to_packages_cache{$path} = PATH_HAS_NO_PACKAGE;
return undef;
......
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