Merge lp:~vorlon/ubuntu-archive-tools/sru-release-esm into lp:ubuntu-archive-tools

Proposed by Steve Langasek
Status: Merged
Merged at revision: 1100
Proposed branch: lp:~vorlon/ubuntu-archive-tools/sru-release-esm
Merge into: lp:ubuntu-archive-tools
Diff against target: 85 lines (+35/-9)
1 file modified
sru-release (+35/-9)
To merge this branch: bzr merge lp:~vorlon/ubuntu-archive-tools/sru-release-esm
Reviewer Review Type Date Requested Status
Adam Conrad (community) Approve
Review via email: mp+324132@code.launchpad.net
To post a comment you must log in.
1101. By Steve Langasek

Add an esm option to avoid hard-coding precise in the code, per Adam's feedback

Revision history for this message
Adam Conrad (adconrad) wrote :

LGTM. As mentioned on IRC, maybe we could clean up the UI a bit to actually differentiate between primary pockets and ESM PPAs when displaying source and target versions, but UI isn't ubuntu-archive-tools' strong suit.

If this isn't yet tested, I'd recommend twiddling archive names and doing some test runs to verify it works how you think it does, but +1 from me.

review: Approve
Revision history for this message
Steve Langasek (vorlon) wrote :

> If this isn't yet tested, I'd recommend twiddling archive names and doing some
> test runs to verify it works how you think it does, but +1 from me.

I verified sane output with --no-act for the ESM case, and verified that the script still works for the non-ESM case, so I consider that tested.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sru-release'
2--- sru-release 2017-05-03 10:49:03 +0000
3+++ sru-release 2017-05-16 21:06:02 +0000
4@@ -99,22 +99,32 @@
5 'published': proposed_date}
6 '''
7 versions = defaultdict(dict)
8- matches = archive.getPublishedSources(
9+ if options.esm:
10+ pocket = 'Release'
11+ else:
12+ pocket = 'Proposed'
13+
14+ matches = src_archive.getPublishedSources(
15 source_name=sourcename, exact_match=not options.pattern,
16- status='Published', pocket='Proposed', distro_series=series)
17+ status='Published', pocket=pocket, distro_series=series)
18 for match in matches:
19 # versions in all pockets
20- for pub in archive.getPublishedSources(
21+ for pub in src_archive.getPublishedSources(
22 source_name=match.source_package_name, exact_match=True,
23 status='Published', distro_series=series):
24- versions[pub.source_package_name][pub.pocket.lower()] = (
25+ key = pub.pocket.lower()
26+ # special case for ESM ppas, which don't have pockets but need
27+ # to be treated as -proposed
28+ if options.esm and key == 'release':
29+ key = 'proposed'
30+ versions[pub.source_package_name][key] = (
31 pub.source_package_version)
32- if 'Proposed' in pub.pocket:
33+ if pocket in pub.pocket:
34 versions[pub.source_package_name]['changesfile'] = (
35 pub.changesFileUrl())
36 # devel version
37 if devel_series:
38- for pub in archive.getPublishedSources(
39+ for pub in src_archive.getPublishedSources(
40 source_name=match.source_package_name, exact_match=True,
41 status='Published', distro_series=devel_series):
42 if pub.pocket in ('Release', 'Proposed'):
43@@ -148,8 +158,9 @@
44 print('Devel: %s' % versions['devel'])
45
46 copy = partial(
47- archive.copyPackage, from_archive=archive, include_binaries=True,
48- source_name=pkg, version=versions['proposed'], auto_approve=True)
49+ dst_archive.copyPackage, from_archive=src_archive,
50+ include_binaries=True, source_name=pkg,
51+ version=versions['proposed'], auto_approve=True)
52
53 if options.devel:
54 if ('devel' not in versions or
55@@ -233,6 +244,9 @@
56 parser.add_option(
57 '--exclude-bug', action='append', default=[], metavar='BUG',
58 help='Do not update BUG.')
59+ parser.add_option(
60+ '-E', '--esm', action='store_true', default=False,
61+ help='Copy from the kernel ESM proposed PPA to the ESM publication PPA')
62
63 options, args = parser.parse_args()
64
65@@ -255,7 +269,19 @@
66 sys.stderr.write(
67 'WARNING: No current development series, -d will not work\n')
68 devel_series = None
69- archive = ubuntu.getArchive(name='primary')
70+ if release == 'precise':
71+ sys.stdout.write(
72+ 'Called for precise; assuming kernel ESM publication\n')
73+ options.esm = True
74+
75+ if options.esm:
76+ options.release = True
77+ src_archive = launchpad.archives.getByReference(
78+ reference='~canonical-kernel-esm/ubuntu/proposed')
79+ dst_archive = launchpad.archives.getByReference(
80+ reference='~ubuntu-esm/ubuntu/esm')
81+ else:
82+ src_archive = dst_archive = ubuntu.getArchive(name='primary')
83
84 for package in packages:
85 release_package(options, package)

Subscribers

People subscribed via source and target branches