Merge lp:~apw/ubuntu-archive-tools/copy-proposed-kernel--support-lrg-lrs into lp:ubuntu-archive-tools

Proposed by Andy Whitcroft
Status: Merged
Merged at revision: 1462
Proposed branch: lp:~apw/ubuntu-archive-tools/copy-proposed-kernel--support-lrg-lrs
Merge into: lp:ubuntu-archive-tools
Diff against target: 533 lines (+239/-72)
1 file modified
copy-proposed-kernel (+239/-72)
To merge this branch: bzr merge lp:~apw/ubuntu-archive-tools/copy-proposed-kernel--support-lrg-lrs
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Review via email: mp+399495@code.launchpad.net

Commit message

Add support for the new linux-restricted-generate/linux-restricted-signatures workflow.

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Generally looks good. A whitespace comment inline, but that's not really important.

One thing I just would like to make sure is intended: from the commit messages I understood that we do not want to allow unembargoing only for selected, safe places. But this can be overriden via the --unembargo argument, right? So it's like a hard override, skipping over all checks, right?

review: Approve
Revision history for this message
Andy Whitcroft (apw) wrote :

> Generally looks good. A whitespace comment inline, but that's not really
> important.
>
> One thing I just would like to make sure is intended: from the commit messages
> I understood that we do not want to allow unembargoing only for selected, safe
> places. But this can be overriden via the --unembargo argument, right? So it's
> like a hard override, skipping over all checks, right?

Right, the automated enablement of --embargo is only for safe source/destination pairs. --embargo on the command line is intended to be a "Look just to what I need there is fire" override.

1464. By Andy Whitcroft

copy-proposed-kernel: clean up whitespace

Clean up whitespace based on review feedback.

