mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-15 21:01:47 +00:00
Add a LXD image to builds for the buildd subproject
This commit is contained in:
parent
aec5f3666a
commit
6e9d7f35ca
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -1,6 +1,7 @@
|
|||||||
livecd-rootfs (2.408.43) UNRELEASED; urgency=medium
|
livecd-rootfs (2.408.43) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Add a buildd subproject.
|
* Add a buildd subproject.
|
||||||
|
* Add a LXD image to builds for the buildd subproject.
|
||||||
|
|
||||||
-- Colin Watson <cjwatson@ubuntu.com> Mon, 14 Jan 2019 17:45:38 +0000
|
-- Colin Watson <cjwatson@ubuntu.com> Mon, 14 Jan 2019 17:45:38 +0000
|
||||||
|
|
||||||
|
@ -415,6 +415,18 @@ elif [ "$SUBPROJECT" = buildd ]; then
|
|||||||
tar --transform='s,^binary,chroot-autobuild,' \
|
tar --transform='s,^binary,chroot-autobuild,' \
|
||||||
--sort=name --numeric-owner --xattrs \
|
--sort=name --numeric-owner --xattrs \
|
||||||
-czf "$PREFIX.rootfs.tar.gz" binary
|
-czf "$PREFIX.rootfs.tar.gz" binary
|
||||||
|
|
||||||
|
# Build a LXD image as well, which is preferable for some build types.
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
config/make-lxd-metadata "${LB_DISTRIBUTION%-*}" "$ARCH" >"$TMPDIR/metadata.yaml"
|
||||||
|
tar --numeric-owner -cf "$PREFIX.lxd.tar" -C "$TMPDIR" metadata.yaml
|
||||||
|
rm -rf "$TMPDIR"
|
||||||
|
# When using the combined metadata/rootfs form, the rootfs must be
|
||||||
|
# under rootfs/ rather than under chroot-autobuild/.
|
||||||
|
tar --transform='s,^binary,rootfs,' \
|
||||||
|
--sort=name --numeric-owner \
|
||||||
|
-rf "$PREFIX.lxd.tar" binary
|
||||||
|
gzip -9 "$PREFIX.lxd.tar"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PROJECT:${SUBPROJECT:-}" = "ubuntu-core:system-image" ]; then
|
if [ "$PROJECT:${SUBPROJECT:-}" = "ubuntu-core:system-image" ]; then
|
||||||
|
@ -663,6 +663,8 @@ case $SUBPROJECT in
|
|||||||
add_package install build-essential
|
add_package install build-essential
|
||||||
# Needed for LXD-based builds.
|
# Needed for LXD-based builds.
|
||||||
add_package install init
|
add_package install init
|
||||||
|
|
||||||
|
cp -af /usr/share/livecd-rootfs/live-build/make-lxd-metadata.py config/make-lxd-metadata
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
49
live-build/make-lxd-metadata.py
Executable file
49
live-build/make-lxd-metadata.py
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
|
||||||
|
"""Make a metadata.yaml file for a LXD image."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
# Map dpkg architecture names to LXD architecture names.
|
||||||
|
lxd_arches = {
|
||||||
|
"amd64": "x86_64",
|
||||||
|
"arm64": "aarch64",
|
||||||
|
"armhf": "armv7l",
|
||||||
|
"i386": "i686",
|
||||||
|
"powerpc": "ppc",
|
||||||
|
"ppc64el": "ppc64le",
|
||||||
|
"s390x": "s390x",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("series", help="Ubuntu series name")
|
||||||
|
parser.add_argument("architecture", help="Ubuntu architecture name")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
metadata = {
|
||||||
|
"architecture": lxd_arches[args.architecture],
|
||||||
|
"creation_date": int(time.time()),
|
||||||
|
"properties": {
|
||||||
|
"os": "Ubuntu",
|
||||||
|
"series": args.series,
|
||||||
|
"architecture": args.architecture,
|
||||||
|
"description": "Ubuntu buildd %s %s" % (
|
||||||
|
args.series, args.architecture),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
# Encoding this as JSON is good enough, and saves pulling in a YAML
|
||||||
|
# library dependency.
|
||||||
|
json.dump(
|
||||||
|
metadata, sys.stdout, sort_keys=True, indent=4, separators=(",", ": "),
|
||||||
|
ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
x
Reference in New Issue
Block a user