Ubuntu Pastebin

Paste from None at Thu, 16 Nov 2017 08:21:41 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff -Nru dpkg-1.18.4ubuntu1.3/debian/changelog dpkg-1.18.4ubuntu1.4/debian/changelog
--- dpkg-1.18.4ubuntu1.3/debian/changelog	2017-10-21 01:14:06.000000000 +0200
+++ dpkg-1.18.4ubuntu1.4/debian/changelog	2017-11-16 09:19:59.000000000 +0100
@@ -1,3 +1,9 @@
+dpkg (1.18.4ubuntu1.4) xenial; urgency=medium
+
+  * Backport support for Testsuite-Triggers
+
+ -- Julian Andres Klode <juliank@ubuntu.com>  Thu, 16 Nov 2017 09:19:59 +0100
+
 dpkg (1.18.4ubuntu1.3) xenial; urgency=medium
 
   * Use ohshit() instead of internerr() for unhandled dpkg-split exit
diff -Nru dpkg-1.18.4ubuntu1.3/scripts/Dpkg/Control/FieldsCore.pm dpkg-1.18.4ubuntu1.4/scripts/Dpkg/Control/FieldsCore.pm
--- dpkg-1.18.4ubuntu1.3/scripts/Dpkg/Control/FieldsCore.pm	2015-12-25 04:53:50.000000000 +0100
+++ dpkg-1.18.4ubuntu1.4/scripts/Dpkg/Control/FieldsCore.pm	2017-11-16 09:19:50.000000000 +0100
@@ -299,6 +299,10 @@
         allowed => ALL_SRC,
         separator => FIELD_SEP_COMMA,
     },
+    'Testsuite-Triggers' => {
+        allowed => ALL_SRC,
+        separator => FIELD_SEP_COMMA,
+    },
     'Triggers-Awaited' => {
         allowed => CTRL_FILE_STATUS,
         separator => FIELD_SEP_SPACE,
@@ -372,8 +376,8 @@
         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 -Nru dpkg-1.18.4ubuntu1.3/scripts/dpkg-source.pl dpkg-1.18.4ubuntu1.4/scripts/dpkg-source.pl
--- dpkg-1.18.4ubuntu1.3/scripts/dpkg-source.pl	2015-11-27 00:53:40.000000000 +0100
+++ dpkg-1.18.4ubuntu1.4/scripts/dpkg-source.pl	2017-11-16 09:19:19.000000000 +0100
@@ -41,7 +41,9 @@
 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;
@@ -357,6 +359,7 @@
 
     # 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}) {
@@ -511,6 +514,34 @@
     $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;
 
Download as text