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
1=== modified file 'debian/changelog'
2--- debian/changelog 2018-12-06 11:38:12 +0000
3+++ debian/changelog 2018-12-07 18:40:08 +0000
4@@ -1,3 +1,9 @@
5+livecd-rootfs (2.549) UNRELEASED; urgency=medium
6+
7+ * Add a LXD image to builds for the buildd subproject.
8+
9+ -- Colin Watson <cjwatson@ubuntu.com> Fri, 07 Dec 2018 14:55:17 +0000
10+
11 livecd-rootfs (2.548) disco; urgency=medium
12
13 * Key netplan delegation to NetworkManager on presence of
14
15=== modified file 'live-build/auto/build'
16--- live-build/auto/build 2018-12-06 11:38:07 +0000
17+++ live-build/auto/build 2018-12-07 18:40:08 +0000
18@@ -531,6 +531,18 @@
19 tar --transform='s,^binary,chroot-autobuild,' \
20 --sort=name --numeric-owner \
21 -czf "$PREFIX.rootfs.tar.gz" binary
22+
23+ # Build a LXD image as well, which is preferable for some build types.
24+ TMPDIR="$(mktemp -d)"
25+ config/make-lxd-metadata "${LB_DISTRIBUTION%-*}" "$ARCH" >"$TMPDIR/metadata.yaml"
26+ tar --numeric-owner -cf "$PREFIX.lxd.tar" -C "$TMPDIR" metadata.yaml
27+ rm -rf "$TMPDIR"
28+ # When using the combined metadata/rootfs form, the rootfs must be
29+ # under rootfs/ rather than under chroot-autobuild/.
30+ tar --transform='s,^binary,rootfs,' \
31+ --sort=name --numeric-owner \
32+ -rf "$PREFIX.lxd.tar" binary
33+ gzip -9 "$PREFIX.lxd.tar"
34 fi
35
36 if [ "$PROJECT:${SUBPROJECT:-}" = "ubuntu-core:system-image" ]; then
37
38=== modified file 'live-build/auto/config'
39--- live-build/auto/config 2018-11-28 15:05:24 +0000
40+++ live-build/auto/config 2018-12-07 18:40:08 +0000
41@@ -715,6 +715,8 @@
42 add_package install build-essential
43 # Needed for LXD-based builds.
44 add_package install init
45+
46+ cp -af /usr/share/livecd-rootfs/live-build/make-lxd-metadata.py config/make-lxd-metadata
47 ;;
48 esac
49
50
51=== added file 'live-build/make-lxd-metadata.py'
52--- live-build/make-lxd-metadata.py 1970-01-01 00:00:00 +0000
53+++ live-build/make-lxd-metadata.py 2018-12-07 18:40:08 +0000
54@@ -0,0 +1,49 @@
55+#! /usr/bin/python3
56+
57+"""Make a metadata.yaml file for a LXD image."""
58+
59+import argparse
60+import json
61+import sys
62+import time
63+
64+
65+# Map dpkg architecture names to LXD architecture names.
66+lxd_arches = {
67+ "amd64": "x86_64",
68+ "arm64": "aarch64",
69+ "armhf": "armv7l",
70+ "i386": "i686",
71+ "powerpc": "ppc",
72+ "ppc64el": "ppc64le",
73+ "s390x": "s390x",
74+ }
75+
76+
77+def main():
78+ parser = argparse.ArgumentParser()
79+ parser.add_argument("series", help="Ubuntu series name")
80+ parser.add_argument("architecture", help="Ubuntu architecture name")
81+ args = parser.parse_args()
82+
83+ metadata = {
84+ "architecture": lxd_arches[args.architecture],
85+ "creation_date": int(time.time()),
86+ "properties": {
87+ "os": "Ubuntu",
88+ "series": args.series,
89+ "architecture": args.architecture,
90+ "description": "Ubuntu buildd %s %s" % (
91+ args.series, args.architecture),
92+ },
93+ }
94+
95+ # Encoding this as JSON is good enough, and saves pulling in a YAML
96+ # library dependency.
97+ json.dump(
98+ metadata, sys.stdout, sort_keys=True, indent=4, separators=(",", ": "),
99+ ensure_ascii=False)
100+
101+
102+if __name__ == "__main__":
103+ main()

Subscribers

People subscribed via source and target branches