summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-10-10 17:25:18 -0400
committerJoey Hess <joey@kitenet.net>2014-10-10 17:25:18 -0400
commit4d0acf739e336a6b0993665facf6308e851cea44 (patch)
tree0fb9500bbef96cf167331b6fb9ee803e2ed85333
parent4cc14d07d90780d8ccbdd291b74194355d5dc4cd (diff)
parent4402e553df5279c2f65aee8623aca504988cc508 (diff)
Merge commit '4402e553df5279c2f65aee8623aca504988cc508'
-rw-r--r--Debian/Debhelper/Dh_Lib.pm60
-rw-r--r--debian/changelog13
-rw-r--r--debian/control2
3 files changed, 35 insertions, 40 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 6a79c9ce..8627906b 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -764,44 +764,6 @@ sub buildos {
}
}
-# Passed a list of profiles to match against, returns true if
-# DEB_BUILD_PROFILES environment variable matched
-sub buildprofilesmatch {
- my %debbuildprofiles = ();
- if (exists $ENV{'DEB_BUILD_PROFILES'}) {
- foreach my $profile (split(/\s+/, $ENV{'DEB_BUILD_PROFILES'})) {
- $debbuildprofiles{$profile} = 1;
- }
- }
-
- my $packageprofilesstr = shift;
- my $package = shift;
- my @packageprofiles = split(/\s+/, $packageprofilesstr);
- my $err = sub { error("Build-Profiles field for package $package contains both positive and negative entries"); };
- if ($#packageprofiles < 0 || $packageprofiles[0] =~ /^!/) {
- # package profiles list is negative or empty
- foreach my $packageprofile (@packageprofiles) {
- $packageprofile =~ /^!(.*)$/ || &{$err}();
- if ($debbuildprofiles{$1}) {
- return 0;
- }
- }
- return 1;
- }
- else {
- # package profiles list is positive
- foreach my $packageprofile (@packageprofiles) {
- if ($packageprofile =~ /^!/) {
- &{$err}();
- }
- if ($debbuildprofiles{$packageprofile}) {
- return 1;
- }
- }
- return 0;
- }
-}
-
# Returns source package name
sub sourcepackage {
open (CONTROL, 'debian/control') ||
@@ -842,6 +804,12 @@ sub getpackages {
my $build_profiles;
my @list=();
my %seen;
+ my @profiles=();
+ my @restrictions=();
+ my $profile_is_concerned;
+ if ($ENV{'DEB_BUILD_PROFILES'}) {
+ @profiles=split /\s+/, $ENV{'DEB_BUILD_PROFILES'};
+ }
open (CONTROL, 'debian/control') ||
error("cannot read debian/control: $!\n");
while (<CONTROL>) {
@@ -858,6 +826,7 @@ sub getpackages {
}
$package_type="deb";
$build_profiles="";
+ $profile_is_concerned=1;
}
if (/^Architecture:\s*(.*)/) {
$arch=$1;
@@ -865,8 +834,21 @@ sub getpackages {
if (/^(?:X[BC]*-)?Package-Type:\s*(.*)/) {
$package_type=$1;
}
+ # rely on libdpkg-perl providing the parsing functions because
+ # if we work on a package with a Build-Profiles field, then a
+ # high enough version of dpkg-dev is needed anyways
if (/^Build-Profiles:\s*(.*)/) {
$build_profiles=$1;
+ eval {
+ require Dpkg::BuildProfiles;
+ @restrictions=Dpkg::BuildProfiles::parse_build_profiles($build_profiles);
+ if (@restrictions) {
+ $profile_is_concerned=Dpkg::BuildProfiles::evaluate_restriction_formula(\@restrictions, \@profiles);
+ }
+ };
+ if ($@) {
+ error("The package $package has a Build-Profiles field. Require libdpkg-perl >= 1.17.14");
+ }
}
if (!$_ or eof) { # end of stanza.
@@ -882,7 +864,7 @@ sub getpackages {
($arch ne 'all' &&
samearch(buildarch(), $arch)))) ||
! $type) &&
- buildprofilesmatch($build_profiles, $package)) {
+ $profile_is_concerned) {
push @list, $package;
$package="";
$arch="";
diff --git a/debian/changelog b/debian/changelog
index a856ece6..f15f511e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,19 @@ debhelper (9.20141003) unstable; urgency=medium
-- Joey Hess <joeyh@debian.org> Fri, 03 Oct 2014 15:16:00 -0400
+debhelper (9.20140817+nmu1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Depend on libdpkg-perl (>= 1.17.14) for build profiles support. Note to
+ backporters: If you remove that dependency, debhelper will throw an error
+ when a binary package stanza in debian/control has the Build-Profiles
+ field.
+ * Use libdpkg-perl functionality to parse the content of the Build-Profiles
+ field, if there is one. In that case, use libdpkg-perl to evaluate whether
+ the binary package should be built or not.
+
+ -- Johannes Schauer <j.schauer@email.de> Thu, 09 Oct 2014 23:27:40 +0200
+
debhelper (9.20140817) unstable; urgency=medium
* Added Portuguese translation of the man pages, by Américo Monteiro.
diff --git a/debian/control b/debian/control
index 0786173f..d54b9715 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Homepage: http://joeyh.name/code/debhelper/
Package: debhelper
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23), dpkg (>= 1.16.2), dpkg-dev (>= 1.17.0), binutils, po-debconf, man-db (>= 2.5.1-1)
+Depends: ${perl:Depends}, ${misc:Depends}, file (>= 3.23), dpkg (>= 1.16.2), dpkg-dev (>= 1.17.0), binutils, po-debconf, man-db (>= 2.5.1-1), libdpkg-perl (>= 1.17.14)
Suggests: dh-make
Conflicts: dpkg-cross (<< 1.18), python-support (<< 0.5.3), python-central (<< 0.5.6), automake (<< 1.11.2)
Multi-Arch: foreign