Merge lp:~cjwatson/livecd-rootfs/buildd-lxd into lp:livecd-rootfs

Proposed by Colin Watson
Status: Rejected
Rejected by: Colin Watson
Proposed branch: lp:~cjwatson/livecd-rootfs/buildd-lxd
Merge into: lp:livecd-rootfs
Diff against target: 103 lines (+69/-0)
4 files modified
debian/changelog (+6/-0)
live-build/auto/build (+12/-0)
live-build/auto/config (+2/-0)
live-build/make-lxd-metadata.py (+49/-0)
To merge this branch: bzr merge lp:~cjwatson/livecd-rootfs/buildd-lxd
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+360313@code.launchpad.net

Commit message

Add a LXD image to builds for the buildd subproject.

Description of the change

This will save launchpad-buildd from having to construct it every time for snap and livefs builds; and IIRC the plan is to end up with snapcraft using the same image when it's using LXD.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) :
review: Approve
Revision history for this message
Balint Reczey (rbalint) wrote :

The target Bazaar branch is not active anymore.
Please resubmit the merge proposal against https://code.launchpad.net/~ubuntu-core-dev/livecd-rootfs/+git/livecd-rootfs/+ref/ubuntu/master .

Revision history for this message
Colin Watson (cjwatson) wrote :

Unmerged revisions

1735. By Colin Watson

Add a LXD image to builds for the buildd subproject.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2018-12-06 11:38:12 +0000
+++ debian/changelog 2018-12-07 18:40:08 +0000
@@ -1,3 +1,9 @@
1livecd-rootfs (2.549) UNRELEASED; urgency=medium
2
3 * Add a LXD image to builds for the buildd subproject.
4
5 -- Colin Watson <cjwatson@ubuntu.com> Fri, 07 Dec 2018 14:55:17 +0000
6
1livecd-rootfs (2.548) disco; urgency=medium7livecd-rootfs (2.548) disco; urgency=medium
28
3 * Key netplan delegation to NetworkManager on presence of9 * Key netplan delegation to NetworkManager on presence of
410
=== modified file 'live-build/auto/build'
--- live-build/auto/build 2018-12-06 11:38:07 +0000
+++ live-build/auto/build 2018-12-07 18:40:08 +0000
@@ -531,6 +531,18 @@
531 tar --transform='s,^binary,chroot-autobuild,' \531 tar --transform='s,^binary,chroot-autobuild,' \
532 --sort=name --numeric-owner \532 --sort=name --numeric-owner \
533 -czf "$PREFIX.rootfs.tar.gz" binary533 -czf "$PREFIX.rootfs.tar.gz" binary
534
535 # Build a LXD image as well, which is preferable for some build types.
536 TMPDIR="$(mktemp -d)"
537 config/make-lxd-metadata "${LB_DISTRIBUTION%-*}" "$ARCH" >"$TMPDIR/metadata.yaml"
538 tar --numeric-owner -cf "$PREFIX.lxd.tar" -C "$TMPDIR" metadata.yaml
539 rm -rf "$TMPDIR"
540 # When using the combined metadata/rootfs form, the rootfs must be
541 # under rootfs/ rather than under chroot-autobuild/.
542 tar --transform='s,^binary,rootfs,' \
543 --sort=name --numeric-owner \
544 -rf "$PREFIX.lxd.tar" binary
545 gzip -9 "$PREFIX.lxd.tar"
534fi546fi
535547
536if [ "$PROJECT:${SUBPROJECT:-}" = "ubuntu-core:system-image" ]; then548if [ "$PROJECT:${SUBPROJECT:-}" = "ubuntu-core:system-image" ]; then
537549
=== modified file 'live-build/auto/config'
--- live-build/auto/config 2018-11-28 15:05:24 +0000
+++ live-build/auto/config 2018-12-07 18:40:08 +0000
@@ -715,6 +715,8 @@
715 add_package install build-essential715 add_package install build-essential
716 # Needed for LXD-based builds.716 # Needed for LXD-based builds.
717 add_package install init717 add_package install init
718
719 cp -af /usr/share/livecd-rootfs/live-build/make-lxd-metadata.py config/make-lxd-metadata
718 ;;720 ;;
719esac721esac
720722
721723
=== added file 'live-build/make-lxd-metadata.py'
--- live-build/make-lxd-metadata.py 1970-01-01 00:00:00 +0000
+++ live-build/make-lxd-metadata.py 2018-12-07 18:40:08 +0000
@@ -0,0 +1,49 @@
1#! /usr/bin/python3
2
3"""Make a metadata.yaml file for a LXD image."""
4
5import argparse
6import json
7import sys
8import time
9
10
11# Map dpkg architecture names to LXD architecture names.
12lxd_arches = {
13 "amd64": "x86_64",
14 "arm64": "aarch64",
15 "armhf": "armv7l",
16 "i386": "i686",
17 "powerpc": "ppc",
18 "ppc64el": "ppc64le",
19 "s390x": "s390x",
20 }
21
22
23def main():
24 parser = argparse.ArgumentParser()
25 parser.add_argument("series", help="Ubuntu series name")
26 parser.add_argument("architecture", help="Ubuntu architecture name")
27 args = parser.parse_args()
28
29 metadata = {
30 "architecture": lxd_arches[args.architecture],
31 "creation_date": int(time.time()),
32 "properties": {
33 "os": "Ubuntu",
34 "series": args.series,
35 "architecture": args.architecture,
36 "description": "Ubuntu buildd %s %s" % (
37 args.series, args.architecture),
38 },
39 }
40
41 # Encoding this as JSON is good enough, and saves pulling in a YAML
42 # library dependency.
43 json.dump(
44 metadata, sys.stdout, sort_keys=True, indent=4, separators=(",", ": "),
45 ensure_ascii=False)
46
47
48if __name__ == "__main__":
49 main()

Subscribers

People subscribed via source and target branches