Merge lp:~cjwatson/launchpad/allow-missing-changes-binary into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18881
Proposed branch: lp:~cjwatson/launchpad/allow-missing-changes-binary
Merge into: lp:launchpad
Diff against target: 123 lines (+79/-2)
4 files modified
lib/lp/archiveuploader/changesfile.py (+2/-2)
lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.dsc (+21/-0)
lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1_source.changes (+27/-0)
lib/lp/archiveuploader/tests/test_uploadprocessor.py (+29/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/allow-missing-changes-binary
Reviewer Review Type Date Requested Status
William Grant (community) code Approve
Review via email: mp+363379@code.launchpad.net

Commit message

Allow source .changes files to omit the Binary field.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archiveuploader/changesfile.py'
2--- lib/lp/archiveuploader/changesfile.py 2017-09-17 10:35:57 +0000
3+++ lib/lp/archiveuploader/changesfile.py 2019-02-19 16:55:44 +0000
4@@ -58,7 +58,7 @@
5 """Changesfile model."""
6
7 mandatory_fields = set([
8- "Source", "Binary", "Architecture", "Version", "Distribution",
9+ "Source", "Architecture", "Version", "Distribution",
10 "Maintainer", "Files", "Changes", "Date",
11 # Changed-By is not technically mandatory according to
12 # Debian policy but Soyuz relies on it being set in
13@@ -311,7 +311,7 @@
14 @property
15 def binaries(self):
16 """Return set of binary package names listed."""
17- return set(self._dict['Binary'].strip().split())
18+ return set(self._dict.get('Binary', '').strip().split())
19
20 @property
21 def converted_urgency(self):
22
23=== added directory 'lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field'
24=== added file 'lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.diff.gz'
25Binary files lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.diff.gz 1970-01-01 00:00:00 +0000 and lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.diff.gz 2019-02-19 16:55:44 +0000 differ
26=== added file 'lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.dsc'
27--- lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.dsc 1970-01-01 00:00:00 +0000
28+++ lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1.dsc 2019-02-19 16:55:44 +0000
29@@ -0,0 +1,21 @@
30+-----BEGIN PGP SIGNED MESSAGE-----
31+Hash: SHA1
32+
33+Format: 1.0
34+Source: bar
35+Version: 1.0-1
36+Binary: bar
37+Maintainer: Launchpad team <launchpad@lists.canonical.com>
38+Architecture: any
39+Standards-Version: 3.6.2
40+Files:
41+ fc1464e5985b962a042d5354452f361d 164 bar_1.0.orig.tar.gz
42+ 1e35b810764f140af9616de8274e6e73 537 bar_1.0-1.diff.gz
43+
44+-----BEGIN PGP SIGNATURE-----
45+Version: GnuPG v1.4.3 (GNU/Linux)
46+
47+iD8DBQFFt7Cojn63CGxkqMURAo6FAJ9ZUagUNtYpmZrqFwL6LXDKOUSOPwCdFqPa
48+BdrMeT+0Hg+yMS69uO+qJRI=
49+=mjFU
50+-----END PGP SIGNATURE-----
51
52=== added file 'lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1_source.changes'
53--- lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1_source.changes 1970-01-01 00:00:00 +0000
54+++ lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0-1_source.changes 2019-02-19 16:55:44 +0000
55@@ -0,0 +1,27 @@
56+-----BEGIN PGP SIGNED MESSAGE-----
57+Hash: SHA1
58+
59+Format: 1.7
60+Date: Thu, 16 Feb 2006 15:34:09 +0000
61+Source: bar
62+Architecture: source
63+Version: 1.0-1
64+Distribution: breezy
65+Urgency: low
66+Maintainer: Launchpad team <launchpad@lists.canonical.com>
67+Changed-By: Daniel Silverstone <daniel.silverstone@canonical.com>
68+Changes:
69+ bar (1.0-1) breezy; urgency=low
70+ .
71+ * Initial version
72+Files:
73+ 5d533778b698edc1a122098a98c8490e 512 devel optional bar_1.0-1.dsc
74+ fc1464e5985b962a042d5354452f361d 164 devel optional bar_1.0.orig.tar.gz
75+ 1e35b810764f140af9616de8274e6e73 537 devel optional bar_1.0-1.diff.gz
76+
77+-----BEGIN PGP SIGNATURE-----
78+
79+iF0EARECAB0WIQQ0DKO7Jw4nFsnuC3aOfrcIbGSoxQUCXGws2QAKCRCOfrcIbGSo
80+xcvwAJ4qSgGJOxs95sQMqWnBtEqJvmVVlgCfQ6Tdctq1YPjdsPEHDtqOdAMCvcc=
81+=iQ/q
82+-----END PGP SIGNATURE-----
83
84=== added file 'lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0.orig.tar.gz'
85Binary files lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0.orig.tar.gz 1970-01-01 00:00:00 +0000 and lib/lp/archiveuploader/tests/data/suite/bar_1.0-1_no_binary_field/bar_1.0.orig.tar.gz 2019-02-19 16:55:44 +0000 differ
86=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
87--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2018-05-03 15:10:39 +0000
88+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2019-02-19 16:55:44 +0000
89@@ -1486,6 +1486,35 @@
90 "Expected one 'bar' item in the queue, actually got %d."
91 % queue_items.count())
92
93+ def testSourceUploadWithoutBinaryField(self):
94+ """Source uploads may omit the Binary field.
95+
96+ dpkg >= 1.19.3 omits the Binary field (as well as Description) from
97+ sourceful .changes files, so don't require it.
98+ """
99+ self.setupBreezy()
100+ self.layer.txn.commit()
101+ self.options.context = 'absolutely-anything'
102+ uploadprocessor = self.getUploadProcessor(self.layer.txn)
103+
104+ upload_dir = self.queueUpload("bar_1.0-1_no_binary_field")
105+ self.processUpload(uploadprocessor, upload_dir)
106+ [msg] = pop_notifications()
107+ self.assertNotIn(
108+ "rejected", str(msg), "Failed to upload bar source:\n%s" % msg)
109+ spph = self.publishPackage("bar", "1.0-1")
110+
111+ self.assertEqual(
112+ sorted((sprf.libraryfile.filename, sprf.filetype)
113+ for sprf in spph.sourcepackagerelease.files),
114+ [('bar_1.0-1.diff.gz',
115+ SourcePackageFileType.DIFF),
116+ ('bar_1.0-1.dsc',
117+ SourcePackageFileType.DSC),
118+ ('bar_1.0.orig.tar.gz',
119+ SourcePackageFileType.ORIG_TARBALL),
120+ ])
121+
122 def testUploadResultingInNoBuilds(self):
123 """Source uploads resulting in no builds.
124