Skip to content
Commits on Source (6)
debhelper (11.1.5) UNRELEASED; urgency=medium
* Add a warning for using the new experimental feature for
requesting the compat level via the Build-Depends field.
-- Niels Thykier <niels@thykier.net> Sun, 25 Feb 2018 09:49:57 +0000
debhelper (11.1.5~alpha1) experimental; urgency=medium
* dh_installdocs: Add missing documentation about --sourcedir
in compat 11.
* dh_installdocs: Document that d/tmp is used by default
......@@ -32,8 +39,10 @@ debhelper (11.1.5) UNRELEASED; urgency=medium
that the current binutils is installed for other reasons
any way. Thanks to Helmut Grohne for the report.
(Closes: #891187)
* Dh_Lib: Add an experimental feature to determine the requested
compat level from the Build-Depends field.
-- Niels Thykier <niels@thykier.net> Sun, 04 Feb 2018 18:03:34 +0000
-- Niels Thykier <niels@thykier.net> Sat, 24 Feb 2018 16:01:31 +0000
debhelper (11.1.4) unstable; urgency=medium
......
......@@ -45,6 +45,7 @@ Breaks: dh-systemd (<< 1.38),
meson (<< 0.40.0~),
Replaces: dh-systemd (<< 1.38)
Suggests: dh-make, dwz
Provides: ${dh:CompatLevels}
Multi-Arch: foreign
Description: helper programs for debian/rules
A collection of programs that can be used in a debian/rules file to
......
#!/usr/bin/perl
use strict;
use warnings;
use Debian::Debhelper::Dh_Version;
use Debian::Debhelper::Dh_Lib ();
my @provides;
my $version = $Debian::Debhelper::Dh_Version::version;
$version =~ s/~.*//; # Drop backports marker
$version =~ s/^\d+\K\..*//;
for (my $i = Debian::Debhelper::Dh_Lib::LOWEST_NON_DEPRECATED_COMPAT_LEVEL ; $i <= $version ; $i++) {
push(@provides, "debhelper-compat (= $i)");
}
print "dh:CompatLevels=" . join(", ", @provides) . "\n";
......@@ -9,6 +9,8 @@
# We disable autoreconf to avoid build-depending on it (it does
# nothing for debhelper and it keeps the set of B-D smaller)
PERL ?= perl
%:
./run dh $@ --without autoreconf --with build-stamp
......@@ -18,3 +20,5 @@ override_dh_update_autotools_config override_dh_strip_nondeterminism:
override_dh_auto_install:
./run dh_auto_install --destdir=debian/debhelper
PERLLIBDIR=$$($(PERL) -MConfig -e 'print $$Config{vendorlib}')/Debian/Debhelper ; \
$(PERL) -I"debian/debhelper/$${PERLLIBDIR}" debian/gen-provides > debian/debhelper.substvars
......@@ -674,6 +674,7 @@ sub dirname {
# Pass in a number, will return true iff the current compatibility level
# is less than or equal to that number.
my $compat_from_bd;
{
my $warned_compat = $ENV{DH_INTERNAL_TESTSUITE_SILENT_WARNINGS} ? 1 : 0;
my $c;
......@@ -682,6 +683,8 @@ sub dirname {
my $num=shift;
my $nowarn=shift;
getpackages() if not defined($compat_from_bd);
if (! defined $c) {
$c=1;
if (-e 'debian/compat') {
......@@ -694,15 +697,23 @@ sub dirname {
}
else {
chomp $l;
$c=$l;
$c =~ s/^\s*+//;
$c =~ s/\s*+$//;
if ($c !~ m/^\d+$/) {
error("debian/compat must contain a positive number (found: \"$c\")");
}
}
}
elsif (not $nowarn) {
my $new_compat = $l;
$new_compat =~ s/^\s*+//;
$new_compat =~ s/\s*+$//;
if ($new_compat !~ m/^\d+$/) {
error("debian/compat must contain a positive number (found: \"${new_compat}\")");
}
if (defined($compat_from_bd) and $compat_from_bd != -1) {
warning("Please specific the debhelper compat level exactly once.");
warning(" * debian/compat requests compat ${new_compat}.");
warning(" * debian/control requests compat ${compat_from_bd} via \"debhelper-compat (= ${compat_from_bd})\"");
error("debhelper compat level specified both in debian/compat and via build-dependency on debhelper-compat");
}
$c = $new_compat;
}
} elsif ($compat_from_bd != -1) {
$c = $compat_from_bd;
} elsif (not $nowarn) {
error("Please specify the compatibility level in debian/compat");
}
......@@ -1386,7 +1397,8 @@ sub getpackages {
my $arch="";
my $section="";
my ($package_type, $multiarch, %seen, @profiles, $source_section,
$included_in_build_profile, $cross_type, $cross_target_arch);
$included_in_build_profile, $cross_type, $cross_target_arch,
%bd_fields, $bd_field_value);
if (exists $ENV{'DEB_BUILD_PROFILES'}) {
@profiles=split /\s+/, $ENV{'DEB_BUILD_PROFILES'};
}
......@@ -1404,15 +1416,73 @@ sub getpackages {
if (/^Source:\s*(.*)/i) {
$sourcepackage = $1;
$bd_field_value = undef;
next;
} elsif (/^Section:\s(.*)$/i) {
$source_section = $1;
$bd_field_value = undef;
next;
} elsif (/^(Build-Depends(?:-Arch|-Indep)?):\s*(.*)$/i) {
my ($field, $value) = (lc($1), $2);
$bd_field_value = [$value];
$bd_fields{$field} = $bd_field_value;
} elsif (/^\S/) {
$bd_field_value = undef;
} elsif (/^\s/ and $bd_field_value) {
push(@{$bd_field_value}, $_);
}
next if not $_ and not defined($sourcepackage);
last if (!$_ or eof); # end of stanza.
}
error("could not find Source: line in control file.") if not defined($sourcepackage);
if (%bd_fields) {
my ($dh_compat_bd, $final_level);
for my $field (sort(keys(%bd_fields))) {
my $value = join(' ', @{$bd_fields{$field}});
$value =~ s/\s*,\s*$//;
for my $dep (split(/\s*,\s*/, $value)) {
if ($dep =~ m/^debhelper-compat\s*[(]\s*=\s*(${PKGVERSION_REGEX})\s*[)]$/) {
my $version = $1;
if ($version =~m/^(\d+)\D.*$/) {
my $guessed_compat = $1;
warning("Please use the compat level as the exact version rather than the full version.");
warning(" Perhaps you meant: debhelper-compat (= ${guessed_compat})");
if ($field ne 'build-depends') {
warning(" * Also, please move the declaration to Build-Depends (it was found in ${field})");
}
error("Invalid compat level ${version}, derived from relation: ${dep}");
}
$final_level = $version;
error("Duplicate debhelper-compat build-dependency: ${dh_compat_bd} vs. ${dep}") if $dh_compat_bd;
error("The debhelper-compat build-dependency must be in the Build-Depends field (not $field)")
if $field ne 'build-depends';
$dh_compat_bd = $dep;
} elsif ($dep =~ m/^debhelper-compat\s*(?:\S.*)?$/) {
my $clevel = "${\MAX_COMPAT_LEVEL}";
eval {
require Debian::Debhelper::Dh_Version;
$clevel = $Debian::Debhelper::Dh_Version::version;
};
$clevel =~ s/^\d+\K\D.*$//;
warning("Found invalid debhelper-compat relation: ${dep}");
warning(" * Please format the relation as (example): debhelper-compat (= ${clevel})");
warning(" * Note that alternatives, architecture restrictions, build-profiles etc. are not supported.");
if ($field ne 'build-depends') {
warning(" * Also, please move the declaration to Build-Depends (it was found in ${field})");
}
warning(" * If this is not possible, then please remove the debhelper-compat relation and insert the");
warning(" compat level into the file debian/compat. (E.g. \"echo ${clevel} > debian/compat\")");
error("Could not parse desired debhelper compat level from relation: $dep");
}
}
}
if (defined($final_level)) {
warning("The use of \"debhelper-compat (= ${final_level})\" is experimental and may change (or be retired) without notice");
}
$compat_from_bd = $final_level // -1;
} else {
$compat_from_bd = -1;
}
while (<$fd>) {
chomp;
......