Package: autopkgtest
Version: 3.14.2
Severity: normal
Tags: patch

gem2deb seems to the first package to use build profiles in the official
Debian  archive, and it started to cause fallout in several places.
autopkgtest is also affected.

The fake package created to encode the test dependencies gets the
Build-Dependencies of the source package, and when it contains build
profiles, dpkg-deb chokes on it. Arguably dpkg-deb could ignore build
profiles, but since build profiles were proposed explicitly as an
extension for the Build-Depends: field, I'd say it makes sense to fix
this in autopkgtest.

The attached patch fixes this by filtering out build profile
specifications from dependencies.

-- System Information:
Debian Release: stretch/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable'), (500, 'testing'), 
(1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages autopkgtest depends on:
ii  apt-utils       1.0.9.9
ii  libdpkg-perl    1.18.0
ii  procps          2:3.3.9-9
ii  python3         3.4.2-2
ii  python3-debian  0.1.27

Versions of packages autopkgtest recommends:
ii  autodep8  0.1

Versions of packages autopkgtest suggests:
ii  lxc          1:1.0.7-3terceiro1
ii  qemu-system  1:2.3+dfsg-3
ii  qemu-utils   1:2.3+dfsg-3
ii  schroot      1.6.10-1.1

-- no debconf information

-- 
Antonio Terceiro <terce...@debian.org>
From deed4e980f52e8a1cb259cd3faf2f3206a0c7513 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terce...@debian.org>
Date: Thu, 28 May 2015 10:03:09 -0300
Subject: [PATCH] @builddeps@: filter out build profiles syntax

---
 lib/testdesc.py | 10 ++++++++--
 tests/testdesc  | 11 +++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/lib/testdesc.py b/lib/testdesc.py
index 12e4267..2e81c59 100644
--- a/lib/testdesc.py
+++ b/lib/testdesc.py
@@ -230,15 +230,21 @@ def _debian_packages_from_source(srcdir):
 
 def _debian_build_deps_from_source(srcdir):
     deps = []
+    def normalize_build_dependency(dep):
+        """
+        Removes build profiles syntax, plus any leading/trailing whitespace
+        """
+        return re.sub('<[^<>]*>', '', dep).strip()
+
     for st in parse_rfc822(os.path.join(srcdir, 'debian/control')):
         if 'Build-depends' in st:
             for d in st['Build-depends'].split(','):
-                dp = d.strip()
+                dp = normalize_build_dependency(d)
                 if dp:
                     deps.append(dp)
         if 'Build-depends-indep' in st:
             for d in st['Build-depends-indep'].split(','):
-                dp = d.strip()
+                dp = normalize_build_dependency(d)
                 if dp:
                     deps.append(dp)
     # @builddeps@ should always imply build-essential
diff --git a/tests/testdesc b/tests/testdesc
index cf059a0..9665d47 100755
--- a/tests/testdesc
+++ b/tests/testdesc
@@ -326,6 +326,17 @@ class Debian(unittest.TestCase):
                                          'bdi1', 'build-essential', 'foo (>= 7)'])
         self.assertFalse(skipped)
 
+    def test_builddeps_with_build_profiles(self):
+        (ts, skipped) = self.call_parse(
+            'Tests: t\nDepends: @, @builddeps@',
+            'Source: nums\nBuild-Depends: bd1, bd2 <!nocheck>\n'
+            '\n'
+            'Package: one\nArchitecture: any')
+        self.assertEqual(ts[0].depends, ['one (>= 0~)', 'bd1', 'bd2',
+                                         'build-essential'])
+        self.assertFalse(skipped)
+
+
     def test_complex_deps(self):
         '''complex test dependencies'''
 
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

Reply via email to