Merge lp:~laney/ubuntu-archive-publishing/updates into lp:ubuntu-archive-publishing

Proposed by Iain Lane
Status: Needs review
Proposed branch: lp:~laney/ubuntu-archive-publishing/updates
Merge into: lp:ubuntu-archive-publishing
Prerequisite: lp:~laney/ubuntu-archive-publishing/more-options
Diff against target: 205 lines (+65/-23)
2 files modified
lib/scripts/generate_extra_overrides.py (+21/-9)
tests/test_generate_extra_overrides.py (+44/-14)
To merge this branch: bzr merge lp:~laney/ubuntu-archive-publishing/updates
Reviewer Review Type Date Requested Status
Colin Watson Pending
Ubuntu Package Archive Administrators Pending
Review via email: mp+402698@code.launchpad.net

Description of the change

Run for -updates. I'm not really sure of all the consequences here, maybe consider this as a basis for discussion initially.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I support this change. How to best test this?

Unmerged revisions

116. By Iain Lane

generate_extra_overrides: Germinate for stable releases too

Currently we only generate for the release pocket of -devel releases.
This means that Task headers don't get updated for SRUs meaning that,
for example, it's not easily possible to add new packages to the live
seed (other seeds are OK because they get pulled in by Depends of the
metapackage).

Germinate for -updates, and for stable releases. When generating
overrides for stable releases, write overrides to -updates.

