diff options
| author | Guillem Jover <guillem@debian.org> | 2014-07-05 18:54:21 (GMT) |
|---|---|---|
| committer | Guillem Jover <guillem@debian.org> | 2014-08-09 20:48:11 (GMT) |
| commit | db3c4abdd24fe4c444c575f0b412ae2bbd013c1d (patch) | |
| tree | 78b1d6da46d95e1e3eb0260b5ce27ac993091e8c | |
| parent | ec3bd7eac1f0170fa279ef7ee9297018e7bcb5a8 (diff) | |
dpkg-source: Automatically add the Testsuite field
This is a comma-separated field. The only currently known value for the
field is autopkgtest, which requires the debian/tests/control file to
be present, even if empty, otherwise it is a deb822-style file.
Existing and unknown values will be preserved, and autopkgtest will be
appended. If the autopkgtest value is present but there is no
debian/tests/control file, then the value will be removed and a warning
emitted.
| -rw-r--r-- | debian/changelog | 1 | ||||
| -rwxr-xr-x | scripts/dpkg-source.pl | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 4c5adc5..075bfdc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -43,6 +43,7 @@ dpkg (1.17.11) UNRELEASED; urgency=low performed on the input, and gets reflected on the output. * Add new dpkg-query virtual fields db:Status-Want, db:Status-Status and db:Status-Eflag to allow fine-grained access to the Status values. + * Automatically add the Testsuite field in dpkg-source to the .dsc file. [ Updated programs translations ] * Danish (Joe Dalton). Closes: #754127 diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index c7fb5f7..1b10659 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -330,6 +330,9 @@ if ($options{opmode} =~ /^(-b|--print-format|--(before|after)-build|--commit)$/) $fields->{'Architecture'} = join(' ', @sourcearch); $fields->{'Package-List'} = "\n" . join("\n", sort @pkglist); + # Check if we have a testsuite, and handle manual and automatic values. + set_testsuite_field($fields); + # Scan fields of dpkg-parsechangelog foreach (keys %{$changelog}) { my $v = $changelog->{$_}; @@ -465,6 +468,22 @@ if ($options{opmode} =~ /^(-b|--print-format|--(before|after)-build|--commit)$/) exit(0); } +sub set_testsuite_field +{ + my ($fields) = @_; + + my $testsuite_field = $fields->{'Testsuite'} // ''; + my %testsuite = map { $_ => 1 } split /\s*,\s*/, $testsuite_field; + if (-e "$dir/debian/tests/control") { + $testsuite{autopkgtest} = 1; + } elsif ($testsuite{autopkgtest}) { + warning(_g('%s field contains value %s, but no tests control file %s'), + 'Testsuite', 'autopkgtest', 'debian/tests/control'); + delete $testsuite{autopkgtest}; + } + $fields->{'Testsuite'} = join ', ', sort keys %testsuite; +} + sub setopmode { if (defined($options{opmode})) { usageerr(_g('only one of -x, -b or --print-format allowed, and only once')); |
