summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rw-r--r--scripts/Dpkg/Control/FieldsCore.pm8
-rwxr-xr-xscripts/dpkg-source.pl31
3 files changed, 40 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 1d1e33410..63de0d337 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,9 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
under either the dpkg system or user configuration directories.
Closes: #539692, #765494
* Check that debian/tests/control is a regular file before parsing it.
+ * Generate Testsuite-Triggers field from test dependencies in dpkg-source
+ into .dsc files. Based on a patch by Martin Pitt <martin.pitt@ubuntu.com>.
+ Closes: #779559
* Perl modules:
- Use warnings::warnif() instead of carp() for deprecated warnings.
- Add new format_range() method and deprecate dpkg() and rfc822() methods
diff --git a/scripts/Dpkg/Control/FieldsCore.pm b/scripts/Dpkg/Control/FieldsCore.pm
index 0c7ce4b1f..e3b43648d 100644
--- a/scripts/Dpkg/Control/FieldsCore.pm
+++ b/scripts/Dpkg/Control/FieldsCore.pm
@@ -354,6 +354,10 @@ our %FIELDS = (
allowed => ALL_SRC,
separator => FIELD_SEP_COMMA,
},
+ 'Testsuite-Triggers' => {
+ allowed => ALL_SRC,
+ separator => FIELD_SEP_COMMA,
+ },
'Timestamp' => {
allowed => CTRL_CHANGELOG,
},
@@ -439,8 +443,8 @@ our %FIELD_ORDER = (
qw(Format Source Binary Architecture Version Origin Maintainer
Uploaders Homepage Standards-Version Vcs-Browser
Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn
- Vcs-Svn Testsuite), &field_list_src_dep(), qw(Package-List),
- @checksum_fields, qw(Files)
+ Vcs-Svn Testsuite Testsuite-Triggers), &field_list_src_dep(),
+ qw(Package-List), @checksum_fields, qw(Files)
],
CTRL_FILE_CHANGES() => [
qw(Format Date Source Binary Binary-Only Built-For-Profiles Architecture
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 7d71e05e1..50885bb87 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -41,7 +41,9 @@ use Dpkg::Deps;
use Dpkg::Compression;
use Dpkg::Conf;
use Dpkg::Control::Info;
+use Dpkg::Control::Tests;
use Dpkg::Control::Fields;
+use Dpkg::Index;
use Dpkg::Substvars;
use Dpkg::Version;
use Dpkg::Vars;
@@ -359,6 +361,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
# Check if we have a testsuite, and handle manual and automatic values.
set_testsuite_field($fields);
+ set_testsuite_triggers_field($fields, @binarypackages);
# Scan fields of dpkg-parsechangelog
foreach (keys %{$changelog}) {
@@ -515,6 +518,34 @@ sub set_testsuite_field
$fields->{'Testsuite'} = join ', ', sort keys %testsuite;
}
+sub set_testsuite_triggers_field
+{
+ my ($fields, @binarypackages) = @_;
+ my %testdeps;
+
+ # Never overwrite a manually defined field.
+ return if $fields->{'Testsuite-Triggers'};
+
+ # We only support autopkgtests.
+ return unless -e "$dir/debian/tests/control";
+
+ my $tests = Dpkg::Control::Tests->new();
+ $tests->load("$dir/debian/tests/control");
+
+ foreach my $test ($tests->get()) {
+ next unless $test->{Depends};
+
+ my $deps = deps_parse($test->{Depends}, use_arch => 0, tests_dep => 1);
+ deps_iterate($deps, sub { $testdeps{$_[0]->{package}} = 1 });
+ }
+
+ # Remove our own binaries and meta-depends.
+ foreach my $pkg (@binarypackages, qw(@ @builddeps@)) {
+ delete $testdeps{$pkg};
+ }
+ $fields->{'Testsuite-Triggers'} = join ', ', sort keys %testdeps;
+}
+
sub setopmode {
my $opmode = shift;