Merge lp:~apw/launchpad/signing-reinstate-raw-uefi-custom-upload into lp:launchpad
- signing-reinstate-raw-uefi-custom-upload
- Merge into devel
Proposed by
Andy Whitcroft
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 18080 | ||||
Proposed branch: | lp:~apw/launchpad/signing-reinstate-raw-uefi-custom-upload | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
415 lines (+165/-46) 9 files modified
lib/lp/archivepublisher/configure.zcml (+7/-0) lib/lp/archivepublisher/signing.py (+22/-2) lib/lp/archivepublisher/tests/test_signing.py (+66/-32) lib/lp/archiveuploader/nascentuploadfile.py (+8/-3) lib/lp/soyuz/browser/queue.py (+1/-0) lib/lp/soyuz/enums.py (+7/-1) lib/lp/soyuz/model/queue.py (+5/-2) lib/lp/soyuz/scripts/custom_uploads_copier.py (+7/-2) lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py (+42/-4) |
||||
To merge this branch: | bzr merge lp:~apw/launchpad/signing-reinstate-raw-uefi-custom-upload | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+295848@code.launchpad.net |
Commit message
Reinstate the raw-uefi custom upload as a distinct type.
Description of the change
Reinstate the raw-uefi custom upload as a distinct type. This utilises the same machinery as raw-signing. The only difference is the location in dists, with raw-uefi landing in dists/*/uefi and raw-signing landing in dists/*/signing.
To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) : | # |
review:
Approve
Revision history for this message
Andy Whitcroft (apw) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/archivepublisher/configure.zcml' | |||
2 | --- lib/lp/archivepublisher/configure.zcml 2016-05-23 10:46:55 +0000 | |||
3 | +++ lib/lp/archivepublisher/configure.zcml 2016-05-31 12:46:39 +0000 | |||
4 | @@ -88,6 +88,13 @@ | |||
5 | 88 | interface="lp.soyuz.interfaces.queue.ICustomUploadHandler"/> | 88 | interface="lp.soyuz.interfaces.queue.ICustomUploadHandler"/> |
6 | 89 | </securedutility> | 89 | </securedutility> |
7 | 90 | <securedutility | 90 | <securedutility |
8 | 91 | class="lp.archivepublisher.signing.UefiUpload" | ||
9 | 92 | provides="lp.soyuz.interfaces.queue.ICustomUploadHandler" | ||
10 | 93 | name="UEFI"> | ||
11 | 94 | <allow | ||
12 | 95 | interface="lp.soyuz.interfaces.queue.ICustomUploadHandler"/> | ||
13 | 96 | </securedutility> | ||
14 | 97 | <securedutility | ||
15 | 91 | class="lp.archivepublisher.signing.SigningUpload" | 98 | class="lp.archivepublisher.signing.SigningUpload" |
16 | 92 | provides="lp.soyuz.interfaces.queue.ICustomUploadHandler" | 99 | provides="lp.soyuz.interfaces.queue.ICustomUploadHandler" |
17 | 93 | name="SIGNING"> | 100 | name="SIGNING"> |
18 | 94 | 101 | ||
19 | === modified file 'lib/lp/archivepublisher/signing.py' | |||
20 | --- lib/lp/archivepublisher/signing.py 2016-05-26 10:46:04 +0000 | |||
21 | +++ lib/lp/archivepublisher/signing.py 2016-05-31 12:46:39 +0000 | |||
22 | @@ -15,6 +15,7 @@ | |||
23 | 15 | 15 | ||
24 | 16 | __all__ = [ | 16 | __all__ = [ |
25 | 17 | "SigningUpload", | 17 | "SigningUpload", |
26 | 18 | "UefiUpload", | ||
27 | 18 | ] | 19 | ] |
28 | 19 | 20 | ||
29 | 20 | import os | 21 | import os |
30 | @@ -63,6 +64,8 @@ | |||
31 | 63 | """ | 64 | """ |
32 | 64 | custom_type = "signing" | 65 | custom_type = "signing" |
33 | 65 | 66 | ||
34 | 67 | dists_directory = "signed" | ||
35 | 68 | |||
36 | 66 | @staticmethod | 69 | @staticmethod |
37 | 67 | def parsePath(tarfile_path): | 70 | def parsePath(tarfile_path): |
38 | 68 | tarfile_base = os.path.basename(tarfile_path) | 71 | tarfile_base = os.path.basename(tarfile_path) |
39 | @@ -94,8 +97,8 @@ | |||
40 | 94 | 97 | ||
41 | 95 | self.setComponents(tarfile_path) | 98 | self.setComponents(tarfile_path) |
42 | 96 | 99 | ||
45 | 97 | dists_signed = os.path.join( | 100 | dists_signed = os.path.join(pubconf.archiveroot, "dists", |
46 | 98 | pubconf.archiveroot, "dists", suite, "main", "signed") | 101 | suite, "main", self.dists_directory) |
47 | 99 | self.targetdir = os.path.join( | 102 | self.targetdir = os.path.join( |
48 | 100 | dists_signed, "%s-%s" % (self.package, self.arch)) | 103 | dists_signed, "%s-%s" % (self.package, self.arch)) |
49 | 101 | self.archiveroot = pubconf.archiveroot | 104 | self.archiveroot = pubconf.archiveroot |
50 | @@ -302,3 +305,20 @@ | |||
51 | 302 | 305 | ||
52 | 303 | def shouldInstall(self, filename): | 306 | def shouldInstall(self, filename): |
53 | 304 | return filename.startswith("%s/" % self.version) | 307 | return filename.startswith("%s/" % self.version) |
54 | 308 | |||
55 | 309 | |||
56 | 310 | class UefiUpload(SigningUpload): | ||
57 | 311 | """Legacy UEFI Signing custom upload. | ||
58 | 312 | |||
59 | 313 | Provides backwards compatibility UEFI signing uploads. Existing | ||
60 | 314 | packages use the raw-uefi custom upload and expect the results | ||
61 | 315 | to be published to dists/*/uefi. These are a functional subset of | ||
62 | 316 | raw-signing custom uploads differing only in where they are published | ||
63 | 317 | in the archive. | ||
64 | 318 | |||
65 | 319 | We expect to be able to remove this upload type once all existing | ||
66 | 320 | packages are converted to the new form and location. | ||
67 | 321 | """ | ||
68 | 322 | custom_type = "uefi" | ||
69 | 323 | |||
70 | 324 | dists_directory = "uefi" | ||
71 | 305 | 325 | ||
72 | === modified file 'lib/lp/archivepublisher/tests/test_signing.py' | |||
73 | --- lib/lp/archivepublisher/tests/test_signing.py 2016-05-26 10:46:39 +0000 | |||
74 | +++ lib/lp/archivepublisher/tests/test_signing.py 2016-05-31 12:46:39 +0000 | |||
75 | @@ -15,7 +15,10 @@ | |||
76 | 15 | CustomUploadAlreadyExists, | 15 | CustomUploadAlreadyExists, |
77 | 16 | CustomUploadBadUmask, | 16 | CustomUploadBadUmask, |
78 | 17 | ) | 17 | ) |
80 | 18 | from lp.archivepublisher.signing import SigningUpload | 18 | from lp.archivepublisher.signing import ( |
81 | 19 | SigningUpload, | ||
82 | 20 | UefiUpload, | ||
83 | 21 | ) | ||
84 | 19 | from lp.services.osutils import write_file | 22 | from lp.services.osutils import write_file |
85 | 20 | from lp.services.tarfile_helpers import LaunchpadWriteTarFile | 23 | from lp.services.tarfile_helpers import LaunchpadWriteTarFile |
86 | 21 | from lp.testing import TestCase | 24 | from lp.testing import TestCase |
87 | @@ -98,10 +101,10 @@ | |||
88 | 98 | self.signingautokey = True | 101 | self.signingautokey = True |
89 | 99 | 102 | ||
90 | 100 | 103 | ||
92 | 101 | class TestSigning(TestCase): | 104 | class TestSigningHelpers(TestCase): |
93 | 102 | 105 | ||
94 | 103 | def setUp(self): | 106 | def setUp(self): |
96 | 104 | super(TestSigning, self).setUp() | 107 | super(TestSigningHelpers, self).setUp() |
97 | 105 | self.temp_dir = self.makeTemporaryDirectory() | 108 | self.temp_dir = self.makeTemporaryDirectory() |
98 | 106 | self.signing_dir = self.makeTemporaryDirectory() | 109 | self.signing_dir = self.makeTemporaryDirectory() |
99 | 107 | self.pubconf = FakeConfigPrimary(self.temp_dir, self.signing_dir) | 110 | self.pubconf = FakeConfigPrimary(self.temp_dir, self.signing_dir) |
100 | @@ -135,43 +138,42 @@ | |||
101 | 135 | self.buffer = open(self.path, "wb") | 138 | self.buffer = open(self.path, "wb") |
102 | 136 | self.archive = LaunchpadWriteTarFile(self.buffer) | 139 | self.archive = LaunchpadWriteTarFile(self.buffer) |
103 | 137 | 140 | ||
104 | 138 | def process_emulate(self): | ||
105 | 139 | self.archive.close() | ||
106 | 140 | self.buffer.close() | ||
107 | 141 | upload = SigningUpload() | ||
108 | 142 | # Under no circumstances is it safe to execute actual commands. | ||
109 | 143 | self.fake_call = FakeMethod(result=0) | ||
110 | 144 | upload.callLog = FakeMethodCallLog(upload=upload) | ||
111 | 145 | self.useFixture(MonkeyPatch("subprocess.call", self.fake_call)) | ||
112 | 146 | upload.process(self.pubconf, self.path, self.suite) | ||
113 | 147 | |||
114 | 148 | return upload | ||
115 | 149 | |||
116 | 150 | def process(self): | ||
117 | 151 | self.archive.close() | ||
118 | 152 | self.buffer.close() | ||
119 | 153 | upload = SigningUpload() | ||
120 | 154 | upload.signUefi = FakeMethod() | ||
121 | 155 | upload.signKmod = FakeMethod() | ||
122 | 156 | # Under no circumstances is it safe to execute actual commands. | ||
123 | 157 | fake_call = FakeMethod(result=0) | ||
124 | 158 | self.useFixture(MonkeyPatch("subprocess.call", fake_call)) | ||
125 | 159 | upload.process(self.pubconf, self.path, self.suite) | ||
126 | 160 | self.assertEqual(0, fake_call.call_count) | ||
127 | 161 | |||
128 | 162 | return upload | ||
129 | 163 | |||
130 | 164 | def getDistsPath(self): | 141 | def getDistsPath(self): |
131 | 165 | return os.path.join(self.pubconf.archiveroot, "dists", | 142 | return os.path.join(self.pubconf.archiveroot, "dists", |
132 | 166 | self.suite, "main") | 143 | self.suite, "main") |
133 | 167 | 144 | ||
134 | 145 | |||
135 | 146 | class TestSigning(TestSigningHelpers): | ||
136 | 147 | |||
137 | 168 | def getSignedPath(self, loader_type, arch): | 148 | def getSignedPath(self, loader_type, arch): |
138 | 169 | return os.path.join(self.getDistsPath(), "signed", | 149 | return os.path.join(self.getDistsPath(), "signed", |
139 | 170 | "%s-%s" % (loader_type, arch)) | 150 | "%s-%s" % (loader_type, arch)) |
140 | 171 | 151 | ||
144 | 172 | def getUefiPath(self, loader_type, arch): | 152 | def process_emulate(self): |
145 | 173 | return os.path.join(self.getDistsPath(), "uefi", | 153 | self.archive.close() |
146 | 174 | "%s-%s" % (loader_type, arch)) | 154 | self.buffer.close() |
147 | 155 | upload = SigningUpload() | ||
148 | 156 | # Under no circumstances is it safe to execute actual commands. | ||
149 | 157 | self.fake_call = FakeMethod(result=0) | ||
150 | 158 | upload.callLog = FakeMethodCallLog(upload=upload) | ||
151 | 159 | self.useFixture(MonkeyPatch("subprocess.call", self.fake_call)) | ||
152 | 160 | upload.process(self.pubconf, self.path, self.suite) | ||
153 | 161 | |||
154 | 162 | return upload | ||
155 | 163 | |||
156 | 164 | def process(self): | ||
157 | 165 | self.archive.close() | ||
158 | 166 | self.buffer.close() | ||
159 | 167 | upload = SigningUpload() | ||
160 | 168 | upload.signUefi = FakeMethod() | ||
161 | 169 | upload.signKmod = FakeMethod() | ||
162 | 170 | # Under no circumstances is it safe to execute actual commands. | ||
163 | 171 | fake_call = FakeMethod(result=0) | ||
164 | 172 | self.useFixture(MonkeyPatch("subprocess.call", fake_call)) | ||
165 | 173 | upload.process(self.pubconf, self.path, self.suite) | ||
166 | 174 | self.assertEqual(0, fake_call.call_count) | ||
167 | 175 | |||
168 | 176 | return upload | ||
169 | 175 | 177 | ||
170 | 176 | def test_archive_copy(self): | 178 | def test_archive_copy(self): |
171 | 177 | # If there is no key/cert configuration, processing succeeds but | 179 | # If there is no key/cert configuration, processing succeeds but |
172 | @@ -599,3 +601,35 @@ | |||
173 | 599 | self.assertTrue(os.path.exists(self.kmod_x509)) | 601 | self.assertTrue(os.path.exists(self.kmod_x509)) |
174 | 600 | self.assertEqual(stat.S_IMODE(os.stat(self.kmod_pem).st_mode), 0o600) | 602 | self.assertEqual(stat.S_IMODE(os.stat(self.kmod_pem).st_mode), 0o600) |
175 | 601 | self.assertEqual(stat.S_IMODE(os.stat(self.kmod_x509).st_mode), 0o644) | 603 | self.assertEqual(stat.S_IMODE(os.stat(self.kmod_x509).st_mode), 0o644) |
176 | 604 | |||
177 | 605 | |||
178 | 606 | class TestUefi(TestSigningHelpers): | ||
179 | 607 | |||
180 | 608 | def getSignedPath(self, loader_type, arch): | ||
181 | 609 | return os.path.join(self.getDistsPath(), "uefi", | ||
182 | 610 | "%s-%s" % (loader_type, arch)) | ||
183 | 611 | |||
184 | 612 | def process(self): | ||
185 | 613 | self.archive.close() | ||
186 | 614 | self.buffer.close() | ||
187 | 615 | upload = UefiUpload() | ||
188 | 616 | upload.signUefi = FakeMethod() | ||
189 | 617 | upload.signKmod = FakeMethod() | ||
190 | 618 | # Under no circumstances is it safe to execute actual commands. | ||
191 | 619 | fake_call = FakeMethod(result=0) | ||
192 | 620 | self.useFixture(MonkeyPatch("subprocess.call", fake_call)) | ||
193 | 621 | upload.process(self.pubconf, self.path, self.suite) | ||
194 | 622 | self.assertEqual(0, fake_call.call_count) | ||
195 | 623 | |||
196 | 624 | return upload | ||
197 | 625 | |||
198 | 626 | def test_installed(self): | ||
199 | 627 | # Files in the tarball are installed correctly. | ||
200 | 628 | self.setUpUefiKeys() | ||
201 | 629 | self.openArchive("test", "1.0", "amd64") | ||
202 | 630 | self.archive.add_file("1.0/empty.efi", "") | ||
203 | 631 | self.process() | ||
204 | 632 | self.assertTrue(os.path.isdir(os.path.join( | ||
205 | 633 | self.getDistsPath(), "uefi"))) | ||
206 | 634 | self.assertTrue(os.path.exists(os.path.join( | ||
207 | 635 | self.getSignedPath("test", "amd64"), "1.0", "empty.efi"))) | ||
208 | 602 | 636 | ||
209 | === modified file 'lib/lp/archiveuploader/nascentuploadfile.py' | |||
210 | --- lib/lp/archiveuploader/nascentuploadfile.py 2016-05-06 09:16:30 +0000 | |||
211 | +++ lib/lp/archiveuploader/nascentuploadfile.py 2016-05-31 12:46:39 +0000 | |||
212 | @@ -33,7 +33,10 @@ | |||
213 | 33 | from lp.archivepublisher.debian_installer import DebianInstallerUpload | 33 | from lp.archivepublisher.debian_installer import DebianInstallerUpload |
214 | 34 | from lp.archivepublisher.dist_upgrader import DistUpgraderUpload | 34 | from lp.archivepublisher.dist_upgrader import DistUpgraderUpload |
215 | 35 | from lp.archivepublisher.rosetta_translations import RosettaTranslationsUpload | 35 | from lp.archivepublisher.rosetta_translations import RosettaTranslationsUpload |
217 | 36 | from lp.archivepublisher.signing import SigningUpload | 36 | from lp.archivepublisher.signing import ( |
218 | 37 | SigningUpload, | ||
219 | 38 | UefiUpload, | ||
220 | 39 | ) | ||
221 | 37 | from lp.archiveuploader.utils import ( | 40 | from lp.archiveuploader.utils import ( |
222 | 38 | determine_source_file_type, | 41 | determine_source_file_type, |
223 | 39 | prefix_multi_line_string, | 42 | prefix_multi_line_string, |
224 | @@ -258,8 +261,8 @@ | |||
225 | 258 | PackageUploadCustomFormat.STATIC_TRANSLATIONS, | 261 | PackageUploadCustomFormat.STATIC_TRANSLATIONS, |
226 | 259 | 'raw-meta-data': | 262 | 'raw-meta-data': |
227 | 260 | PackageUploadCustomFormat.META_DATA, | 263 | PackageUploadCustomFormat.META_DATA, |
228 | 264 | 'raw-uefi': PackageUploadCustomFormat.UEFI, | ||
229 | 261 | 'raw-signing': PackageUploadCustomFormat.SIGNING, | 265 | 'raw-signing': PackageUploadCustomFormat.SIGNING, |
230 | 262 | 'raw-uefi': PackageUploadCustomFormat.SIGNING, # Compatibility | ||
231 | 263 | } | 266 | } |
232 | 264 | 267 | ||
233 | 265 | custom_handlers = { | 268 | custom_handlers = { |
234 | @@ -268,6 +271,7 @@ | |||
235 | 268 | PackageUploadCustomFormat.DDTP_TARBALL: DdtpTarballUpload, | 271 | PackageUploadCustomFormat.DDTP_TARBALL: DdtpTarballUpload, |
236 | 269 | PackageUploadCustomFormat.ROSETTA_TRANSLATIONS: | 272 | PackageUploadCustomFormat.ROSETTA_TRANSLATIONS: |
237 | 270 | RosettaTranslationsUpload, | 273 | RosettaTranslationsUpload, |
238 | 274 | PackageUploadCustomFormat.UEFI: UefiUpload, | ||
239 | 271 | PackageUploadCustomFormat.SIGNING: SigningUpload, | 275 | PackageUploadCustomFormat.SIGNING: SigningUpload, |
240 | 272 | } | 276 | } |
241 | 273 | 277 | ||
242 | @@ -309,7 +313,8 @@ | |||
243 | 309 | """Return whether this custom upload can be automatically approved.""" | 313 | """Return whether this custom upload can be automatically approved.""" |
244 | 310 | # Signing uploads will be signed, and must therefore be approved | 314 | # Signing uploads will be signed, and must therefore be approved |
245 | 311 | # by a human. | 315 | # by a human. |
247 | 312 | if self.custom_type == PackageUploadCustomFormat.SIGNING: | 316 | if self.custom_type in (PackageUploadCustomFormat.UEFI, |
248 | 317 | PackageUploadCustomFormat.SIGNING): | ||
249 | 313 | return False | 318 | return False |
250 | 314 | return True | 319 | return True |
251 | 315 | 320 | ||
252 | 316 | 321 | ||
253 | === modified file 'lib/lp/soyuz/browser/queue.py' | |||
254 | --- lib/lp/soyuz/browser/queue.py 2016-05-09 18:07:49 +0000 | |||
255 | +++ lib/lp/soyuz/browser/queue.py 2016-05-31 12:46:39 +0000 | |||
256 | @@ -574,6 +574,7 @@ | |||
257 | 574 | (self.contains_installer, ("Installer", 'ubuntu-icon')), | 574 | (self.contains_installer, ("Installer", 'ubuntu-icon')), |
258 | 575 | (self.contains_upgrader, ("Upgrader", 'ubuntu-icon')), | 575 | (self.contains_upgrader, ("Upgrader", 'ubuntu-icon')), |
259 | 576 | (self.contains_ddtp, (ddtp, 'ubuntu-icon')), | 576 | (self.contains_ddtp, (ddtp, 'ubuntu-icon')), |
260 | 577 | (self.contains_uefi, ("UEFI Objects for Signing", 'ubuntu-icon')), | ||
261 | 577 | (self.contains_signing, ("Objects for Signing", 'ubuntu-icon')), | 578 | (self.contains_signing, ("Objects for Signing", 'ubuntu-icon')), |
262 | 578 | ] | 579 | ] |
263 | 579 | return [ | 580 | return [ |
264 | 580 | 581 | ||
265 | === modified file 'lib/lp/soyuz/enums.py' | |||
266 | --- lib/lp/soyuz/enums.py 2016-05-03 14:44:33 +0000 | |||
267 | +++ lib/lp/soyuz/enums.py 2016-05-31 12:46:39 +0000 | |||
268 | @@ -481,7 +481,13 @@ | |||
269 | 481 | the Software Center. | 481 | the Software Center. |
270 | 482 | """) | 482 | """) |
271 | 483 | 483 | ||
273 | 484 | SIGNING = DBItem(6, """ | 484 | UEFI = DBItem(6, """ |
274 | 485 | uefi | ||
275 | 486 | |||
276 | 487 | A tarball containing EFI images to be signed. | ||
277 | 488 | """) | ||
278 | 489 | |||
279 | 490 | SIGNING = DBItem(7, """ | ||
280 | 485 | signing | 491 | signing |
281 | 486 | 492 | ||
282 | 487 | A tarball containing images to be signed. | 493 | A tarball containing images to be signed. |
283 | 488 | 494 | ||
284 | === modified file 'lib/lp/soyuz/model/queue.py' | |||
285 | --- lib/lp/soyuz/model/queue.py 2016-05-23 11:18:16 +0000 | |||
286 | +++ lib/lp/soyuz/model/queue.py 2016-05-31 12:46:39 +0000 | |||
287 | @@ -654,12 +654,15 @@ | |||
288 | 654 | return PackageUploadCustomFormat.DDTP_TARBALL in self._customFormats | 654 | return PackageUploadCustomFormat.DDTP_TARBALL in self._customFormats |
289 | 655 | 655 | ||
290 | 656 | @cachedproperty | 656 | @cachedproperty |
291 | 657 | def contains_uefi(self): | ||
292 | 658 | """See `IPackageUpload`.""" | ||
293 | 659 | return PackageUploadCustomFormat.UEFI in self._customFormats | ||
294 | 660 | |||
295 | 661 | @cachedproperty | ||
296 | 657 | def contains_signing(self): | 662 | def contains_signing(self): |
297 | 658 | """See `IPackageUpload`.""" | 663 | """See `IPackageUpload`.""" |
298 | 659 | return PackageUploadCustomFormat.SIGNING in self._customFormats | 664 | return PackageUploadCustomFormat.SIGNING in self._customFormats |
299 | 660 | 665 | ||
300 | 661 | contains_uefi = contains_signing | ||
301 | 662 | |||
302 | 663 | @property | 666 | @property |
303 | 664 | def package_name(self): | 667 | def package_name(self): |
304 | 665 | """See `IPackageUpload`.""" | 668 | """See `IPackageUpload`.""" |
305 | 666 | 669 | ||
306 | === modified file 'lib/lp/soyuz/scripts/custom_uploads_copier.py' | |||
307 | --- lib/lp/soyuz/scripts/custom_uploads_copier.py 2016-05-06 09:16:30 +0000 | |||
308 | +++ lib/lp/soyuz/scripts/custom_uploads_copier.py 2016-05-31 12:46:39 +0000 | |||
309 | @@ -18,7 +18,10 @@ | |||
310 | 18 | from lp.archivepublisher.debian_installer import DebianInstallerUpload | 18 | from lp.archivepublisher.debian_installer import DebianInstallerUpload |
311 | 19 | from lp.archivepublisher.dist_upgrader import DistUpgraderUpload | 19 | from lp.archivepublisher.dist_upgrader import DistUpgraderUpload |
312 | 20 | from lp.archivepublisher.rosetta_translations import RosettaTranslationsUpload | 20 | from lp.archivepublisher.rosetta_translations import RosettaTranslationsUpload |
314 | 21 | from lp.archivepublisher.signing import SigningUpload | 21 | from lp.archivepublisher.signing import ( |
315 | 22 | SigningUpload, | ||
316 | 23 | UefiUpload, | ||
317 | 24 | ) | ||
318 | 22 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 25 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
319 | 23 | from lp.services.database.bulk import load_referencing | 26 | from lp.services.database.bulk import load_referencing |
320 | 24 | from lp.soyuz.enums import PackageUploadCustomFormat | 27 | from lp.soyuz.enums import PackageUploadCustomFormat |
321 | @@ -40,6 +43,7 @@ | |||
322 | 40 | PackageUploadCustomFormat.DDTP_TARBALL: DdtpTarballUpload, | 43 | PackageUploadCustomFormat.DDTP_TARBALL: DdtpTarballUpload, |
323 | 41 | PackageUploadCustomFormat.ROSETTA_TRANSLATIONS: | 44 | PackageUploadCustomFormat.ROSETTA_TRANSLATIONS: |
324 | 42 | RosettaTranslationsUpload, | 45 | RosettaTranslationsUpload, |
325 | 46 | PackageUploadCustomFormat.UEFI: UefiUpload, | ||
326 | 43 | PackageUploadCustomFormat.SIGNING: SigningUpload, | 47 | PackageUploadCustomFormat.SIGNING: SigningUpload, |
327 | 44 | } | 48 | } |
328 | 45 | 49 | ||
329 | @@ -63,7 +67,8 @@ | |||
330 | 63 | return True | 67 | return True |
331 | 64 | # Signing uploads will be signed, and must therefore be approved | 68 | # Signing uploads will be signed, and must therefore be approved |
332 | 65 | # by a human. | 69 | # by a human. |
334 | 66 | if custom.customformat == PackageUploadCustomFormat.SIGNING: | 70 | if custom.customformat in (PackageUploadCustomFormat.UEFI, |
335 | 71 | PackageUploadCustomFormat.SIGNING): | ||
336 | 67 | return False | 72 | return False |
337 | 68 | return True | 73 | return True |
338 | 69 | 74 | ||
339 | 70 | 75 | ||
340 | === modified file 'lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py' | |||
341 | --- lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py 2016-05-06 09:16:30 +0000 | |||
342 | +++ lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py 2016-05-31 12:46:39 +0000 | |||
343 | @@ -409,7 +409,7 @@ | |||
344 | 409 | self.assertEqual(PackageUploadStatus.ACCEPTED, copied_pu.status) | 409 | self.assertEqual(PackageUploadStatus.ACCEPTED, copied_pu.status) |
345 | 410 | 410 | ||
346 | 411 | def test_copyUpload_unapproves_signing_from_different_archive(self): | 411 | def test_copyUpload_unapproves_signing_from_different_archive(self): |
348 | 412 | # Copies of UEFI custom uploads to a primary archive are set to | 412 | # Copies of signing custom uploads to a primary archive are set to |
349 | 413 | # UNAPPROVED, since they will normally end up being signed. | 413 | # UNAPPROVED, since they will normally end up being signed. |
350 | 414 | target_series = self.factory.makeDistroSeries() | 414 | target_series = self.factory.makeDistroSeries() |
351 | 415 | archive = self.factory.makeArchive( | 415 | archive = self.factory.makeArchive( |
352 | @@ -422,22 +422,60 @@ | |||
353 | 422 | self.assertEqual(PackageUploadStatus.UNAPPROVED, copied_pu.status) | 422 | self.assertEqual(PackageUploadStatus.UNAPPROVED, copied_pu.status) |
354 | 423 | 423 | ||
355 | 424 | def test_copyUpload_approves_signing_from_same_archive(self): | 424 | def test_copyUpload_approves_signing_from_same_archive(self): |
356 | 425 | # Copies of signing custom uploads within the same archive are | ||
357 | 426 | # automatically accepted, since they have already been signed. | ||
358 | 427 | original_upload = self.makeUpload( | ||
359 | 428 | custom_type=PackageUploadCustomFormat.SIGNING) | ||
360 | 429 | target_series = self.factory.makeDistroSeries() | ||
361 | 430 | copier = CustomUploadsCopier(target_series) | ||
362 | 431 | copied_pu = copier.copyUpload(original_upload).packageupload | ||
363 | 432 | self.assertEqual(PackageUploadStatus.ACCEPTED, copied_pu.status) | ||
364 | 433 | |||
365 | 434 | def test_copyUpload_approves_signing_to_ppa(self): | ||
366 | 435 | # Copies of signing custom uploads to a PPA are automatically accepted, | ||
367 | 436 | # since PPAs have much more limited upload permissions than the main | ||
368 | 437 | # archive, and in any case PPAs do not have an upload approval | ||
369 | 438 | # workflow. | ||
370 | 439 | original_upload = self.makeUpload( | ||
371 | 440 | custom_type=PackageUploadCustomFormat.SIGNING) | ||
372 | 441 | target_series = self.factory.makeDistroSeries() | ||
373 | 442 | target_archive = self.factory.makeArchive( | ||
374 | 443 | distribution=target_series.distribution) | ||
375 | 444 | copier = CustomUploadsCopier( | ||
376 | 445 | target_series, target_archive=target_archive) | ||
377 | 446 | copied_pu = copier.copyUpload(original_upload).packageupload | ||
378 | 447 | self.assertEqual(PackageUploadStatus.ACCEPTED, copied_pu.status) | ||
379 | 448 | |||
380 | 449 | def test_copyUpload_unapproves_uefi_from_different_archive(self): | ||
381 | 450 | # Copies of UEFI custom uploads to a primary archive are set to | ||
382 | 451 | # UNAPPROVED, since they will normally end up being signed. | ||
383 | 452 | target_series = self.factory.makeDistroSeries() | ||
384 | 453 | archive = self.factory.makeArchive( | ||
385 | 454 | distribution=target_series.distribution) | ||
386 | 455 | original_upload = self.makeUpload( | ||
387 | 456 | archive=archive, custom_type=PackageUploadCustomFormat.UEFI) | ||
388 | 457 | copier = CustomUploadsCopier( | ||
389 | 458 | target_series, target_archive=target_series.main_archive) | ||
390 | 459 | copied_pu = copier.copyUpload(original_upload).packageupload | ||
391 | 460 | self.assertEqual(PackageUploadStatus.UNAPPROVED, copied_pu.status) | ||
392 | 461 | |||
393 | 462 | def test_copyUpload_approves_uefi_from_same_archive(self): | ||
394 | 425 | # Copies of UEFI custom uploads within the same archive are | 463 | # Copies of UEFI custom uploads within the same archive are |
395 | 426 | # automatically accepted, since they have already been signed. | 464 | # automatically accepted, since they have already been signed. |
396 | 427 | original_upload = self.makeUpload( | 465 | original_upload = self.makeUpload( |
398 | 428 | custom_type=PackageUploadCustomFormat.SIGNING) | 466 | custom_type=PackageUploadCustomFormat.UEFI) |
399 | 429 | target_series = self.factory.makeDistroSeries() | 467 | target_series = self.factory.makeDistroSeries() |
400 | 430 | copier = CustomUploadsCopier(target_series) | 468 | copier = CustomUploadsCopier(target_series) |
401 | 431 | copied_pu = copier.copyUpload(original_upload).packageupload | 469 | copied_pu = copier.copyUpload(original_upload).packageupload |
402 | 432 | self.assertEqual(PackageUploadStatus.ACCEPTED, copied_pu.status) | 470 | self.assertEqual(PackageUploadStatus.ACCEPTED, copied_pu.status) |
403 | 433 | 471 | ||
405 | 434 | def test_copyUpload_approves_signing_to_ppa(self): | 472 | def test_copyUpload_approves_uefi_to_ppa(self): |
406 | 435 | # Copies of UEFI custom uploads to a PPA are automatically accepted, | 473 | # Copies of UEFI custom uploads to a PPA are automatically accepted, |
407 | 436 | # since PPAs have much more limited upload permissions than the main | 474 | # since PPAs have much more limited upload permissions than the main |
408 | 437 | # archive, and in any case PPAs do not have an upload approval | 475 | # archive, and in any case PPAs do not have an upload approval |
409 | 438 | # workflow. | 476 | # workflow. |
410 | 439 | original_upload = self.makeUpload( | 477 | original_upload = self.makeUpload( |
412 | 440 | custom_type=PackageUploadCustomFormat.SIGNING) | 478 | custom_type=PackageUploadCustomFormat.UEFI) |
413 | 441 | target_series = self.factory.makeDistroSeries() | 479 | target_series = self.factory.makeDistroSeries() |
414 | 442 | target_archive = self.factory.makeArchive( | 480 | target_archive = self.factory.makeArchive( |
415 | 443 | distribution=target_series.distribution) | 481 | distribution=target_series.distribution) |
Changes as requested pushed to the branch. Thanks for your reviews.