This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=1c3091d0528f62c04aa70839117e357b1b6bfe30 commit 1c3091d0528f62c04aa70839117e357b1b6bfe30 (HEAD -> main) Author: Guillem Jover <[email protected]> AuthorDate: Thu Oct 26 13:06:32 2023 +0200 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 +++++++ scripts/t/Dpkg_Deps.t | 7 ++++++- 3 files changed, 19 insertions(+), 1 deletion(-) 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; } diff --git a/scripts/t/Dpkg_Deps.t b/scripts/t/Dpkg_Deps.t index 8694adffa..b6a10d6aa 100644 --- a/scripts/t/Dpkg_Deps.t +++ b/scripts/t/Dpkg_Deps.t @@ -16,7 +16,7 @@ use strict; use warnings; -use Test::More tests => 82; +use Test::More tests => 84; use Dpkg::Arch qw(get_host_arch); use Dpkg::Version; @@ -99,9 +99,14 @@ my $field_tests = 'self, @, @builddeps@'; $SIG{__WARN__} = sub {}; my $dep_tests_fail = deps_parse($field_tests); is($dep_tests_fail, undef, 'normal deps with @ in pkgname'); +$dep_tests_fail = deps_parse($field_tests, build_dep => 1); +is($dep_tests_fail, undef, 'build deps with @ in pkgname'); delete $SIG{__WARN__}; my $dep_tests_pass = deps_parse($field_tests, tests_dep => 1); is($dep_tests_pass->output(), $field_tests, 'tests deps with @ in pkgname'); +$field_tests = 'self, pkgname:native, @, @builddeps@'; +$dep_tests_pass = deps_parse($field_tests, tests_dep => 1); +is($dep_tests_pass->output(), $field_tests, 'tests deps with :native and @ in pkgname'); my $field_arch = 'libc6 (>= 2.5) [!alpha !hurd-i386], libc6.1 [alpha], libc0.1 [hurd-i386]'; my $dep_i386 = deps_parse($field_arch, reduce_arch => 1, host_arch => 'i386'); -- Dpkg.Org's dpkg

