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
1=== modified file 'lib/lp/soyuz/model/livefsbuildbehaviour.py'
2--- lib/lp/soyuz/model/livefsbuildbehaviour.py 2019-02-07 19:17:52 +0000
3+++ lib/lp/soyuz/model/livefsbuildbehaviour.py 2019-09-07 00:43:41 +0000
4@@ -86,15 +86,21 @@
5 build = self.build
6 base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs(
7 logger=logger)
8+ args = {}
9+ # Allow the metadata to override the default build pocket; this is
10+ # useful e.g. to build a livefs using tools from -updates but with
11+ # contents from the release pocket. Note that the "pocket" argument
12+ # here is only used for passing instructions to livecd-rootfs, not
13+ # for constructing the sources.list used for the build.
14+ args["pocket"] = build.pocket.name.lower()
15 # Non-trivial metadata values may have been security-wrapped, which
16 # is pointless here and just gets in the way of xmlrpclib
17 # serialisation.
18- args = dict(removeSecurityProxy(build.livefs.metadata))
19+ args.update(removeSecurityProxy(build.livefs.metadata))
20 if build.metadata_override is not None:
21 args.update(removeSecurityProxy(build.metadata_override))
22 # Everything else overrides anything in the metadata.
23 args.update(base_args)
24- args["pocket"] = build.pocket.name.lower()
25 args["datestamp"] = build.version
26 args["archives"], args["trusted_keys"] = (
27 yield get_sources_list_for_building(
28
29=== modified file 'lib/lp/soyuz/tests/test_livefsbuildbehaviour.py'
30--- lib/lp/soyuz/tests/test_livefsbuildbehaviour.py 2019-02-07 19:17:52 +0000
31+++ lib/lp/soyuz/tests/test_livefsbuildbehaviour.py 2019-09-07 00:43:41 +0000
32@@ -261,7 +261,7 @@
33
34 @defer.inlineCallbacks
35 def test_extraBuildArgs_metadata_cannot_override_base(self):
36- # Items in the user-provided metadata cannot override the base
37+ # Most items in the user-provided metadata cannot override the base
38 # arguments.
39 job = self.makeJob(
40 metadata={"project": "distro", "arch_tag": "nonsense"},
41@@ -271,6 +271,17 @@
42 self.assertEqual("i386", args["arch_tag"])
43
44 @defer.inlineCallbacks
45+ def test_extraBuildArgs_metadata_pocket_overrides_base(self):
46+ # The "pocket" item in the user-provided metadata overrides the base
47+ # arguments, to allow for building a livefs with content whose
48+ # source differs from the tools used to build it.
49+ job = self.makeJob(
50+ pocket=PackagePublishingPocket.UPDATES,
51+ metadata={"pocket": "release"}, with_builder=True)
52+ args = yield job.extraBuildArgs()
53+ self.assertEqual("release", args["pocket"])
54+
55+ @defer.inlineCallbacks
56 def test_composeBuildRequest(self):
57 job = self.makeJob(with_builder=True)
58 lfa = self.factory.makeLibraryFileAlias(db_only=True)