This is not a full solution. The immutable nature of release pockets
means that some things can't work properly, for example

  - dependencies of the new package which aren't in -updates won't get
    Task entries
  - *dropping* things from seeds can't work properly, at least not
    without care from consuming code to have -updates dominate release;
    a simple grep-dctrl will not do

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/scripts/generate_extra_overrides.py'
2--- lib/scripts/generate_extra_overrides.py 2021-05-13 12:49:01 +0000
3+++ lib/scripts/generate_extra_overrides.py 2021-05-13 12:49:01 +0000
4@@ -82,7 +82,12 @@
5 return [
6 series for series in distribution.series
7 if series.status in (
8- "Experimental", "Active Development", "Pre-release Freeze")]
9+ "Current Stable Release",
10+ "Supported",
11+ "Experimental",
12+ "Active Development",
13+ "Pre-release Freeze"
14+ )]
15
16
17 class GenerateExtraOverrides(ScriptBase):
18@@ -346,8 +351,8 @@
19 if "build-essential" in structure.names and primary_flavour:
20 write_overrides("build-essential", "Build-Essential", "yes")
21
22- def germinateArch(self, series_name, components, arch, flavours,
23- structures):
24+ def germinateArch(self, series_name, series_is_stable, components, arch,
25+ flavours, structures):
26 """Germinate seeds on all flavours for a single architecture."""
27 # Buffer log output for each architecture so that it appears
28 # sequential.
29@@ -358,8 +363,11 @@
30 germinator = Germinator(arch)
31
32 # Read archive metadata.
33+ series = [series_name]
34+ if series_is_stable:
35+ series += [series_name + "-updates"]
36 archive = TagFile(
37- series_name, components, arch, "file://%s" % self.archiveroot,
38+ series, components, arch, "file://%s" % self.archiveroot,
39 cleanup=True)
40 germinator.parse_archive(archive)
41
42@@ -405,8 +413,12 @@
43 if os.path.basename(output) not in seed_outputs:
44 os.remove(output)
45
46- def generateExtraOverrides(self, series_name, components, architectures,
47+ def generateExtraOverrides(self, series, components, architectures,
48 flavours, seed_bases=None):
49+ series_name = series.name
50+ series_is_stable = series.status in ("Current Stable Release",
51+ "Supported")
52+ suffix = series_name + "-updates" if series_is_stable else series_name
53 structures = self.makeSeedStructures(
54 series_name, flavours, seed_bases=seed_bases)
55
56@@ -420,7 +432,8 @@
57 if pid == 0: # child
58 os._exit(self.germinateArchChild(
59 close_in_child, wfd,
60- series_name, components, arch, flavours, structures))
61+ series_name, series_is_stable, components, arch,
62+ flavours, structures))
63 else: # parent
64 os.close(wfd)
65 reader = os.fdopen(rfd, "rb")
66@@ -429,7 +442,7 @@
67 seed_outputs = set()
68 override_path = os.path.join(
69 self.options.misc_root,
70- "more-extra.override.%s.main" % series_name)
71+ "more-extra.override.%s.main" % suffix)
72 with AtomicFile(override_path) as override_file:
73 for pid, reader in procs:
74 log_records, overrides, arch_seed_outputs = pickle.load(
75@@ -447,7 +460,6 @@
76 self.setUp()
77
78 for series in self.series:
79- series_name = series.name
80 components = self.getComponents(series)
81 if not self.options.architectures:
82 architectures = sorted(
83@@ -456,7 +468,7 @@
84 architectures = self.options.architectures
85
86 self.generateExtraOverrides(
87- series_name, components, architectures, self.args,
88+ series, components, architectures, self.args,
89 seed_bases=seed_bases)
90
91 # Add a marker line so that other code can tell from the log file
92
93=== modified file 'tests/test_generate_extra_overrides.py'
94--- tests/test_generate_extra_overrides.py 2021-05-13 12:49:01 +0000
95+++ tests/test_generate_extra_overrides.py 2021-05-13 12:49:01 +0000
96@@ -311,23 +311,39 @@
97 sources_path = os.path.join(
98 script.archiveroot, "dists", distroseries.name, component,
99 "source", "Sources.gz")
100+ sources_path_updates = os.path.join(
101+ script.archiveroot, "dists",
102+ distroseries.name + "-updates", component,
103+ "source", "Sources.gz")
104 ensure_directory_exists(os.path.dirname(sources_path))
105+ ensure_directory_exists(os.path.dirname(sources_path_updates))
106 sources_index = gzip.GzipFile(sources_path, "wb")
107 for spp in distroseries.test_sources[component]:
108 stanza = spp.getIndexStanza().encode("utf-8") + "\n\n"
109 sources_index.write(stanza)
110 sources_index.close()
111+ sources_index_updates = gzip.GzipFile(sources_path_updates,
112+ "wb")
113+ sources_index_updates.close()
114
115 for arch in distroseries.architectures:
116 packages_path = os.path.join(
117 script.archiveroot, "dists", distroseries.name, component,
118 "binary-%s" % arch.architecture_tag, "Packages.gz")
119+ packages_path_updates = os.path.join(
120+ script.archiveroot, "dists",
121+ distroseries.name + "-updates", component,
122+ "binary-%s" % arch.architecture_tag, "Packages.gz")
123 ensure_directory_exists(os.path.dirname(packages_path))
124+ ensure_directory_exists(os.path.dirname(packages_path_updates))
125 packages_index = gzip.GzipFile(packages_path, "wb")
126 for bpp in arch.test_binaries[component]:
127 stanza = bpp.getIndexStanza().encode("utf-8") + "\n\n"
128 packages_index.write(stanza)
129 packages_index.close()
130+ packages_index_updates = gzip.GzipFile(packages_path_updates,
131+ "wb")
132+ packages_index_updates.close()
133
134 def composeSeedPath(self, flavour, series_name, seed_name):
135 return os.path.join(
136@@ -405,24 +421,17 @@
137 self.setUpDistroAndScript()
138 self.assertEqual(self.distro, self.script.distribution)
139
140- def test_prefers_development_distro_series(self):
141- # The script prefers a DEVELOPMENT series for the named
142- # distribution over CURRENT and SUPPORTED series.
143+ def test_uses_all_series(self):
144+ # The script operates on DEVELOPMENT and CURRENT series.
145 self.setUpDistroAndScript(
146 ["Supported", "Current Stable Release", "Active Development"])
147- self.assertEqual([self.distroseries[2]], self.script.series)
148+ self.assertEqual(self.distroseries, self.script.series)
149
150 def test_permits_frozen_distro_series(self):
151- # If there is no DEVELOPMENT series, a FROZEN one will do.
152+ # FROZEN series are included
153 self.setUpDistroAndScript(
154 ["Supported", "Current Stable Release", "Pre-release Freeze"])
155- self.assertEqual([self.distroseries[2]], self.script.series)
156-
157- def test_requires_development_frozen_distro_series(self):
158- # If there is no DEVELOPMENT or FROZEN series, the script fails.
159- self.setUpDistroAndScript(
160- ["Supported", "Current Stable Release"], run_setup=False)
161- self.assertRaises(ScriptFailure, self.script.processOptions)
162+ self.assertEqual(self.distroseries, self.script.series)
163
164 def test_multiple_development_frozen_distro_series(self):
165 # If there are multiple DEVELOPMENT or FROZEN series, they are all
166@@ -457,6 +466,24 @@
167 self.distroseries[0].name, arch),
168 output)
169
170+ def test_stable_compose_output_path_in_miscroot(self):
171+ # Output files are written to the correct locations under
172+ # misc_root when running for a stable release.
173+ flavour = factory.getUniqueString()
174+ self.setUpDistroAndScript(
175+ ["Current Stable Release"], extra_args=[flavour])
176+ self.setUpComponent()
177+ self.distroseries[0].makeDistroArchSeries()
178+ self.makeIndexFiles(self.script, self.distroseries[0])
179+ seed = factory.getUniqueString()
180+ self.makeSeedStructure(flavour, self.distroseries[0].name, [seed])
181+ self.makeSeed(flavour, self.distroseries[0].name, seed, [])
182+
183+ self.script.process(seed_bases=["file://%s" % self.seeddir])
184+ self.assertTrue(os.path.exists(os.path.join(
185+ self.script.options.misc_root,
186+ "more-extra.override.%s-updates.main" % self.distroseries[0].name)))
187+
188 def test_make_seed_structures_missing_seeds(self):
189 # makeSeedStructures ignores missing seeds.
190 self.setUpDistroAndScript()
191@@ -497,9 +524,12 @@
192 distroseries.name, flavours,
193 seed_bases=["file://%s" % self.seeddir])
194
195+ series_is_stable = distroseries.status in ("Current Stable Release",
196+ "Supported")
197+
198 _, overrides, _ = script.germinateArch(
199- distroseries.name, script.getComponents(distroseries), arch,
200- flavours, structures)
201+ distroseries.name, series_is_stable,
202+ script.getComponents(distroseries), arch, flavours, structures)
203 return overrides.splitlines()
204
205 def test_germinate_output(self):

Subscribers

People subscribed via source and target branches