[dpkg] 120/200: dpkg-source: Refactor testsuite functions
Ximin Luo
infinity0 at debian.org
Wed Apr 5 15:17:26 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository dpkg.
commit df630946cc239c4fb7494dd3a2b78fa4e1c98358
Author: Guillem Jover <guillem at debian.org>
Date: Thu Dec 15 23:47:16 2016 +0100
dpkg-source: Refactor testsuite functions
Call set_testsuite_triggers_field() from inside set_testsuite_fields(),
so that we do not have to perform the same checks more than once.
---
debian/changelog | 1 +
scripts/dpkg-source.pl | 20 +++++++++-----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 53e9b6c..6e83226 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ dpkg (1.18.19) UNRELEASED; urgency=medium
the current date if the changelog does not have one. Closes: #849081
* Refactor update-alternatives pathname existence check into a new function.
* Avoid useless repeated lstat()s in update-alternatives.
+ * Only check for debian/tests/control file once in dpkg-source.
* Portability:
- On GNU/Hurd try to use the new process executable name attribute from
libps, to properly match on start-stop-daemon --exec.
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 2d4ae5f..da5f25e 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -366,8 +366,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
$fields->{'Package-List'} = "\n" . join("\n", sort @pkglist);
# Check if we have a testsuite, and handle manual and automatic values.
- set_testsuite_field($fields);
- set_testsuite_triggers_field($fields, @binarypackages);
+ set_testsuite_fields($fields, @binarypackages);
# Scan fields of dpkg-parsechangelog
foreach (keys %{$changelog}) {
@@ -506,9 +505,9 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
exit(0);
}
-sub set_testsuite_field
+sub set_testsuite_fields
{
- my $fields = shift;
+ my ($fields, @binarypackages) = @_;
my $testsuite_field = $fields->{'Testsuite'} // '';
my %testsuite = map { $_ => 1 } split /\s*,\s*/, $testsuite_field;
@@ -516,6 +515,11 @@ sub set_testsuite_field
error(g_('test control %s is not a regular file'),
'debian/tests/control') unless -f _;
$testsuite{autopkgtest} = 1;
+
+ my $tests = Dpkg::Control::Tests->new();
+ $tests->load("$dir/debian/tests/control");
+
+ set_testsuite_triggers_field($tests, $fields, @binarypackages);
} elsif ($testsuite{autopkgtest}) {
warning(g_('%s field contains value %s, but no tests control file %s'),
'Testsuite', 'autopkgtest', 'debian/tests/control');
@@ -526,18 +530,12 @@ sub set_testsuite_field
sub set_testsuite_triggers_field
{
- my ($fields, @binarypackages) = @_;
+ my ($tests, $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};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list