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

Proposed by Colin Watson
Status: Needs review
Proposed branch: ~cjwatson/launchpad:livefs-build-pocket
Merge into: launchpad:master
Diff against target: 59 lines (+20/-3)
2 files modified
lib/lp/soyuz/model/livefsbuildbehaviour.py (+8/-2)
lib/lp/soyuz/tests/test_livefsbuildbehaviour.py (+12/-1)
Reviewer Review Type Date Requested Status
Launchpad code reviewers Pending
Review via email: mp+373803@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.

This is essentially the same as https://code.launchpad.net/~cjwatson/launchpad/livefs-build-pocket/+merge/372444, converted to git and rebased on master.

To post a comment you must log in.

Unmerged commits

ed26842... 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
diff --git a/lib/lp/soyuz/model/livefsbuildbehaviour.py b/lib/lp/soyuz/model/livefsbuildbehaviour.py
index bef72b0..ec5dbaf 100644
--- a/lib/lp/soyuz/model/livefsbuildbehaviour.py
+++ b/lib/lp/soyuz/model/livefsbuildbehaviour.py
@@ -86,15 +86,21 @@ class LiveFSBuildBehaviour(BuildFarmJobBehaviourBase):
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(
diff --git a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
index 29e697e..bfafa1f 100644
--- a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
@@ -261,7 +261,7 @@ class TestAsyncLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
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 @@ class TestAsyncLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
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)

Subscribers

People subscribed via source and target branches

to status/vote changes: