Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/extra-snaps into lp:launchpad-buildd.
Commit message: Accept an "extra_snaps" entry in livefs arguments. Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad-buildd/extra-snaps/+merge/373498 This is passed to livecd-rootfs to configure ubuntu-image to include additional snaps. -- Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/extra-snaps into lp:launchpad-buildd.
=== modified file 'debian/changelog' --- debian/changelog 2019-08-23 09:58:21 +0000 +++ debian/changelog 2019-10-02 10:31:49 +0000 @@ -1,3 +1,10 @@ +launchpad-buildd (178) UNRELEASED; urgency=medium + + * Accept an "extra_snaps" entry in livefs arguments, which is passed to + livecd-rootfs to configure ubuntu-image to include additional snaps. + + -- Colin Watson <[email protected]> Wed, 02 Oct 2019 11:26:45 +0100 + launchpad-buildd (177) xenial; urgency=medium * Fix recipe building to not rely on /CurrentlyBuilding existing in base === modified file 'lpbuildd/livefs.py' --- lpbuildd/livefs.py 2019-06-05 14:10:20 +0000 +++ lpbuildd/livefs.py 2019-10-02 10:31:49 +0000 @@ -41,6 +41,7 @@ self.image_format = extra_args.get("image_format") self.locale = extra_args.get("locale") self.extra_ppas = extra_args.get("extra_ppas", []) + self.extra_snaps = extra_args.get("extra_snaps", []) self.channel = extra_args.get("channel") self.image_targets = extra_args.get("image_targets", []) self.repo_snapshot_stamp = extra_args.get("repo_snapshot_stamp") @@ -68,6 +69,8 @@ args.extend(["--locale", self.locale]) for ppa in self.extra_ppas: args.extend(["--extra-ppa", ppa]) + for snap in self.extra_snaps: + args.extend(["--extra-snap", snap]) if self.channel: args.extend(["--channel", self.channel]) for image_target in self.image_targets: === modified file 'lpbuildd/target/build_livefs.py' --- lpbuildd/target/build_livefs.py 2019-01-28 15:12:54 +0000 +++ lpbuildd/target/build_livefs.py 2019-10-02 10:31:49 +0000 @@ -70,6 +70,9 @@ "--extra-ppa", dest="extra_ppas", default=[], action="append", help="use this additional PPA") parser.add_argument( + "--extra-snap", dest="extra_snaps", default=[], action="append", + help="use this additional snap") + parser.add_argument( "--channel", metavar="CHANNEL", help="pull snaps from channel CHANNEL for ubuntu-core image") parser.add_argument( @@ -156,6 +159,8 @@ lb_env["PROPOSED"] = "1" if self.args.extra_ppas: 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.http_proxy: proxy_dict = { "http_proxy": self.args.http_proxy, === modified file 'lpbuildd/target/tests/test_build_livefs.py' --- lpbuildd/target/tests/test_build_livefs.py 2019-06-05 14:10:20 +0000 +++ lpbuildd/target/tests/test_build_livefs.py 2019-10-02 10:31:49 +0000 @@ -191,6 +191,38 @@ "--arch", "amd64", "--release", "xenial"]), ])) + def test_build_extra_ppas_and_snaps(self): + args = [ + "buildlivefs", + "--backend=fake", "--series=xenial", "--arch=amd64", "1", + "--project=ubuntu-core", + "--extra-ppa=owner1/name1", "--extra-ppa=owner2/name2", + "--extra-snap=snap1", "--extra-snap=snap2", + ] + 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-core", ARCH="amd64", SUITE="xenial", + EXTRA_PPAS="owner1/name1 owner2/name2", + EXTRA_SNAPS="snap1 snap2"), + RanBuildCommand( + ["lb", "build"], PROJECT="ubuntu-core", ARCH="amd64"), + ])) + def test_build_debug(self): args = [ "buildlivefs", === modified file 'lpbuildd/tests/test_livefs.py' --- lpbuildd/tests/test_livefs.py 2019-06-05 14:10:20 +0000 +++ lpbuildd/tests/test_livefs.py 2019-10-02 10:31:49 +0000 @@ -58,7 +58,7 @@ return self.buildmanager._state @defer.inlineCallbacks - def startBuild(self, options=None): + def startBuild(self, args=None, options=None): # The build manager's iterate() kicks off the consecutive states # after INIT. extra_args = { @@ -67,6 +67,8 @@ "pocket": "release", "arch_tag": "i386", } + if args is not None: + extra_args.update(args) original_backend_name = self.buildmanager.backend_name self.buildmanager.backend_name = "fake" self.buildmanager.initiate({}, "chroot.tar.gz", extra_args) @@ -133,6 +135,22 @@ self.assertFalse(self.builder.wasCalled("buildFail")) @defer.inlineCallbacks + def test_iterate_extra_ppas_and_snaps(self): + # The build manager can be told to pass requests for extra PPAs and + # snaps through to the backend. + yield self.startBuild( + args={ + "extra_ppas": ["owner1/name1", "owner2/name2"], + "extra_snaps": ["snap1", "snap2"], + }, + options=[ + "--extra-ppa", "owner1/name1", + "--extra-ppa", "owner2/name2", + "--extra-snap", "snap1", + "--extra-snap", "snap2", + ]) + + @defer.inlineCallbacks def test_iterate_snap_store_proxy(self): # The build manager can be told to use a snap store proxy. self.builder._config.set(
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

