Merge ~vorlon/launchpad-buildd:main into launchpad-buildd:master

Proposed by Steve Langasek
Status: Needs review
Proposed branch: ~vorlon/launchpad-buildd:main
Merge into: launchpad-buildd:master
Diff against target: 108 lines (+57/-0)
4 files modified
lpbuildd/livefs.py (+3/-0)
lpbuildd/target/build_livefs.py (+9/-0)
lpbuildd/target/tests/test_build_livefs.py (+32/-0)
lpbuildd/tests/test_livefs.py (+13/-0)
Reviewer Review Type Date Requested Status
Philip Roche (community) Approve
John Chittum (community) Approve
Canonical Launchpad Engineering Pending
Review via email: mp+421250@code.launchpad.net

Description of the change

The purpose of this is to provide a generic interface for requesting cherry-picks of packages from the -proposed pocket when building images, for the purpose of doing per-package, image-level verification of SRUs.

This is particularly relevant for packages included in cloud images - e.g. cloud-init whose behavior at first boot of an image is important for an SRU.

The interface is modeled on autopkgtest's existing --apt-pocket commandline option.

To post a comment you must log in.
Revision history for this message
John Chittum (jchittum) :
review: Approve
Revision history for this message
Philip Roche (philroche) :
review: Needs Information
Revision history for this message
Steve Langasek (vorlon) :
Revision history for this message
Philip Roche (philroche) :
review: Approve

Unmerged commits

1043395... by Steve Langasek

Support passing apt pocket arguments to livecd-rootfs

This uses the same semantics as --apt-pocket option to autopkgtest

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lpbuildd/livefs.py b/lpbuildd/livefs.py
2index f627e76..37aeba9 100644
3--- a/lpbuildd/livefs.py
4+++ b/lpbuildd/livefs.py
5@@ -62,6 +62,9 @@ class LiveFilesystemBuildManager(DebianBuildManager):
6 args.extend(["--image-format", self.image_format])
7 if self.pocket == "proposed":
8 args.append("--proposed")
9+ elif type(self.pocket) is list:
10+ for pocket in self.pocket:
11+ args.extend(["--apt-pocket", pocket])
12 if self.locale:
13 args.extend(["--locale", self.locale])
14 for ppa in self.extra_ppas:
15diff --git a/lpbuildd/target/build_livefs.py b/lpbuildd/target/build_livefs.py
16index 1d576d0..c951d43 100644
17--- a/lpbuildd/target/build_livefs.py
18+++ b/lpbuildd/target/build_livefs.py
19@@ -69,6 +69,13 @@ class BuildLiveFS(SnapStoreOperationMixin, Operation):
20 "--extra-snap", dest="extra_snaps", default=[], action="append",
21 help="use this additional snap")
22 parser.add_argument(
23+ "--apt-pocket", dest="apt_pocket", default=[], action="append",
24+ metavar="POCKETNAME",
25+ help="Enable additional apt source for release-POCKETNAME. "
26+ "If packages are given, set up apt pinning to use only "
27+ "those packages from release-POCKETNAME; src:srcname "
28+ "expands to all binaries of srcname")
29+ parser.add_argument(
30 "--channel", metavar="CHANNEL",
31 help="pull snaps from channel CHANNEL for ubuntu-core image")
32 parser.add_argument(
33@@ -132,6 +139,8 @@ class BuildLiveFS(SnapStoreOperationMixin, Operation):
34 self.args.repo_snapshot_stamp)
35 if self.args.cohort_key:
36 base_lb_env["COHORT_KEY"] = self.args.cohort_key
37+ if self.args.apt_pocket:
38+ base_lb_env["APT_POCKET"] = " ".join(self.args.apt_pocket)
39 lb_env = base_lb_env.copy()
40 lb_env["SUITE"] = self.args.series
41 if self.args.datestamp is not None:
42diff --git a/lpbuildd/target/tests/test_build_livefs.py b/lpbuildd/target/tests/test_build_livefs.py
43index e8fa92a..64dc230 100644
44--- a/lpbuildd/target/tests/test_build_livefs.py
45+++ b/lpbuildd/target/tests/test_build_livefs.py
46@@ -156,6 +156,38 @@ class TestBuildLiveFS(TestCase):
47 ["lb", "build"], PROJECT="ubuntu-core", ARCH="amd64"),
48 ]))
49
50+ def test_build_apt_pocket(self):
51+ args = [
52+ "buildlivefs",
53+ "--backend=fake", "--series=jammy", "--arch=amd64", "1",
54+ "--project=ubuntu",
55+ "--apt-pocket", "proposed=src:src1",
56+ "--apt-pocket", "proposed=pkg2",
57+ ]
58+ build_livefs = parse_args(args=args).operation
59+ build_livefs.build()
60+ self.assertThat(build_livefs.backend.run.calls, MatchesListwise([
61+ RanBuildCommand(["rm", "-rf", "auto", "local"]),
62+ RanBuildCommand(["mkdir", "-p", "auto"]),
63+ RanBuildCommand(
64+ ["ln", "-s",
65+ "/usr/share/livecd-rootfs/live-build/auto/config", "auto/"]),
66+ RanBuildCommand(
67+ ["ln", "-s",
68+ "/usr/share/livecd-rootfs/live-build/auto/build", "auto/"]),
69+ RanBuildCommand(
70+ ["ln", "-s",
71+ "/usr/share/livecd-rootfs/live-build/auto/clean", "auto/"]),
72+ RanBuildCommand(["lb", "clean", "--purge"]),
73+ RanBuildCommand(
74+ ["lb", "config"],
75+ PROJECT="ubuntu", ARCH="amd64", SUITE="jammy",
76+ APT_POCKET="proposed=src:src1 proposed=pkg2"),
77+ RanBuildCommand(
78+ ["lb", "build"], PROJECT="ubuntu", ARCH="amd64",
79+ APT_POCKET="proposed=src:src1 proposed=pkg2"),
80+ ]))
81+
82 def test_build_debug(self):
83 args = [
84 "buildlivefs",
85diff --git a/lpbuildd/tests/test_livefs.py b/lpbuildd/tests/test_livefs.py
86index d121837..a2b5c1c 100644
87--- a/lpbuildd/tests/test_livefs.py
88+++ b/lpbuildd/tests/test_livefs.py
89@@ -149,6 +149,19 @@ class TestLiveFilesystemBuildManagerIteration(TestCase):
90 ])
91
92 @defer.inlineCallbacks
93+ def test_iterate_apt_pocket(self):
94+ # The build manager can be told to specify apt pockets for different
95+ # packages on the backend.
96+ yield self.startBuild(
97+ args={
98+ "pocket": ["proposed=src:apt", "proposed=python3-apt"],
99+ },
100+ options=[
101+ "--apt-pocket", "proposed=src:apt",
102+ "--apt-pocket", "proposed=python3-apt",
103+ ])
104+
105+ @defer.inlineCallbacks
106 def test_iterate_snap_store_proxy(self):
107 # The build manager can be told to use a snap store proxy.
108 self.builder._config.set(

Subscribers

People subscribed via source and target branches