Merge lp:~cjwatson/launchpad/livefs-build-pocket into lp:launchpad

Proposed by Colin Watson
Status: Rejected
Rejected by: Colin Watson
Proposed branch: lp:~cjwatson/launchpad/livefs-build-pocket
Merge into: lp:launchpad
Diff against target: 58 lines (+20/-3)
2 files modified
lib/lp/soyuz/model/livefsbuildbehaviour.py (+8/-2)
lib/lp/soyuz/tests/test_livefsbuildbehaviour.py (+12/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/livefs-build-pocket
Reviewer Review Type Date Requested Status
Launchpad code reviewers Pending
Review via email: mp+372444@code.launchpad.net

Commit message

Allow livefs build metadata to override the default build pocket.

Description of the change

This makes it possible, for example, to distinguish the case of building a livefs using tools from -updates but with contents from the release pocket from the case of building a livefs using tools from -updates and contents from -updates.

The use case here is that at the moment buildd images are built with tools from -updates but with contents from the release pocket. I'd like it to be possible to build buildd images with contents from -updates as well, since we could use those for builds against -updates and it would save a good deal of time at the start of each build.

We've ended up in a bit of a compatibility corner due to some unfortunate past decisions (mostly by me), and this is the least bad solution I can think of. launchpad-buildd and livecd-rootfs will also need some work to support this, but this design allows it to be done in a somewhat backwards-compatible way (that is, it wouldn't break existing livecd-rootfs code). The one compatibility issue is that existing livefses that intend to continue building with tools from -updates and contents from the release pocket (or similar) will need to have "pocket": "release" explicitly added to their metadata before landing the corresponding launchpad-buildd change which starts paying attention to the "pocket" argument; we'll need to go through the current database to check for that kind of thing.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

Unmerged revisions

19047. By Colin Watson

Allow livefs build metadata to override the default build pocket.

This makes it possible, for example, to distinguish the case of building a
livefs using tools from -updates but with contents from the release pocket
from the case of building a livefs using tools from -updates and contents
from -updates.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/model/livefsbuildbehaviour.py'
--- lib/lp/soyuz/model/livefsbuildbehaviour.py 2019-02-07 19:17:52 +0000
+++ lib/lp/soyuz/model/livefsbuildbehaviour.py 2019-09-07 00:43:41 +0000
@@ -86,15 +86,21 @@
86 build = self.build86 build = self.build
87 base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs(87 base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs(
88 logger=logger)88 logger=logger)
89 args = {}
90 # Allow the metadata to override the default build pocket; this is
91 # useful e.g. to build a livefs using tools from -updates but with
92 # contents from the release pocket. Note that the "pocket" argument
93 # here is only used for passing instructions to livecd-rootfs, not
94 # for constructing the sources.list used for the build.
95 args["pocket"] = build.pocket.name.lower()
89 # Non-trivial metadata values may have been security-wrapped, which96 # Non-trivial metadata values may have been security-wrapped, which
90 # is pointless here and just gets in the way of xmlrpclib97 # is pointless here and just gets in the way of xmlrpclib
91 # serialisation.98 # serialisation.
92 args = dict(removeSecurityProxy(build.livefs.metadata))99 args.update(removeSecurityProxy(build.livefs.metadata))
93 if build.metadata_override is not None:100 if build.metadata_override is not None:
94 args.update(removeSecurityProxy(build.metadata_override))101 args.update(removeSecurityProxy(build.metadata_override))
95 # Everything else overrides anything in the metadata.102 # Everything else overrides anything in the metadata.
96 args.update(base_args)103 args.update(base_args)
97 args["pocket"] = build.pocket.name.lower()
98 args["datestamp"] = build.version104 args["datestamp"] = build.version
99 args["archives"], args["trusted_keys"] = (105 args["archives"], args["trusted_keys"] = (
100 yield get_sources_list_for_building(106 yield get_sources_list_for_building(
101107
=== modified file 'lib/lp/soyuz/tests/test_livefsbuildbehaviour.py'
--- lib/lp/soyuz/tests/test_livefsbuildbehaviour.py 2019-02-07 19:17:52 +0000
+++ lib/lp/soyuz/tests/test_livefsbuildbehaviour.py 2019-09-07 00:43:41 +0000
@@ -261,7 +261,7 @@
261261
262 @defer.inlineCallbacks262 @defer.inlineCallbacks
263 def test_extraBuildArgs_metadata_cannot_override_base(self):263 def test_extraBuildArgs_metadata_cannot_override_base(self):
264 # Items in the user-provided metadata cannot override the base264 # Most items in the user-provided metadata cannot override the base
265 # arguments.265 # arguments.
266 job = self.makeJob(266 job = self.makeJob(
267 metadata={"project": "distro", "arch_tag": "nonsense"},267 metadata={"project": "distro", "arch_tag": "nonsense"},
@@ -271,6 +271,17 @@
271 self.assertEqual("i386", args["arch_tag"])271 self.assertEqual("i386", args["arch_tag"])
272272
273 @defer.inlineCallbacks273 @defer.inlineCallbacks
274 def test_extraBuildArgs_metadata_pocket_overrides_base(self):
275 # The "pocket" item in the user-provided metadata overrides the base
276 # arguments, to allow for building a livefs with content whose
277 # source differs from the tools used to build it.
278 job = self.makeJob(
279 pocket=PackagePublishingPocket.UPDATES,
280 metadata={"pocket": "release"}, with_builder=True)
281 args = yield job.extraBuildArgs()
282 self.assertEqual("release", args["pocket"])
283
284 @defer.inlineCallbacks
274 def test_composeBuildRequest(self):285 def test_composeBuildRequest(self):
275 job = self.makeJob(with_builder=True)286 job = self.makeJob(with_builder=True)
276 lfa = self.factory.makeLibraryFileAlias(db_only=True)287 lfa = self.factory.makeLibraryFileAlias(db_only=True)