On Thu, May 28, 2015 at 09:01:20PM +0200, Johannes Schauer wrote:
> Hi,
> 
> that patch just drops the restriction formula (the part between the <>
> "brackets"). Have a look in the example I gave in this email:
> 
> http://lists.debian.org/20150528142653.2580.4450@hoothoot
> 
> to see how this leads to wrong results.
> 
> Instead, autopkgtest should parse and evaluate the build dependencies with
> their restriction formula as if no build profiles are active.
> 
> To my knowledge, the only logic to do this properly currently exists in
> dpkg-dev, apt and dose3. Since you are already using Dpkg::Deps::deps_parse()
> in ./runner/adt-run you could just re-use the same method in ./lib/testdesc.py
> 
> For a testcase you might want to try:
> 
> +    def test_builddeps_with_build_profiles(self):
> +        (ts, skipped) = self.call_parse(
> +            'Tests: t\nDepends: @, @builddeps@',
> +            'Source: nums\nBuild-Depends: bd1, bd2 <stage1> <cross>\n'
> +            '\n'
> +            'Package: one\nArchitecture: any')
> +        self.assertEqual(ts[0].depends, ['one (>= 0~)', 'bd1',
> +                                         'build-essential'])
> +        self.assertFalse(skipped)
> +
> 
> I also added autopkgtest to the list in the spec: 
> https://wiki.debian.org/BuildProfileSpec

Thanks for your insight! I have prepared a new patch, which is attached.
It is actually so simple that maybe it doesn't even warrant new
testcases? (also I couldn't figure out how to test that yet ;-))

With this patch applied I can successfully run the gem2deb test suite
with autopkgtest.

-- 
Antonio Terceiro <terce...@debian.org>
From 14e2a91d48397546d2cc303082322e49f41c57f8 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terce...@debian.org>
Date: Thu, 28 May 2015 20:10:23 -0300
Subject: [PATCH] Reduce build profiles when installing dependencies

Build-Depends: lines using build profiles cannot be transformed as-is to
Depends: lines. Luckily Dpkg::Deps already knows how to process build
profiles so we just need to tell it to do that.
---
 runner/adt-run | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/runner/adt-run b/runner/adt-run
index 71255d0..b97e6c5 100755
--- a/runner/adt-run
+++ b/runner/adt-run
@@ -971,7 +971,8 @@ fi
         perl = subprocess.Popen(['perl', '-'], stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE)
         code = '''use Dpkg::Deps;
-                  $dep = deps_parse('%s', reduce_arch => 1, host_arch => '%s');
+                  $dep = deps_parse('%s', reduce_arch => 1, host_arch => '%s',
+                                    reduce_profiles => 1);
                   print $dep->output(), "\\n";
                   ''' % (deps, self.dpkg_arch)
         deps = perl.communicate(code.encode('UTF-8'))[0].decode('UTF-8').strip()
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

Reply via email to