launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31072
[Merge] ~kxuan/launchpad-buildd:add-lb-ubuntu-images-repo into launchpad-buildd:master
Zhaoxuan Zhai has proposed merging ~kxuan/launchpad-buildd:add-lb-ubuntu-images-repo into launchpad-buildd:master.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~kxuan/launchpad-buildd/+git/launchpad-buildd/+merge/464879
buildlivefs: support passing LB_UBUNTU_IMAGES_REPO into the environment
LB_UBUNTU_IMAGES_REPO is required by users who wants to build image with their own image definition.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~kxuan/launchpad-buildd:add-lb-ubuntu-images-repo into launchpad-buildd:master.
diff --git a/lpbuildd/livefs.py b/lpbuildd/livefs.py
index 6e8da92..0e336f1 100644
--- a/lpbuildd/livefs.py
+++ b/lpbuildd/livefs.py
@@ -37,6 +37,7 @@ class LiveFilesystemBuildManager(DebianBuildManager):
self.repo_snapshot_stamp = extra_args.get("repo_snapshot_stamp")
self.cohort_key = extra_args.get("cohort-key")
self.debug = extra_args.get("debug", False)
+ self.lb_ubuntu_images_repo = extra_args.get("lb_ubuntu_images_repo")
super().initiate(files, chroot, extra_args)
@@ -68,6 +69,8 @@ class LiveFilesystemBuildManager(DebianBuildManager):
args.extend(["--repo-snapshot-stamp", self.repo_snapshot_stamp])
if self.cohort_key:
args.extend(["--cohort-key", self.cohort_key])
+ if self.lb_ubuntu_images_repo:
+ args.extend(["--lb-ubuntu-images-repo", self.lb_ubuntu_images_repo])
try:
snap_store_proxy_url = self._builder._config.get(
"proxy", "snapstore"
diff --git a/lpbuildd/target/build_livefs.py b/lpbuildd/target/build_livefs.py
index ed94328..05d66e5 100644
--- a/lpbuildd/target/build_livefs.py
+++ b/lpbuildd/target/build_livefs.py
@@ -109,6 +109,12 @@ class BuildLiveFS(SnapStoreOperationMixin, Operation):
action="store_true",
help="enable detailed live-build debugging",
)
+ parser.add_argument(
+ "--lb-ubuntu-images-repo",
+ dest="lb_ubuntu_images_repo",
+ metavar="LB_UBUNTU_IMAGES_REPO",
+ help="specify the location of image definition for ubuntu-image"
+ )
def install(self):
deps = ["livecd-rootfs"]
@@ -191,6 +197,8 @@ class BuildLiveFS(SnapStoreOperationMixin, Operation):
lb_env["EXTRA_PPAS"] = " ".join(self.args.extra_ppas)
if self.args.extra_snaps:
lb_env["EXTRA_SNAPS"] = " ".join(self.args.extra_snaps)
+ if self.args.lb_ubuntu_images_repo:
+ lb_env["LB_UBUNTU_IMAGES_REPO"] = self.args.lb_ubuntu_images_repo
if self.args.http_proxy:
proxy_dict = {
"http_proxy": self.args.http_proxy,
diff --git a/lpbuildd/target/tests/test_build_livefs.py b/lpbuildd/target/tests/test_build_livefs.py
index ad220c3..012356f 100644
--- a/lpbuildd/target/tests/test_build_livefs.py
+++ b/lpbuildd/target/tests/test_build_livefs.py
@@ -440,3 +440,60 @@ class TestBuildLiveFS(TestCase):
build_livefs = parse_args(args=args).operation
build_livefs.backend.run = FailBuild()
self.assertEqual(RETCODE_FAILURE_BUILD, build_livefs.run())
+
+ def test_build_with_lb_ubuntu_images(self):
+ args = [
+ "buildlivefs",
+ "--backend=fake",
+ "--series=noble",
+ "--arch=arm64",
+ "--project=ubuntu-cpc",
+ "1",
+ "--lb-ubuntu-images-repo=http://example.com/git-repo.git",
+ ]
+ build_livefs = parse_args(args=args).operation
+ build_livefs.build()
+ self.assertThat(
+ build_livefs.backend.run.calls,
+ MatchesListwise(
+ [
+ RanBuildCommand(["rm", "-rf", "auto", "local"]),
+ RanBuildCommand(["mkdir", "-p", "auto"]),
+ RanBuildCommand(
+ [
+ "ln",
+ "-s",
+ "/usr/share/livecd-rootfs/live-build/auto/config",
+ "auto/",
+ ]
+ ),
+ RanBuildCommand(
+ [
+ "ln",
+ "-s",
+ "/usr/share/livecd-rootfs/live-build/auto/build",
+ "auto/",
+ ]
+ ),
+ RanBuildCommand(
+ [
+ "ln",
+ "-s",
+ "/usr/share/livecd-rootfs/live-build/auto/clean",
+ "auto/",
+ ]
+ ),
+ RanBuildCommand(["lb", "clean", "--purge"]),
+ RanBuildCommand(
+ ["lb", "config"],
+ PROJECT="ubuntu-cpc",
+ ARCH="arm64",
+ SUITE="noble",
+ LB_UBUNTU_IMAGES_REPO="http://example.com/git-repo.git",
+ ),
+ RanBuildCommand(
+ ["lb", "build"], PROJECT="ubuntu-cpc", ARCH="arm64"
+ ),
+ ]
+ ),
+ )
diff --git a/lpbuildd/tests/test_livefs.py b/lpbuildd/tests/test_livefs.py
index 25eea06..a5cc69f 100644
--- a/lpbuildd/tests/test_livefs.py
+++ b/lpbuildd/tests/test_livefs.py
@@ -214,3 +214,15 @@ class TestLiveFilesystemBuildManagerIteration(TestCase):
}
),
)
+
+ @defer.inlineCallbacks
+ def test_build_with_lb_ubuntu_images(self):
+ yield self.startBuild(
+ args={
+ "lb_ubuntu_images_repo": "http://example.com/git-repo.git",
+ },
+ options=[
+ "--lb-ubuntu-images-repo",
+ "http://example.com/git-repo.git",
+ ],
+ )
\ No newline at end of file