From bf046ff6e236b19666e8158212085bf25c53122d Mon Sep 17 00:00:00 2001 From: CloudBuilder Date: Sun, 11 Nov 2018 19:26:12 +0000 Subject: [PATCH] Imported 2.545 No reason for CPC update specified. --- debian/changelog | 13 +++++ live-build/auto/build | 2 +- live-build/functions | 2 +- live-build/snap-seed-parse.py | 48 ++++++++++++------- .../hooks/031-maas-squashfs.binary | 4 +- .../hooks/032-installer-squashfs.binary | 10 ++-- 6 files changed, 53 insertions(+), 26 deletions(-) diff --git a/debian/changelog b/debian/changelog index b84a17fb..3ca4212f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +livecd-rootfs (2.545) disco; urgency=medium + + [ Dimitri John Ledkov ] + * Do not mount result, on top of lowerdir, appears to fail in + disco. Should unblock building server-live images in disco. + * Also strip duplicate \n from the below. + + [ Cody Shepherd ] + * Fix snap-seed-parse to take filename argument instead of printing to + stdout + + -- Dimitri John Ledkov Fri, 09 Nov 2018 22:22:29 +0000 + livecd-rootfs (2.544) disco; urgency=medium [ Steve Langasek ] diff --git a/live-build/auto/build b/live-build/auto/build index 0bead613..c875d66e 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -552,7 +552,7 @@ fi # '--initramfs none' produces different manifest names. # NB! we want stdout appended to the manifest, yet stderr to be printed on stdout if [ -e "binary/$INITFS/filesystem.packages" ]; then - ./config/snap-seed-parse "chroot/" 2>&1 >> "binary/${INITFS}/filesystem.packages" + ./config/snap-seed-parse "chroot/" "binary/${INITFS}/filesystem.packages" ln "binary/$INITFS/filesystem.packages" "$PREFIX.manifest" chmod 644 "$PREFIX.manifest" fi diff --git a/live-build/functions b/live-build/functions index f12a364b..84c35702 100644 --- a/live-build/functions +++ b/live-build/functions @@ -50,7 +50,7 @@ create_manifest() { echo "create_manifest chroot_root: ${chroot_root}" dpkg-query --show --admindir="${chroot_root}/var/lib/dpkg" > ${target_file} echo "create_manifest call to dpkg-query finished." - ./config/snap-seed-parse "${chroot_root}" 2>&1 >> ${target_file} + ./config/snap-seed-parse "${chroot_root}" "${target_file}" echo "create_manifest call to snap_seed_parse finished." echo "create_manifest finished" } diff --git a/live-build/snap-seed-parse.py b/live-build/snap-seed-parse.py index c441dc5a..0e47231c 100755 --- a/live-build/snap-seed-parse.py +++ b/live-build/snap-seed-parse.py @@ -1,26 +1,35 @@ #!/usr/bin/python3 """ -Usage: snap-seed-parse ${chroot_dir} > somefile.manifest +Usage: snap-seed-parse [${chroot_dir}] This script looks for a seed.yaml path in the given root directory, parsing -it and printing generated manifest lines to stdout for easy redirection. +it and appending the parsed lines to the given output file. + +The $chroot_dir argument is optional and will default to the empty string. """ +import argparse +import os.path import re -import sys import yaml -import os.path def log(msg): - sys.stderr.write("snap-seed-parse: {}\n".format(msg)) + print("snap-seed-parse: {}".format(msg)) log("Parsing seed.yaml") -CHROOT_ROOT = sys.argv[1] if len(sys.argv) > 1 and len(sys.argv[1]) > 0 \ - else '' +parser = argparse.ArgumentParser() +parser.add_argument('chroot', nargs='?', default='', + help='root dir for the chroot from which to generate the ' + 'manifest') +parser.add_argument('file', help='Output manifest to this file') + +ARGS = parser.parse_args() +CHROOT_ROOT = ARGS.chroot +FNAME = ARGS.file # Trim any trailing slashes for correct appending log("CHROOT_ROOT: {}".format(CHROOT_ROOT)) @@ -43,14 +52,17 @@ else: with open(YAML_PATH, 'r') as fh: yaml_lines = yaml.safe_load(fh)['snaps'] -# Loop over dict items, outputting one manifest line from each triplet -for item in yaml_lines: - filestring = item['file'] - # Pull the revision number off the file name - revision = filestring[filestring.rindex('_')+1:] - revision = re.sub(r'[^0-9]', '', revision) - print("{}{}\t{}\t{}".format(LINE_PREFIX, - item['name'], - item['channel'], - revision, - )) +log('Writing manifest to {}'.format(FNAME)) + +with open(FNAME, 'a+') as fh: + for item in yaml_lines: + filestring = item['file'] + # Pull the revision number off the file name + revision = filestring[filestring.rindex('_')+1:] + revision = re.sub(r'[^0-9]', '', revision) + fh.write("{}{}\t{}\t{}\n".format(LINE_PREFIX, + item['name'], + item['channel'], + revision, + )) +log('Manifest output finished.') diff --git a/live-build/ubuntu-server/hooks/031-maas-squashfs.binary b/live-build/ubuntu-server/hooks/031-maas-squashfs.binary index ba348ba3..edbd20ba 100755 --- a/live-build/ubuntu-server/hooks/031-maas-squashfs.binary +++ b/live-build/ubuntu-server/hooks/031-maas-squashfs.binary @@ -40,7 +40,7 @@ mkdir -p "$OVERLAY_REGION_ROOT" # RACK is on top of the regular squashfs -mount_overlay "$SQUASH_ROOT/" "$OVERLAY_RACK_ROOT/" "$RACK_ROOT/" "RACK" +mount_overlay "$SQUASH_ROOT/" "$OVERLAY_RACK_ROOT/" "$RACK_ROOT/" setup_mountpoint $RACK_ROOT env DEBIAN_FRONTEND=noninteractive chroot $RACK_ROOT apt-get -y install maas-rack-controller @@ -54,7 +54,7 @@ umount "$RACK_ROOT" # Full MAAS (Region) is on top of the rack # in overlayfs lowerdir are mounted right to left, colon separated -mount_overlay "$OVERLAY_RACK_ROOT/:$SQUASH_ROOT/" "$OVERLAY_REGION_ROOT/" "$REGION_ROOT/" "REGION" +mount_overlay "$OVERLAY_RACK_ROOT/:$SQUASH_ROOT/" "$OVERLAY_REGION_ROOT/" "$REGION_ROOT/" setup_mountpoint $REGION_ROOT diff --git a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary index bab6ab76..b464f1f2 100755 --- a/live-build/ubuntu-server/hooks/032-installer-squashfs.binary +++ b/live-build/ubuntu-server/hooks/032-installer-squashfs.binary @@ -24,15 +24,17 @@ fi . config/functions . config/common -SQUASH_ROOT=binary/boot/squashfs.dir -OVERLAY_ROOT=binary/overlay +BOTTOM_ROOT=binary/boot/squashfs.dir +SQUASH_ROOT=binary/boot/squashfs-installer.dir +OVERLAY_ROOT=binary/overlay-installer +mkdir -p "$SQUASH_ROOT" mkdir -p "$OVERLAY_ROOT" # Create an installer squashfs layer -mount_overlay "$SQUASH_ROOT/" "$OVERLAY_ROOT/" "$SQUASH_ROOT/" +mount_overlay "$BOTTOM_ROOT/" "$OVERLAY_ROOT/" "$SQUASH_ROOT/" -setup_mountpoint binary/boot/squashfs.dir +setup_mountpoint $SQUASH_ROOT # Override JobRunningTimeoutSec to 0s on the .device unit that # subiquity_config.mount depends on to avoid a 5s delay on switching