Signed-off-by: Andy Whitcroft <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'copy-proposed-kernel'
--- copy-proposed-kernel 2021-03-10 10:13:48 +0000
+++ copy-proposed-kernel 2021-03-11 17:44:33 +0000
@@ -42,14 +42,14 @@
42 self.series = None42 self.series = None
43 self.source = None43 self.source = None
44 self.ppa2 = False44 self.ppa2 = False
45 self.security = False45 self.security = None
46 self.security2 = False
47 self.esm = False46 self.esm = False
48 self.fips = False47 self.fips = False
49 self.ibmgt = False48 self.ibmgt = False
50 self.to_signing = False49 self.to_signing = False
51 self.from_signing = False50 self.from_signing = False
52 self.no_auto = False51 self.no_auto = False
52 self.unembargo = False
5353
54 self.update(**kwargs)54 self.update(**kwargs)
5555
@@ -81,6 +81,25 @@
81 - ['ppa:canonical-kernel-team/ubuntu/ppa', 'Release' ]81 - ['ppa:canonical-kernel-team/ubuntu/ppa', 'Release' ]
82 proposed:82 proposed:
83 - ['ubuntu', 'Proposed' ]83 - ['ubuntu', 'Proposed' ]
84 drivers:
85 security-build:
86 - ['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release' ]
87 - ['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release' ]
88 build:
89 - ['ppa:canonical-kernel-team/ubuntu/ppa', 'Release' ]
90 build-private:
91 - ['ppa:canonical-kernel-team/ubuntu/ppa-ps', 'Release' ]
92 signing:
93 - ['ppa:canonical-signing/ubuntu/primary', 'Release']
94 proposed:
95 - ['ubuntu', 'Proposed' ]
96 drivers-contrived: # build-private but no signing is invalid
97 build:
98 - ['ppa:canonical-kernel-team/ubuntu/ppa', 'Release' ]
99 build-private:
100 - ['ppa:canonical-kernel-team/ubuntu/ppa-ps', 'Release' ]
101 proposed:
102 - ['ubuntu', 'Proposed' ]
84 esm:103 esm:
85 security-build:104 security-build:
86 - ['ppa:canonical-kernel-security-team/ubuntu/esm', 'Release']105 - ['ppa:canonical-kernel-security-team/ubuntu/esm', 'Release']
@@ -90,6 +109,17 @@
90 - ['ppa:canonical-signing/ubuntu/esm', 'Release']109 - ['ppa:canonical-signing/ubuntu/esm', 'Release']
91 proposed:110 proposed:
92 - ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release']111 - ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release']
112 uc20:
113 security-build:
114 - ['ppa:canonical-kernel-security-team/ubuntu/uc20', 'Release']
115 - ['ppa:canonical-kernel-security-team/ubuntu/uc20-2', 'Release']
116 - ['ppa:canonical-kernel-security-team/ubuntu/uc20-3', 'Release']
117 build:
118 - ['ppa:canonical-kernel-team/ubuntu/uc20-build', 'Release']
119 signing:
120 - ['ppa:canonical-signing/ubuntu/uc20', 'Release']
121 proposed:
122 - ['ppa:canonical-kernel-team/ubuntu/uc20-staging', 'Release']
93 14.04:123 14.04:
94 codename: trusty124 codename: trusty
95 supported: true125 supported: true
@@ -134,6 +164,8 @@
134 type: signed164 type: signed
135 linux-meta:165 linux-meta:
136 type: meta166 type: meta
167 linux-restricted-modules:
168 type: lrm
137 linux-ibm-gt:169 linux-ibm-gt:
138 routing:170 routing:
139 security-build:171 security-build:
@@ -141,65 +173,182 @@
141 - ['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release']173 - ['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release']
142 build:174 build:
143 - ['ppa:ibm-cloud/ubuntu/build', 'Release']175 - ['ppa:ibm-cloud/ubuntu/build', 'Release']
176 signing:
177 - ['ppa:canonical-signing/ubuntu/ibm-gt', 'Release']
144 proposed:178 proposed:
145 - ['ppa:ibm-cloud/ubuntu/proposed', 'Release']179 - ['ppa:ibm-cloud/ubuntu/proposed', 'Release']
146 packages:180 packages:
147 linux-ibm-gt:181 linux-ibm-gt:
148 linux-meta-ibm-gt:182 linux-meta-ibm-gt:
149 type: meta183 type: meta
184 20.04:
185 codename: focal
186 supported: true
187 sources:
188 linux:
189 routing: drivers
190 packages:
191 linux:
192 linux-signed:
193 type: signed
194 linux-meta:
195 type: meta
196 linux-restricted-modules:
197 type: lrm
198 linux-restricted-generate:
199 type: lrg
200 linux-restricted-signatures:
201 type: lrs
202 linux-contrived:
203 routing: drivers-contrived
204 packages:
205 linux-contrived:
206 linux-restricted-generate-contrived:
207 type: lrg
208 linux-uc20-efi:
209 routing: uc20
210 packages:
211 linux-uc20-efi:
212 linux-signed-uc20-efi:
213 type: signed
150 """214 """
151 cls.ks = KernelSeries(data=data)215 cls.ks = KernelSeries(data=data)
152216
153217
154class TestRouting(TestBase):218class TestRouting(TestBase):
155 def test_default(self):219 def test_default(self):
156 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], ['ubuntu', 'Proposed'], False)220 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], ['ubuntu', 'Proposed'], False, True)
157 result = routing(self.FakeArgs(series='bionic', source='linux'), self.ks)221 result = routing(self.FakeArgs(series='bionic', source='linux'), self.ks)
158 self.assertEqual(expected, result)222 self.assertEqual(expected, result)
159223
160 def test_security(self):224 def test_security(self):
161 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release'], ['ubuntu', 'Proposed'], True)225 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release'], ['ubuntu', 'Proposed'], True, True)
162 result = routing(self.FakeArgs(series='bionic', source='linux', security=True), self.ks)226 result = routing(self.FakeArgs(series='bionic', source='linux', security=1), self.ks)
163 self.assertEqual(expected, result)227 self.assertEqual(expected, result)
164228
165 def test_security2(self):229 def test_security2(self):
166 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release'], ['ubuntu', 'Proposed'], True)230 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release'], ['ubuntu', 'Proposed'], True, True)
167 result = routing(self.FakeArgs(series='bionic', source='linux', security2=True), self.ks)231 result = routing(self.FakeArgs(series='bionic', source='linux', security=2), self.ks)
168 self.assertEqual(expected, result)232 self.assertEqual(expected, result)
169233
170 def test_to_signing(self):234 def test_to_signing(self):
171 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], None, False)235 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], None, False, True)
172 result = routing(self.FakeArgs(series='bionic', source='linux', to_signing=True), self.ks)236 result = routing(self.FakeArgs(series='bionic', source='linux', to_signing=True), self.ks)
173 self.assertEqual(expected, result)237 self.assertEqual(expected, result)
174238
175 def test_from_signing(self):239 def test_from_signing_no_signing(self):
176 expected = (None, ['ubuntu', 'Proposed'], False)240 # No signing present ... this should fail elsewhere, but confirm it would not
241 # allow unembargo.
242 expected = (None, ['ubuntu', 'Proposed'], False, True)
177 result = routing(self.FakeArgs(series='bionic', source='linux', from_signing=True), self.ks)243 result = routing(self.FakeArgs(series='bionic', source='linux', from_signing=True), self.ks)
178 self.assertEqual(expected, result)244 self.assertEqual(expected, result)
179245
246 def test_from_signing_to_main(self):
247 expected = (['ppa:canonical-signing/ubuntu/primary', 'Release'], ['ubuntu', 'Proposed'], True, True)
248 result = routing(self.FakeArgs(series='focal', source='linux', from_signing=True), self.ks)
249 self.assertEqual(expected, result)
250
251 def test_from_signing_to_uc20(self):
252 expected = (['ppa:canonical-signing/ubuntu/uc20', 'Release'], ['ppa:canonical-kernel-team/ubuntu/uc20-staging', 'Release'], True, True)
253 result = routing(self.FakeArgs(series='focal', source='linux-uc20-efi', from_signing=True), self.ks)
254 self.assertEqual(expected, result)
255
256 def test_from_signing_to_private(self):
257 expected = (['ppa:canonical-signing/ubuntu/ibm-gt', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False, True)
258 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt', from_signing=True), self.ks)
259 self.assertEqual(expected, result)
260
261 def test_binaries_from_build_to_proposed(self):
262 for package, binaries in (
263 ('linux', True),
264 ('linux-signed', False),
265 ('linux-meta', True),
266 ('linux-restricted-modules', True),
267 ):
268 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], ['ubuntu', 'Proposed'], False, binaries)
269 result = routing(self.FakeArgs(series='bionic', source=package), self.ks)
270 self.assertEqual(expected, result)
271
272 def test_binaries_from_build_to_signing(self):
273 for package, binaries in (
274 ('linux', True),
275 ('linux-signed', False),
276 ('linux-meta', True),
277 ('linux-restricted-modules', True),
278 ):
279 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/primary', 'Release'], False, binaries)
280 result = routing(self.FakeArgs(series='focal', source=package), self.ks)
281 self.assertEqual(expected, result)
282 for package, binaries in (
283 ('linux-restricted-generate', True),
284 ('linux-restricted-signatures', False),
285 ):
286 expected = (['ppa:canonical-kernel-team/ubuntu/ppa-ps', 'Release'], ['ppa:canonical-signing/ubuntu/primary', 'Release'], False, binaries)
287 result = routing(self.FakeArgs(series='focal', source=package), self.ks)
288 self.assertEqual(expected, result)
289
290 def test_binaries_from_build_to_signing(self):
291 for package, binaries in (
292 ('linux', True),
293 ('linux-signed', False),
294 ('linux-meta', True),
295 ('linux-restricted-modules', True),
296 ):
297 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/primary', 'Release'], False, binaries)
298 result = routing(self.FakeArgs(series='focal', source=package), self.ks)
299 self.assertEqual(expected, result)
300 for package, binaries in (
301 ('linux-restricted-generate', True),
302 ('linux-restricted-signatures', False),
303 ):
304 expected = (['ppa:canonical-kernel-team/ubuntu/ppa-ps', 'Release'], ['ppa:canonical-signing/ubuntu/primary', 'Release'], False, binaries)
305 result = routing(self.FakeArgs(series='focal', source=package), self.ks)
306 self.assertEqual(expected, result)
307
308 def test_binaries_from_signing_to_proposed(self):
309 for package, binaries in (
310 ('linux', True),
311 ('linux-signed', True),
312 ('linux-meta', True),
313 ('linux-restricted-modules', True),
314 ('linux-restricted-signatures', True),
315 ):
316 expected = (['ppa:canonical-signing/ubuntu/primary', 'Release'], ['ubuntu', 'Proposed'], True, binaries)
317 result = routing(self.FakeArgs(series='focal', source=package, from_signing=True), self.ks)
318 self.assertEqual(expected, result)
319 # LRG should not go anywhere but signing.
320 self.assertRaises(RoutingError, routing, self.FakeArgs(series='focal', source='linux-restricted-generate', from_signing=True), self.ks)
321
322 def test_binaries_from_build_to_proposed_lrg(self):
323 expected = (['ppa:canonical-kernel-team/ubuntu/ppa', 'Release'], ['ubuntu', 'Proposed'], False, True)
324 result = routing(self.FakeArgs(series='focal', source='linux-contrived'), self.ks)
325 self.assertEqual(expected, result)
326 # LRG should not go anywhere but signing.
327 self.assertRaises(RoutingError, routing, self.FakeArgs(series='focal', source='linux-restricted-generate-contrived'), self.ks)
328
180 def test_esm(self):329 def test_esm(self):
181 expected = (['ppa:canonical-kernel-esm/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/esm', 'Release'], False)330 expected = (['ppa:canonical-kernel-esm/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/esm', 'Release'], False, True)
182 result = routing(self.FakeArgs(series='trusty', source='linux'), self.ks)331 result = routing(self.FakeArgs(series='trusty', source='linux'), self.ks)
183 self.assertEqual(expected, result)332 self.assertEqual(expected, result)
184333
185 def test_esm_security(self):334 def test_esm_security(self):
186 expected = (['ppa:canonical-kernel-security-team/ubuntu/esm', 'Release'], ['ppa:canonical-signing/ubuntu/esm', 'Release'], False)335 expected = (['ppa:canonical-kernel-security-team/ubuntu/esm', 'Release'], ['ppa:canonical-signing/ubuntu/esm', 'Release'], False, True)
187 result = routing(self.FakeArgs(series='trusty', source='linux', security=True), self.ks)336 result = routing(self.FakeArgs(series='trusty', source='linux', security=1), self.ks)
188 self.assertEqual(expected, result)337 self.assertEqual(expected, result)
189338
190 def test_esm_security2(self):339 def test_esm_security2(self):
191 with self.assertRaises(SystemExit), self.capture() as (out, err):340 with self.assertRaises(SystemExit), self.capture() as (out, err):
192 expected = (None, ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release'], False)341 expected = (None, ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release'], False, True)
193 result = routing(self.FakeArgs(series='trusty', source='linux', security2=True), self.ks)342 result = routing(self.FakeArgs(series='trusty', source='linux', security=2), self.ks)
194 self.assertEqual(expected, result)343 self.assertEqual(expected, result)
195344
196 def test_esm_to_signing(self):345 def test_esm_to_signing(self):
197 expected = (['ppa:canonical-kernel-esm/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/esm', 'Release'], False)346 expected = (['ppa:canonical-kernel-esm/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/esm', 'Release'], False, True)
198 result = routing(self.FakeArgs(series='trusty', source='linux', esm=True, to_signing=True), self.ks)347 result = routing(self.FakeArgs(series='trusty', source='linux', esm=True, to_signing=True), self.ks)
199 self.assertEqual(expected, result)348 self.assertEqual(expected, result)
200349
201 def test_esm_from_signing(self):350 def test_esm_from_signing(self):
202 expected = (['ppa:canonical-signing/ubuntu/esm', 'Release'], ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release'], False)351 expected = (['ppa:canonical-signing/ubuntu/esm', 'Release'], ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release'], False, True)
203 result = routing(self.FakeArgs(series='trusty', source='linux', esm=True, from_signing=True), self.ks)352 result = routing(self.FakeArgs(series='trusty', source='linux', esm=True, from_signing=True), self.ks)
204 self.assertEqual(expected, result)353 self.assertEqual(expected, result)
205354
@@ -208,59 +357,66 @@
208 # simple we make from_signing take presidence over to_signing. Test this357 # simple we make from_signing take presidence over to_signing. Test this
209 # is honoured correctly.358 # is honoured correctly.
210 def test_esm_from_signing_override_to_signing(self):359 def test_esm_from_signing_override_to_signing(self):
211 expected = (['ppa:canonical-signing/ubuntu/esm', 'Release'], ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release'], False)360 expected = (['ppa:canonical-signing/ubuntu/esm', 'Release'], ['ppa:canonical-kernel-esm/ubuntu/proposed', 'Release'], False, True)
212 result = routing(self.FakeArgs(series='trusty', source='linux', esm=True, to_signing=True, from_signing=True), self.ks)361 result = routing(self.FakeArgs(series='trusty', source='linux', esm=True, to_signing=True, from_signing=True), self.ks)
213 self.assertEqual(expected, result)362 self.assertEqual(expected, result)
214363
215 def test_fips(self):364 def test_fips(self):
216 expected = (['ppa:fips-cc-stig/ubuntu/fips-build', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False)365 expected = (['ppa:fips-cc-stig/ubuntu/fips-build', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False, True)
217 result = routing(self.FakeArgs(series='xenial', source='linux-fips'), self.ks)366 result = routing(self.FakeArgs(series='xenial', source='linux-fips'), self.ks)
218 self.assertEqual(expected, result)367 self.assertEqual(expected, result)
219368
220 def test_fips_security(self):369 def test_fips_security(self):
221 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False)370 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False, True)
222 result = routing(self.FakeArgs(series='xenial', source='linux-fips', security=True), self.ks)371 result = routing(self.FakeArgs(series='xenial', source='linux-fips', security=1), self.ks)
223 self.assertEqual(expected, result)372 self.assertEqual(expected, result)
224373
225 def test_fips_security2(self):374 def test_fips_security2(self):
226 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False)375 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False, True)
227 result = routing(self.FakeArgs(series='xenial', source='linux-fips', security2=True), self.ks)376 result = routing(self.FakeArgs(series='xenial', source='linux-fips', security=2), self.ks)
228 self.assertEqual(expected, result)377 self.assertEqual(expected, result)
229378
230 def test_fips_to_signing(self):379 def test_fips_to_signing(self):
231 expected = (['ppa:fips-cc-stig/ubuntu/fips-build', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False)380 expected = (['ppa:fips-cc-stig/ubuntu/fips-build', 'Release'], ['ppa:canonical-signing/ubuntu/fips', 'Release'], False, True)
232 result = routing(self.FakeArgs(series='xenial', source='linux-fips', to_signing=True), self.ks)381 result = routing(self.FakeArgs(series='xenial', source='linux-fips', to_signing=True), self.ks)
233 self.assertEqual(expected, result)382 self.assertEqual(expected, result)
234383
235 def test_fips_from_signing(self):384 def test_fips_from_signing(self):
236 expected = (['ppa:canonical-signing/ubuntu/fips', 'Release'], ['ppa:ubuntu-advantage/ubuntu/fips-proposed', 'Release'], False)385 expected = (['ppa:canonical-signing/ubuntu/fips', 'Release'], ['ppa:ubuntu-advantage/ubuntu/fips-proposed', 'Release'], False, True)
237 result = routing(self.FakeArgs(series='xenial', source='linux-fips', from_signing=True), self.ks)386 result = routing(self.FakeArgs(series='xenial', source='linux-fips', from_signing=True), self.ks)
238 self.assertEqual(expected, result)387 self.assertEqual(expected, result)
239388
240 def test_ibmgt(self):389 def test_ibmgt(self):
241 expected = (['ppa:ibm-cloud/ubuntu/build', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False)390 expected = (['ppa:ibm-cloud/ubuntu/build', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False, True)
242 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt'), self.ks)391 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt'), self.ks)
243 self.assertEqual(expected, result)392 self.assertEqual(expected, result)
244393
245 def test_ibmgt_security(self):394 def test_ibmgt_security(self):
246 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False)395 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False, True)
247 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt', security=True), self.ks)396 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt', security=1), self.ks)
248 self.assertEqual(expected, result)397 self.assertEqual(expected, result)
249398
250 def test_ibmgt_security2(self):399 def test_ibmgt_security2(self):
251 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False)400 expected = (['ppa:canonical-kernel-security-team/ubuntu/ppa2', 'Release'], ['ppa:ibm-cloud/ubuntu/proposed', 'Release'], False, True)
252 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt', security2=True), self.ks)401 result = routing(self.FakeArgs(series='bionic', source='linux-ibm-gt', security=2), self.ks)
253 self.assertEqual(expected, result)402 self.assertEqual(expected, result)
254403
255404
405class RoutingError(Exception):
406 pass
407
408
409unembargo_from_security = ['ppa:canonical-kernel-security-team/ubuntu/ppa' + v for v in ('', '2', '3')]
410unembargo_from_signing = ['ppa:canonical-signing/ubuntu/primary', 'ppa:canonical-signing/ubuntu/uc20']
411unembargo_to_ok = ['ubuntu', 'ppa:canonical-kernel-team/ubuntu/uc20-staging']
412
256def routing(args, ks):413def routing(args, ks):
257 series_name = args.series414 series_name = args.series
258 package_name = args.source415 package_name = args.source
259416
260 series = ks.lookup_series(codename=series_name)417 series = ks.lookup_series(codename=series_name)
261 if series is None:418 if series is None:
262 print("ERROR: {} -- series unknown".format(series_name))419 raise RoutingError("ERROR: {} -- series unknown".format(series_name))
263 sys.exit(1)
264420
265 package = None421 package = None
266 package_signed = None422 package_signed = None
@@ -269,43 +425,38 @@
269 for package_srch in source_srch.packages:425 for package_srch in source_srch.packages:
270 if package_srch.name == package_name:426 if package_srch.name == package_name:
271 package = package_srch427 package = package_srch
272 if package_srch.type == 'signed':428 # XXX: this should be package_srch.signing
429 if package_srch.type in ('signed', 'lrs'):
273 package_signed = package_srch430 package_signed = package_srch
274 if package is not None:431 if package is not None:
275 break432 break
276 if package is None:433 if package is None:
277 print("ERROR: {}/{} -- package unknown".format(series_name, package_name))434 raise RoutingError("ERROR: {}/{} -- package unknown".format(series_name, package_name))
278 sys.exit(1)
279435
280 source = package.source436 source = package.source
281 routing = source.routing437 routing = source.routing
282 if routing is None:438 if routing is None:
283 print("ERROR: {}/{} -- package has no routing".format(series_name, package_name))439 raise RoutingError("ERROR: {}/{} -- package has no routing".format(series_name, package_name))
284 sys.exit(1)
285440
286 build_archives = routing.lookup_destination('build')441 # XXX: this should be package_srch.adjunct
442 if package.type in ('lrg', 'lrs'):
443 build_archives = routing.lookup_destination('build-private')
444 else:
445 build_archives = routing.lookup_destination('build')
287 security_archives = routing.lookup_destination('security-build')446 security_archives = routing.lookup_destination('security-build')
288 proposed_archive = routing.lookup_destination('proposed', primary=True)447 proposed_archive = routing.lookup_destination('proposed', primary=True)
289 signing_archive = routing.lookup_destination('signing', primary=True)448 signing_archive = routing.lookup_destination('signing', primary=True)
290449
291 if build_archives is None or len(build_archives) < 1:450 if build_archives is None or len(build_archives) < 1:
292 print("ERROR: {}/{} -- package has no primary build archive".format(series_name, package_name))451 raise RoutingError("ERROR: {}/{} -- package has no primary build archive".format(series_name, package_name))
293 sys.exit(1)
294 if args.ppa2 and (build_archives is None or len(build_archives) < 2):452 if args.ppa2 and (build_archives is None or len(build_archives) < 2):
295 print("ERROR: {}/{} -- package has no secondary build archive".format(series_name, package_name))453 raise RoutingError("ERROR: {}/{} -- package has no secondary build archive".format(series_name, package_name))
296 sys.exit(1)
297 if build_archives is None:454 if build_archives is None:
298 print("ERROR: {}/{} -- package has no build archive".format(series_name, package_name))455 raise RoutingError("ERROR: {}/{} -- package has no build archive".format(series_name, package_name))
299 sys.exit(1)
300 if proposed_archive is None:456 if proposed_archive is None:
301 print("ERROR: {}/{} -- package has no proposed archive".format(series_name, package_name))457 RoutingError("ERROR: {}/{} -- package has no proposed archive".format(series_name, package_name))
302 sys.exit(1)458 if args.security and (security_archives is None or len(security_archives) < args.security):
303 if args.security and (security_archives is None or len(security_archives) < 1):459 RoutingError("ERROR: {}/{} -- package has no security archive #{}".format(series_name, package_name, args.security))
304 print("ERROR: {}/{} -- package has no primary security archive".format(series_name, package_name))
305 sys.exit(1)
306 if args.security2 and (security_archives is None or len(security_archives) < 2):
307 print("ERROR: {}/{} -- package has no secondary security archive".format(series_name, package_name))
308 sys.exit(1)
309460
310 # Default route build -> proposed461 # Default route build -> proposed
311 if args.ppa2:462 if args.ppa2:
@@ -314,17 +465,9 @@
314 from_archive = build_archives[0]465 from_archive = build_archives[0]
315 to_archive = proposed_archive466 to_archive = proposed_archive
316467
317 unembargo = False
318
319 # Handle security routing.468 # Handle security routing.
320 if args.security:469 if args.security:
321 from_archive = security_archives[0]470 from_archive = security_archives[args.security - 1]
322 if args.security2:
323 from_archive = security_archives[1]
324
325 # Allow us to unembargo when releasing from security to ubuntu.
326 if (args.security or args.security2) and to_archive[0] == 'ubuntu':
327 unembargo = True
328471
329 # Handle signing routing.472 # Handle signing routing.
330 if args.from_signing:473 if args.from_signing:
@@ -335,6 +478,23 @@
335 elif args.no_auto is False and signing_archive is not None and package_signed is not None:478 elif args.no_auto is False and signing_archive is not None and package_signed is not None:
336 to_archive = signing_archive479 to_archive = signing_archive
337480
481 # Allow us to unembargo when releasing from security. Ensure the source
482 # is somewhere where we expect things which are public.
483 unembargo = args.unembargo
484 if args.security and from_archive[0] in unembargo_from_security and to_archive[0] in unembargo_to_ok:
485 unembargo = True
486 elif signing_archive and args.from_signing and from_archive[0] in unembargo_from_signing and to_archive[0] in unembargo_to_ok:
487 unembargo = True
488
489 # We should be copying binaries for non-'signing' packages
490 # when on their way to somewhere where signing is intended.
491 binaries = True
492 # XXX: this should be package_srch.signing
493 if (package.type in ('signed', 'lrs') and
494 (to_archive == signing_archive or
495 (from_archive != signing_archive and to_archive == proposed_archive))):
496 binaries = False
497
338 # Announce the routing if needed.498 # Announce the routing if needed.
339 if (args.testing is False and (routing.name != 'default' or from_archive == signing_archive or to_archive == signing_archive)):499 if (args.testing is False and (routing.name != 'default' or from_archive == signing_archive or to_archive == signing_archive)):
340 msg = "NOTE: directing copy using {} routes".format(routing.name)500 msg = "NOTE: directing copy using {} routes".format(routing.name)
@@ -344,7 +504,12 @@
344 msg += ' to signing'504 msg += ' to signing'
345 print(msg)505 print(msg)
346506
347 return (from_archive, to_archive, unembargo)507
508 # It is only safe to copy linux-restricted-generate to signing. Refuse to copy.
509 if package.type == 'lrg' and to_archive != signing_archive:
510 raise RoutingError("ERROR: {}/{} -- package type lrg is embargoed, copy only allowed to signing".format(series_name, package_name))
511
512 return (from_archive, to_archive, unembargo, binaries)
348513
349514
350# SELF-TESTS:515# SELF-TESTS:
@@ -356,14 +521,16 @@
356parser.set_defaults(testing=False)521parser.set_defaults(testing=False)
357parser.add_argument('--dry-run', action='store_true', help='Do everything but actually copy the package')522parser.add_argument('--dry-run', action='store_true', help='Do everything but actually copy the package')
358parser.add_argument('--ppa2', action='store_true', help='Copy from the kernel build PPA2')523parser.add_argument('--ppa2', action='store_true', help='Copy from the kernel build PPA2')
359parser.add_argument('--security', '-S', action='store_true', help='Copy from the kernel security PPA')524parser.add_argument('--security', '-S', action='store_const', const=1, help='Copy from the kernel security PPA')
360parser.add_argument('--security2', action='store_true', help='Copy from the kernel security PPA2')525parser.add_argument('--security2', action='store_const', const=2, dest='security', help='Copy from the kernel security PPA2')
526parser.add_argument('--security3', action='store_const', const=3, dest='security', help='Copy from the kernel security PPA3')
361parser.add_argument('--esm', '-E', action='store_true', help='Copy from the kernel ESM PPA and to the kernel ESM proposed PPA')527parser.add_argument('--esm', '-E', action='store_true', help='Copy from the kernel ESM PPA and to the kernel ESM proposed PPA')
362parser.add_argument('--fips', action='store_true', help='Copy from the kernel FIPS PPA and to the kernel FIPS proposed PPA')528parser.add_argument('--fips', action='store_true', help='Copy from the kernel FIPS PPA and to the kernel FIPS proposed PPA')
363parser.add_argument('--ibmgt', action='store_true', help='Copy from the kernel IBM-GT build PPA to the corresponding proposed PPA')529parser.add_argument('--ibmgt', action='store_true', help='Copy from the kernel IBM-GT build PPA to the corresponding proposed PPA')
364parser.add_argument('--no-auto', action='store_true', help='Turn off automatic detection of ESM et al based on series')530parser.add_argument('--no-auto', action='store_true', help='Turn off automatic detection of ESM et al based on series')
365parser.add_argument('--to-signing', action='store_true', help='Copy from the kernel ESM/FIPS PPA to the ESM/FIPS signing PPA')531parser.add_argument('--to-signing', action='store_true', help='Copy from the kernel ESM/FIPS PPA to the ESM/FIPS signing PPA')
366parser.add_argument('--from-signing', action='store_true', help='Copy from the ESM/FIPS signing PPA to the ESM/FIPS proposed PPA')532parser.add_argument('--from-signing', action='store_true', help='Copy from the ESM/FIPS signing PPA to the ESM/FIPS proposed PPA')
533parser.add_argument('--unembargo', action='store_true', default=False, help='Allow copies from private PPAs')
367parser.add_argument('series', action='store', help='The series the source package is in')534parser.add_argument('series', action='store', help='The series the source package is in')
368parser.add_argument('source', action='store', nargs='+', help='The source package name')535parser.add_argument('source', action='store', nargs='+', help='The source package name')
369536
@@ -386,8 +553,12 @@
386 # BODGE: routing should just take release/pkg.553 # BODGE: routing should just take release/pkg.
387 args.source = pkg554 args.source = pkg
388555
389 (from_archive, to_archive, security) = routing(args, ks)556 try:
557 (from_archive, to_archive, unembargo, include_binaries) = routing(args, ks)
390 ##print("from_archive<{}> to_archive<{}>".format(from_archive, to_archive))558 ##print("from_archive<{}> to_archive<{}>".format(from_archive, to_archive))
559 except RoutingError as e:
560 print("ERROR: {}", e.args[0])
561 sys.exit(1)
391562
392 if from_archive is None:563 if from_archive is None:
393 print("ERROR: bad source PPA")564 print("ERROR: bad source PPA")
@@ -414,11 +585,6 @@
414 if versions.total_size == 1:585 if versions.total_size == 1:
415 version = versions[0].source_package_version586 version = versions[0].source_package_version
416587
417 include_binaries = (pkg not in ('debian-installer')
418 and not pkg.startswith('linux-signed'))
419 if args.from_signing:
420 include_binaries = True
421
422 print("""Copying {}/{}:588 print("""Copying {}/{}:
423 From: {} {} {}589 From: {} {} {}
424 To: {} {} {}590 To: {} {} {}
@@ -426,7 +592,8 @@
426592
427 if not version:593 if not version:
428 print("ERROR: no version to copy")594 print("ERROR: no version to copy")
429 sys.exit(1)595 if not args.dry_run:
596 sys.exit(1)
430597
431 copies.append({598 copies.append({
432 'from_archive': from_archive,599 'from_archive': from_archive,
@@ -436,7 +603,7 @@
436 'to_pocket': to_pocket,603 'to_pocket': to_pocket,
437 'version': version,604 'version': version,
438 'auto_approve': True,605 'auto_approve': True,
439 'unembargo': security,606 'unembargo': unembargo,
440 })607 })
441608
442if args.dry_run:609if args.dry_run:

Subscribers

People subscribed via source and target branches