Skip to content
Snippets Groups Projects
Commit db3c4abd authored by Guillem Jover's avatar Guillem Jover
Browse files

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.
parent ec3bd7ea
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment