Hi!

On Wed, 2023-10-25 at 20:44:26 -0400, James McCoy wrote:
> On Thu, Oct 05, 2023 at 07:11:32AM +0200, Guillem Jover wrote:
> > Right, nice catch! Given that these fields are based on what might
> > appear on build dependencies, I think it does make sense to consider
> > them an overlay on top of those. So I'll make them allow anything that
> > is allowed for build dependencies.
> 
> Would that just be the below patch?

Sorry, I started on this, but I think I might have misplaced the small
change I had, in any case thanks for the patch! Although…

> diff --git i/scripts/Dpkg/Deps/Simple.pm w/scripts/Dpkg/Deps/Simple.pm
> index 431c93bb9..da7aedbd8 100644
> --- i/scripts/Dpkg/Deps/Simple.pm
> +++ w/scripts/Dpkg/Deps/Simple.pm
> @@ -194,7 +194,6 @@ sub parse_string {
>                \s*$                          # trailing spaces at end
>              }x;
>      if (defined $2) {
> -        return if $2 eq 'native' and not $self->{build_dep};
>          $self->{archqual} = $2;
>      }
>      $self->{package} = $1;

…this would remove the check for run-time dependencies. What I had in
mind was something like the attached patch, which I'll queue once I've
updated the test suite to cope or to add unit tests.

Thanks,
Guillem
From ecb3332d498b247e7ff2487e89dd9819d79adba2 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Thu, 26 Oct 2023 13:06:32 +0200
Subject: [PATCH] Dpkg::Deps: Implicitly enable build_deps option on tests_deps

The test dependencies are based on the build dependency syntax, so we
should accept everything they accept in addition to any test specific
syntax that is allowed.

Closes: #1053481
---
 scripts/Dpkg/Deps.pm        | 6 ++++++
 scripts/Dpkg/Deps/Simple.pm | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index 87855cdc5..959318452 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -252,6 +252,9 @@ If set to 1, allow tests-specific package names in dependencies, that is
 "@" and "@builddeps@" (since dpkg 1.18.7). This should be set whenever
 working with dependency fields from F<debian/tests/control>.
 
+This option implicitly (and forcibly) enables C<build_dep> because test
+dependencies are based on build dependencies (since dpkg 1.22.1).
+
 =back
 
 =cut
@@ -286,6 +289,9 @@ sub deps_parse {
     if ($options{reduce_profiles}) {
         $options{build_profiles} //= [ get_build_profiles() ];
     }
+    if ($options{tests_dep}) {
+        $options{build_dep} = 1;
+    }
 
     # Options for Dpkg::Deps::Simple.
     my %deps_options = (
diff --git a/scripts/Dpkg/Deps/Simple.pm b/scripts/Dpkg/Deps/Simple.pm
index 431c93bb9..a2ab2b125 100644
--- a/scripts/Dpkg/Deps/Simple.pm
+++ b/scripts/Dpkg/Deps/Simple.pm
@@ -111,6 +111,9 @@ Defaults to 0.
 Specifies whether the parser should consider it a tests dependency.
 Defaults to 0.
 
+This option implicitly (and forcibly) enables C<build_dep> because test
+dependencies are based on build dependencies (since dpkg 1.22.1).
+
 =back
 
 =cut
@@ -126,6 +129,10 @@ sub new {
     $self->{build_arch} = $opts{build_arch};
     $self->{build_dep} = $opts{build_dep} // 0;
     $self->{tests_dep} = $opts{tests_dep} // 0;
+    if ($self->{tests_dep}) {
+        $self->{build_dep} = 1;
+    }
+
     $self->parse_string($arg) if defined $arg;
     return $self;
 }
-- 
2.42.0

Reply via email to