← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~tobijk/launchpad-buildd/image-targets into lp:launchpad-buildd

 

Tobias Koch has proposed merging lp:~tobijk/launchpad-buildd/image-targets into lp:launchpad-buildd.

Commit message:
buildlivefs: support passing an IMAGE_TARGETS variable into the environment
  
This is needed for projects, such as ubuntu-cpc, that produce multiple images as part of a single build, in order to be selective about which image sets to produce.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~tobijk/launchpad-buildd/image-targets/+merge/356304

(Taken from original MP#316648 by S. Langasek)

The ubuntu-cpc project is unusual in that for a single project, it produces multiple image outputs, each of which can be fairly time consuming to build. By default we want the ubuntu-cpc build to produce the full set of relevant images for the architecture, but I would find it useful to be able to specify (especially when iterating during development) that I only want a subset of images produced.

This branch proposes a syntax for passing that information through launchpad-buildd into the hook scripts via the environment. See https://code.launchpad.net/~vorlon/livecd-rootfs/image-flavors/+merge/316530 for a corresponding livecd-rootfs change.

This is distinct from subarch, as we could legitimately have both a kernel subarchitecture type and a cloud target specified as part of a single build; also, we can't legitimately pass multiple subarch options to a single build.

It is also distinct from --image-format, which is mapped to live-build's --chroot-filesystem within livecd-rootfs.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~tobijk/launchpad-buildd/image-targets into lp:launchpad-buildd.
=== modified file 'lpbuildd/livefs.py'
--- lpbuildd/livefs.py	2018-01-09 00:50:02 +0000
+++ lpbuildd/livefs.py	2018-10-09 09:15:13 +0000
@@ -37,6 +37,7 @@
         self.locale = extra_args.get("locale")
         self.extra_ppas = extra_args.get("extra_ppas", [])
         self.channel = extra_args.get("channel")
+        self.image_targets = extra_args.get("image_targets", [])
         self.debug = extra_args.get("debug", False)
 
         super(LiveFilesystemBuildManager, self).initiate(
@@ -62,6 +63,8 @@
             args.extend(["--extra-ppa", ppa])
         if self.channel:
             args.extend(["--channel", self.channel])
+        for image_target in self.image_targets:
+            args.extend(["--image-target", image_target])
         if self.debug:
             args.append("--debug")
         self.runTargetSubProcess("buildlivefs", *args)

=== modified file 'lpbuildd/target/build_livefs.py'
--- lpbuildd/target/build_livefs.py	2018-01-12 20:02:37 +0000
+++ lpbuildd/target/build_livefs.py	2018-10-09 09:15:13 +0000
@@ -49,6 +49,10 @@
             "--image-format", metavar="FORMAT",
             help="produce an image in FORMAT")
         parser.add_argument(
+            "--image-target", dest="image_targets", default=[],
+            action="append", metavar="TARGET",
+            help="produce image for TARGET")
+        parser.add_argument(
             "--proposed", default=False, action="store_true",
             help="enable use of -proposed pocket")
         parser.add_argument(
@@ -124,6 +128,9 @@
                 base_lb_env["SUBARCH"] = self.args.subarch
             if self.args.channel is not None:
                 base_lb_env["CHANNEL"] = self.args.channel
+            if self.args.image_targets:
+                base_lb_env["IMAGE_TARGETS"] = " ".join(
+                    self.args.image_targets)
             lb_env = base_lb_env.copy()
             lb_env["SUITE"] = self.args.series
             if self.args.datestamp is not None:


Follow ups