summaryrefslogtreecommitdiff
path: root/lib/Debian/Debhelper
diff options
context:
space:
mode:
authorPeter Pentchev <roam@ringlet.net>2018-05-04 23:59:04 +0300
committerNiels Thykier <niels@thykier.net>2018-05-10 06:10:40 +0000
commit0e103163a8deac65724e543250234c6e82d99906 (patch)
tree3d1e8d25fbabf3b996429b9a8cf07f2e594a1d60 /lib/Debian/Debhelper
parent133155e19c391d6dace72a698d8abea21da5b4ac (diff)
downloaddebhelper-0e103163a8deac65724e543250234c6e82d99906.tar.gz
Lay the groundwork for testing debhelper-compat.
Simulate gen-provides's enumeration of the supported compat levels in the Test::DH module's non_deprecated_compat_levels() function. Add the resetcompat() and resetpackages() testing aids to Dh_Lib. Silence the "debhelper-compat is experimental" warning during testing. Add the debhelper-compat/syntax.t test. Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 'lib/Debian/Debhelper')
-rw-r--r--lib/Debian/Debhelper/Dh_Lib.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index 9c829f0f..7ba987d3 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -691,6 +691,12 @@ my $compat_from_bd;
my $warned_compat = $ENV{DH_INTERNAL_TESTSUITE_SILENT_WARNINGS} ? 1 : 0;
my $c;
+ # Used mainly for testing
+ sub resetcompat {
+ undef $c;
+ undef $compat_from_bd;
+ }
+
sub compat {
my $num=shift;
my $nowarn=shift;
@@ -1388,6 +1394,13 @@ sub is_cross_compiling {
my (%package_types, %package_arches, %package_multiarches, %packages_by_type,
%package_sections, $sourcepackage, %package_cross_type);
+# Resets the arrays; used mostly for testing
+sub resetpackages {
+ undef $sourcepackage;
+ %package_types = %package_arches = %package_multiarches =
+ %packages_by_type = %package_sections = %package_cross_type = ();
+}
+
# Returns source package name
sub sourcepackage {
getpackages() if not defined($sourcepackage);
@@ -1489,7 +1502,7 @@ sub getpackages {
}
}
}
- if (defined($final_level)) {
+ if (defined($final_level) && !$ENV{DH_INTERNAL_TESTSUITE_SILENT_WARNINGS}) {
warning("The use of \"debhelper-compat (= ${final_level})\" is experimental and may change (or be retired) without notice");
}
$compat_from_bd = $final_level // -1;