From 71ba52f458d5d173091b32d038751e144e385b5e Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 10 May 2020 12:16:46 +0000 Subject: Dh_Lib: Add package_type function Signed-off-by: Niels Thykier --- lib/Debian/Debhelper/Dh_Lib.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm index 3e56d51f..10907f12 100644 --- a/lib/Debian/Debhelper/Dh_Lib.pm +++ b/lib/Debian/Debhelper/Dh_Lib.pm @@ -124,6 +124,7 @@ qw( package_multiarch package_section package_arch + package_type process_pkg compute_doc_main_package isnative @@ -2163,17 +2164,24 @@ sub package_cross_type { return $package_cross_type{$package} // 'host'; } +sub package_type { + my ($package) = @_; + + if (! exists $package_types{$package}) { + warning "package $package is not in control info"; + return DEFAULT_PACKAGE_TYPE; + } + return $package_types{$package}; +} + # Return true if a given package is really a udeb. sub is_udeb { my $package=shift; - if (! exists $package_types{$package}) { - warning "package $package is not in control info"; - return 0; - } - return $package_types{$package} eq 'udeb'; + return package_type($package) eq 'udeb'; } + sub process_pkg { my ($package) = @_; state %packages_to_process = map { $_ => 1 } @{$dh{DOPACKAGES}}; -- cgit v1.2.3