[debhelper-devel] [debhelper] 01/01: Dh_Lib.pm: Reject compat levels before 3

Niels Thykier nthykier at moszumanska.debian.org
Mon Nov 2 20:32:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 4a459de32a1625d6aacec3c7a44b93603d649cf4
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Nov 2 21:32:34 2015 +0100

    Dh_Lib.pm: Reject compat levels before 3
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 21 +++++++++++++++++----
 debian/changelog           |  1 +
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index c2ff47b..de58576 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -8,6 +8,16 @@ package Debian::Debhelper::Dh_Lib;
 use strict;
 use warnings;
 
+use constant {
+	# Lowest compat level supported
+	'MIN_COMPAT_LEVEL' => 3,
+	# Lowest compat level that does *not* cause deprecation
+	# warnings
+	'LOWEST_NON_DEPRECATED_COMPAT_LEVEL' => 5,
+	# Highest compat level permitted
+	'MAX_COMPAT_LEVEL' => 10,
+};
+
 use Exporter qw(import);
 use vars qw(@EXPORT %dh);
 @EXPORT=qw(&init &doit &doit_noerror &complex_doit &verbose_print &error
@@ -423,14 +433,17 @@ sub dirname {
 				$c=$ENV{DH_COMPAT};
 			}
 		}
+		if ($c < MIN_COMPAT_LEVEL) {
+			error("Compatibility levels before ${\MIN_COMPAT_LEVEL} are no longer supported (level $c requested)");
+		}
 
-		if ($c <= 4 && ! $warned_compat && ! $nowarn) {
-			warning("Compatibility levels before 5 are deprecated (level $c in use)");
+		if ($c < LOWEST_NON_DEPRECATED_COMPAT_LEVEL && ! $warned_compat && ! $nowarn) {
+			warning("Compatibility levels before ${\LOWEST_NON_DEPRECATED_COMPAT_LEVEL} are deprecated (level $c in use)");
 			$warned_compat=1;
 		}
 	
-		if ($c > $max_compat) {
-			error("Sorry, but $max_compat is the highest compatibility level supported by this debhelper.");
+		if ($c > MAX_COMPAT_LEVEL) {
+			error("Sorry, but ${\MAX_COMPAT_LEVEL} is the highest compatibility level supported by this debhelper.");
 		}
 
 		return ($c <= $num);
diff --git a/debian/changelog b/debian/changelog
index eb7e145..7ddcd42 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ debhelper (9.20151005) unstable; urgency=medium
     for reporting them.
   * dh_clean: Avoid cleaning up debian/.debhelper when
     passed the "-d" flag.
+  * Dh_Lib.pm: Reject compat levels earlier than 3.
 
   [ Translations ]
   * Update German translation (Chris Leick)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list