Bug#1053481: libdpkg-perl: dpkg-source fails to generate (complete) Testsuite-Triggers if test deps have :native qualifier

2023-10-26 Thread James McCoy
On Thu, Oct 26, 2023 at 01:10:46PM +0200, Guillem Jover wrote:
> On Wed, 2023-10-25 at 20:44:26 -0400, James McCoy wrote:
> > 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!  I'm looking to add a lot more arch-qualified test depends, so I
appreciate the effort.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB



Bug#1053481: libdpkg-perl: dpkg-source fails to generate (complete) Testsuite-Triggers if test deps have :native qualifier

2023-10-26 Thread Guillem Jover
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 
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.
 
+This option implicitly (and forcibly) enables C 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 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



Bug#1053481: libdpkg-perl: dpkg-source fails to generate (complete) Testsuite-Triggers if test deps have :native qualifier

2023-10-25 Thread James McCoy
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?

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;

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB



Bug#1053481: libdpkg-perl: dpkg-source fails to generate (complete) Testsuite-Triggers if test deps have :native qualifier

2023-10-04 Thread Guillem Jover
Hi!

On Wed, 2023-10-04 at 20:17:58 -0400, James McCoy wrote:
> Package: libdpkg-perl
> Version: 1.18.8
> Severity: normal
> Control: affects -1 src:zsh src:poppler src:libjodycode src:doxygen 
> src:jemalloc src:jdupes src:libsdl2 src:iproute2

> Any test stanza in a debian/tests/control file which contains a
> foo:native Depends will not have its dependencies translated into
> Testsuite-Triggers.
> 
> This is due to an explicit check in Dpkg::Deps::Simple->parse_string()
> which only allows native qualified dependencies for build dependencies.
> 
> As an example, running “dpkg-source -b .” for jdupes shows

[…]

> Three warnings, one for each of the tests.  Since it does have a test
> without a native qualified dependency, Testsuite-Triggers is generated.
> 
> % grep Depends debian/tests/control
> Depends: @, tree:native
> Depends: @, tree:native
> Depends: @, tree:native
> Depends: @, forensics-samples-files
> % grep Testsuite ../jdupes_1.27.3-2.dsc
> Testsuite: autopkgtest
> Testsuite-Triggers: forensics-samples-files
> 
> As far as I can tell, this has been a problem since dpkg-source gained
> support for generating Testsuite-Triggers.

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.

Thanks,
Guillem



Bug#1053481: libdpkg-perl: dpkg-source fails to generate (complete) Testsuite-Triggers if test deps have :native qualifier

2023-10-04 Thread James McCoy
Package: libdpkg-perl
Version: 1.18.8
Severity: normal
Control: affects -1 src:zsh src:poppler src:libjodycode src:doxygen 
src:jemalloc src:jdupes src:libsdl2 src:iproute2

Any test stanza in a debian/tests/control file which contains a
foo:native Depends will not have its dependencies translated into
Testsuite-Triggers.

This is due to an explicit check in Dpkg::Deps::Simple->parse_string()
which only allows native qualified dependencies for build dependencies.

As an example, running “dpkg-source -b .” for jdupes shows

% dpkg-source -b .
dpkg-source: warning: can't parse dependency tree:native
dpkg-source: warning: can't parse dependency tree:native
dpkg-source: warning: can't parse dependency tree:native
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building jdupes using existing ./jdupes_1.27.3.orig.tar.gz
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: building jdupes in jdupes_1.27.3-2.debian.tar.xz
dpkg-source: info: building jdupes in jdupes_1.27.3-2.dsc

Three warnings, one for each of the tests.  Since it does have a test
without a native qualified dependency, Testsuite-Triggers is generated.

% grep Depends debian/tests/control
Depends: @, tree:native
Depends: @, tree:native
Depends: @, tree:native
Depends: @, forensics-samples-files
% grep Testsuite ../jdupes_1.27.3-2.dsc
Testsuite: autopkgtest
Testsuite-Triggers: forensics-samples-files

As far as I can tell, this has been a problem since dpkg-source gained
support for generating Testsuite-Triggers.

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

Kernel: Linux 6.5.0-1-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libdpkg-perl depends on:
ii  dpkg  1.22.0
ii  perl  5.36.0-9

Versions of packages libdpkg-perl recommends:
ii  bzip2   1.0.8-5+b1
ii  libfile-fcntllock-perl  0.22-4+b1
ii  liblocale-gettext-perl  1.07-6
ii  xz-utils5.4.4-0.1

Versions of packages libdpkg-perl suggests:
ii  binutils   2.41-5
ii  brz [bzr]  3.3.4-1
ii  clang-14 [c-compiler]  1:14.0.6-16
ii  clang-16 [c-compiler]  1:16.0.6-15
ii  debian-keyring 2023.09.24
ii  gcc [c-compiler]   4:13.2.0-1
ii  gcc-13 [c-compiler]13.2.0-4
ii  git1:2.42.0-1
ii  gnupg  2.2.40-1.1
ii  gpgv   2.2.40-1.1
ii  patch  2.7.6-7
ii  sensible-utils 0.0.20

-- no debconf information