From 197c549edb516379abccda84e957216a099c858b Mon Sep 17 00:00:00 2001 From: CloudBuilder Date: Tue, 29 Aug 2023 04:51:10 +0000 Subject: [PATCH] Imported 23.10.26 from mantic-release pocket. No reason for CPC update specified. --- debian/changelog | 39 +++++ live-build/auto/config | 2 + live-build/snap-seed-parse.py | 143 +++++++++++++++--- .../hooks/020-canary-enhanced-sb.binary | 54 ++----- .../ubuntu/hooks/020-canary-live.binary | 123 --------------- .../ubuntu/hooks/020-canary-live.chroot_early | 16 -- .../hooks/020-foreign-arch.chroot_early | 18 +++ update-source-catalog | 2 +- 8 files changed, 190 insertions(+), 207 deletions(-) create mode 100755 live-build/ubuntu/hooks/020-foreign-arch.chroot_early diff --git a/debian/changelog b/debian/changelog index e37561c6..94d6501c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,42 @@ +livecd-rootfs (23.10.26) mantic; urgency=medium + + [ Łukasz 'sil2100' Zemczak ] + * Update the enhanced-sb layer model to not preinstall the printing snaps, + per changes to seeds. Live layer model not changed as it will go away + soon per our staged changes. + + [ Michael Hudson-Doyle ] + * Use a traditional seed.yaml style seed for the canary installer's live + + -- Łukasz 'sil2100' Zemczak Mon, 28 Aug 2023 12:13:38 +0200 + +livecd-rootfs (23.10.25) mantic; urgency=medium + + * snap-seed-parse.py: fix builds with no snaps. + + -- Michael Hudson-Doyle Mon, 28 Aug 2023 14:02:56 +1200 + +livecd-rootfs (23.10.24) mantic; urgency=medium + + * update-source-catalog: Fix case where a variaton does not point at the + base layer (i.e. most builds) (LP: #2033168) + * Configure universe sources in canary ISO. (LP: #2033109) + * snap-seed-parse.py: Update to allow parsing uc20-style seeds. + (LP: #2028984) + + -- Michael Hudson-Doyle Mon, 28 Aug 2023 12:48:53 +1200 + +livecd-rootfs (23.10.23) mantic; urgency=medium + + * i386 foreign-arch support was added for the canary image before 23.04 + released, but by mistake it was only added to the squashfs for the live + session, and not the squashfs layer used as the source for installation. + split the chroot hooks to add this to the standard.squashfs. + LP: #2033170. + * Drop mke2fs.conf override, no longer needed. + + -- Steve Langasek Sat, 26 Aug 2023 16:34:27 -0700 + livecd-rootfs (23.10.22) mantic; urgency=medium * Undo preseeding in reset_snapd_state. diff --git a/live-build/auto/config b/live-build/auto/config index c2e969fc..451a7d61 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -722,6 +722,7 @@ case $PROJECT in esac ;; canary) + touch config/universe-enabled PASSES_TO_LAYERS="true" # the standard layer, contains all base common packages for later layers add_task standard minimal standard ubuntu-desktop ubuntu-desktop-default-languages @@ -730,6 +731,7 @@ case $PROJECT in # TODO: we should probably add the kernel per KERNEL_FLAVOURS add_package standard.live linux-generic casper lvm2 mdadm cryptsetup dctrl-tools remove_package standard.live ubiquity-frontend-gtk + add_snap standard.live ubuntu-desktop-installer/classic # the enhanced-secureboot layer, contains all packages for the enhanced secureboot install add_package standard.enhanced-secureboot cryptsetup boot-managed-by-snapd diff --git a/live-build/snap-seed-parse.py b/live-build/snap-seed-parse.py index 0e47231c..c8ea8b4f 100755 --- a/live-build/snap-seed-parse.py +++ b/live-build/snap-seed-parse.py @@ -10,6 +10,7 @@ The $chroot_dir argument is optional and will default to the empty string. """ import argparse +import glob import os.path import re import yaml @@ -32,37 +33,129 @@ CHROOT_ROOT = ARGS.chroot FNAME = ARGS.file # Trim any trailing slashes for correct appending +CHROOT_ROOT = CHROOT_ROOT.rstrip('/') log("CHROOT_ROOT: {}".format(CHROOT_ROOT)) -if len(CHROOT_ROOT) > 0 and CHROOT_ROOT[-1] == '/': - CHROOT_ROOT = CHROOT_ROOT[:-1] - -# This is where we expect to find the seed.yaml file -YAML_PATH = CHROOT_ROOT + '/var/lib/snapd/seed/seed.yaml' # Snaps are prepended with this string in the manifest LINE_PREFIX = 'snap:' +# This is where we expect to find the seed.yaml file +YAML_PATH = CHROOT_ROOT + '/var/lib/snapd/seed/seed.yaml' + log("yaml path: {}".format(YAML_PATH)) -if not os.path.isfile(YAML_PATH): - log("WARNING: yaml path not found; no seeded snaps found.") - exit(0) + + +def make_manifest_from_seed_yaml(path): + with open(YAML_PATH, 'r') as fh: + yaml_lines = yaml.safe_load(fh)['snaps'] + + 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, + )) + + +def look_for_uc20_model(chroot): + systems_dir = f"{chroot}/var/lib/snapd/seed/systems" + if not os.path.isdir(systems_dir): + log("no systems directory found") + return None + modeenv = f"{chroot}/var/lib/snapd/modeenv" + system_name = None + if os.path.isfile(modeenv): + log(f"found modeenv file at {modeenv}") + with open(modeenv) as fh: + for line in fh: + if line.startswith("recovery_system="): + system_name = line.split('=', 1)[1].strip() + log(f"read system name {system_name!r} from modeenv") + break + if system_name is None: + system_names = os.listdir(systems_dir) + if len(system_names) == 0: + log("no systems found") + return None + elif len(system_names) > 1: + log("multiple systems found, refusing to guess which to parse") + return None + else: + system_name = system_names[0] + log(f"parsing only system found {system_name}") + system_dir = f"{chroot}/var/lib/snapd/seed/systems/{system_name}" + if not os.path.isdir(system_dir): + log(f"could not find system called {system_name}") + return None + return system_dir + + +def parse_assertion_file(asserts, filename): + # Parse the snapd assertions file 'filename' and store the + # assertions found in 'asserts'. + with open(filename) as fp: + text = fp.read() + + k = '' + + for block in text.split('\n\n'): + if block.startswith('type:'): + this_assert = {} + for line in block.split('\n'): + if line.startswith(' '): + this_assert[k.strip()] += '\n' + line + continue + k, v = line.split(':', 1) + this_assert[k.strip()] = v.strip() + asserts.setdefault(this_assert['type'], []).append(this_assert) + + +def make_manifest_from_system(system_dir): + files = [f"{system_dir}/model"] + glob.glob(f"{system_dir}/assertions/*") + + asserts = {} + for filename in files: + parse_assertion_file(asserts, filename) + + [model] = asserts['model'] + snaps = yaml.safe_load(model['snaps']) + + snap_names = [] + for snap in snaps: + snap_names.append(snap['name']) + snap_names.sort() + + snap_name_to_id = {} + snap_id_to_rev = {} + for decl in asserts['snap-declaration']: + snap_name_to_id[decl['snap-name']] = decl['snap-id'] + for rev in asserts['snap-revision']: + snap_id_to_rev[rev['snap-id']] = rev['snap-revision'] + + log('Writing manifest to {}'.format(FNAME)) + + with open(FNAME, 'a+') as fh: + for snap_name in snap_names: + channel = snap['default-channel'] + rev = snap_id_to_rev[snap_name_to_id[snap_name]] + fh.write(f"{LINE_PREFIX}{snap_name}\t{channel}\t{rev}\n") + + +if os.path.isfile(YAML_PATH): + log(f"seed.yaml found at {YAML_PATH}") + make_manifest_from_seed_yaml(YAML_PATH) else: - log("yaml path found.") + system_dir = look_for_uc20_model(CHROOT_ROOT) + if system_dir is None: + log("WARNING: could not find seed.yaml or uc20-style seed") + exit(0) + make_manifest_from_system(system_dir) -with open(YAML_PATH, 'r') as fh: - yaml_lines = yaml.safe_load(fh)['snaps'] - -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/hooks/020-canary-enhanced-sb.binary b/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary index 8e1f6239..cb86e471 100644 --- a/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary +++ b/live-build/ubuntu/hooks/020-canary-enhanced-sb.binary @@ -26,7 +26,7 @@ esac cat < config/classic-model.model type: model authority-id: canonical -revision: 3 +revision: 4 series: 16 brand-id: canonical model: ubuntu-classic-2310-amd64 @@ -86,49 +86,19 @@ snaps: id: IrwRHakqtzhFRHJOOPxKVPU0Kk7Erhcu name: snapd-desktop-integration type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: m1eQacDdXCthEwWQrESei3Zao3d5gfJF - name: cups - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: d1yehor45vFG9GdKjmgdqbnBuKtR0Qa4 - name: ghostscript-printer-app - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: 3wnSvqxn6OqPBuioytBcdnR2UBaUzvPC - name: gutenprint-printer-app - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: PPjo7KVjJvmdYUeUt9LqmKRrgmGdWPyM - name: hplip-printer-app - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: WJKWBUuCDufOFw2p24tvkbbw02plGkbd - name: ipp-usb - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: 5xUmM1J4qSfki63gfpEDcrr1wU1FdP2k - name: ps-printer-app - type: app -timestamp: 2023-08-22T12:00:00.0Z +timestamp: 2023-08-24T12:00:00.0Z sign-key-sha3-384: 9tydnLa6MTJ-jaQTFUXEwHl1yRx7ZS4K5cyFDhYDcPzhS7uyEkDxdUjg9g08BtNn -AcLBXAQAAQoABgUCZOTCgQAKCRDgT5vottzAEkN9D/9CM4jsP7D6j5CIMM2t4P7A5Hcq+LB/+wEi -h9uqr6CbsJazgPS6Y4nZnu5NRz/irwxFyzWLiqbwqdyNgu7Y+2G0PPzo3MgCzjV93hRkPlOmLXHd -dtDw6XOXThMLBVSriAft8lKLhzYoX2qw2fP7Wys1NUlRIMYHvJMdHdrVQgoAz+W8qAlbSQ9VSTSc -xaMConnt5rtOJ9Aw8Er3NZEx5wfpzriGJ1L7T9qUsijVq6On4W4aCUJtKHplsV2LRsn+HSLLae7h -ULCCpUy88D3uNOoAPBRjY9Vm64/gtvMpYOztqhukT7OMDigH6RD6g0qfgS8aC4x/Ok6OIZpNnP0f -Iy4cx5DepdIR4sMlBtfQhenkG49gkNyUxtbN1XeS1N21cBsNysBL8CSBucR3plPOWYSthrwWgRpD -qv0DA/SIzntFxRUFh34f0ESLSJja/WrmEbSzk7EfloauY/2gWQ7B+NHnddTI/uBKpssi+rhJlUq8 -Hec1La/U+fv0WOWg3tD71lbNqFCQv02vi5az15NfRxI9K2K72rWvmhaUuQQUZPBitBTmTX8rG3pb -Aw00idWo5/hAgSpcOIoEhntkxfgLpoK2s8EX1USPk5XW+9XITEsKFyC3UVBgsRDqRMLWn1Eketyv -ejP1SS6R9LyritULe9w7lcxRlg8f4G+scUYSyBjLDA== +AcLBXAQAAQoABgUCZOjUagAKCRDgT5vottzAEgUCD/9ZjBDGZZv7cbIvPWUpqx42XeespLf6xJK6 +iadXGNJD910+RkzMPrxAtoo8tmYYIrrbw2Q9lbNOcMfl2akxV+TJzYez2J6V/6wvaPraCFbIdKhr +d+bI3e1QTxdlejfc3Nu4ImhKlFEsYrYJZIwAcm7btvmoidoQBXSoUxc7lDt5vdv4mN+bVvVOhew9 +/FG7U+G5w4yZzkW5rH1lhBGIZX76D6+/3AVlC/R69mBUPDNDeGj48IUT8iV58cYYprchMbw4LIU6 +l92wqbhl3uQveoWUqirHbQYa8q7D85XnvlukaPb3LQL6rJzuAU1G1jmLPkMz5mqQsRBBuhC9skR4 +UWHK7TWsKSlWmCfZAVn9wZezPZ4M+dQv8QNb7JpCmVNZ4GL/uMOds213FTeNJhowVfqgT1sMv9LP +H8mPIB1COn50+6XpZPUj49i2yiVN+BeuhRG9BDdstDie8gNOMvJgyvh0WmfgmIQcCuRgzheqj/co +0a8WuqYLsmyQCERP1fhuR/27d5+Dxg7DuiwocZwgXjtRkhUJrCnNWJnY//03sVXilFitEdlLVPt7 +WVhBSGHlrIaayLiOmCshvLqKZN5Cum9hXZ+wxWI/liG27eXOwaMDKPg/KeyxsHWNrXyuT5ZrTL7w +eAEuriz8mNgmJtzImEkhymjuAuSTL284F1WpeW/cIg== EOF channel="" diff --git a/live-build/ubuntu/hooks/020-canary-live.binary b/live-build/ubuntu/hooks/020-canary-live.binary index e0e294e3..2e5e014d 100755 --- a/live-build/ubuntu/hooks/020-canary-live.binary +++ b/live-build/ubuntu/hooks/020-canary-live.binary @@ -22,129 +22,6 @@ esac . config/binary . config/functions -# env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-installer-classic-2310-amd64 > config/classic-model-installer.model -cat < config/classic-model-installer.model -type: model -authority-id: canonical -revision: 3 -series: 16 -brand-id: canonical -model: ubuntu-installer-classic-2310-amd64 -architecture: amd64 -base: core22 -classic: true -distribution: ubuntu -grade: signed -snaps: - - - default-channel: latest/stable - id: amcUKQILKXHHTlmSa7NMdnXSx02dNeeT - name: core22 - type: base - - - default-channel: latest/stable - id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4 - name: snapd - type: snapd - - - classic: true - default-channel: latest/stable/ubuntu-23.10 - id: rQm0TtMOYOtEslvEXgxQDhgy1JNn38Wz - name: ubuntu-desktop-installer - type: app - - - default-channel: latest/stable - id: EISPgh06mRh1vordZY9OZ34QHdd7OrdR - name: bare - type: base - - - default-channel: latest/stable/ubuntu-23.10 - id: 3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk - name: firefox - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: lATO8HzwVvrAPrlZRAWpfyrJKlAJrZS3 - name: gnome-42-2204 - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: jZLfBRzf1cYlYysIjD2bwSzNtngY0qit - name: gtk-common-themes - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: gjf3IPXoRiipCu9K0kVu52f0H56fIksg - name: snap-store - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: IrwRHakqtzhFRHJOOPxKVPU0Kk7Erhcu - name: snapd-desktop-integration - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: m1eQacDdXCthEwWQrESei3Zao3d5gfJF - name: cups - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: d1yehor45vFG9GdKjmgdqbnBuKtR0Qa4 - name: ghostscript-printer-app - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: 3wnSvqxn6OqPBuioytBcdnR2UBaUzvPC - name: gutenprint-printer-app - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: PPjo7KVjJvmdYUeUt9LqmKRrgmGdWPyM - name: hplip-printer-app - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: WJKWBUuCDufOFw2p24tvkbbw02plGkbd - name: ipp-usb - type: app - - - default-channel: latest/stable/ubuntu-23.10 - id: 5xUmM1J4qSfki63gfpEDcrr1wU1FdP2k - name: ps-printer-app - type: app -timestamp: 2023-08-22T12:00:00.0Z -sign-key-sha3-384: 9tydnLa6MTJ-jaQTFUXEwHl1yRx7ZS4K5cyFDhYDcPzhS7uyEkDxdUjg9g08BtNn - -AcLBXAQAAQoABgUCZOTCgQAKCRDgT5vottzAEvDYD/97aa0ub3eq1zzUpMRDXY+NoHMLOON5zBgA -qLmpZq9ECZtuT0Tsyn/znlx2g15r8erzlgQtg/lS8iLIk0PqmwE/BB4ntdLQ3P56Rxz/YvkoK31B -519vOcpLlXxyVHsG4u3IjsEtPBlm4dmnzuuJodiRF4g4iXlxIQpcCkUm1gTHKof6NUlne7VwNty7 -8GvinPZtoTDVc6i+VftzUAbnqtifSlvxUseDvRkZrYX44FWKfEz7qqGQVdtwmZrP/ab+nc0CA+Nz -p6pn1wBrXk4y3EGw5RWQJvY5PzE5E7fCCirUW6SWpZ15jGK7pKGtXK2TJQlgsILeVp40FhnX5+As -9EnJpCCPYn8ZkKKjL9dCvmBSaKsqC0SVPYeB+T6PG2ANEHooaALvoiSTUVCM4HnBvjMtSXJpOPE7 -FzfyL9z4mKtNF82NmHc9Oms7QfuX70jQ0mgS/NDy6Te+4dhZ5QpLZzkwed/SWGmHGADPPV6Dxhcd -N5sjPPhhAJ6A2EyJQrKY3dOUt/vlu04C1TZCQwz9aQJO5hEaC3E/+ci8IVBRhDAvKJJ4iuTdO/k2 -SRiShTD1s/mua3D01bN2gGoyh2DY4lFKro28by4Ci0QXSBOIVTk+GnWAOwJCnbB636PZD9Ipf29L -ri86PlIOcM1OvSROryexBE+aNuWZYBwvJIo2kMYfVw== -EOF - -channel="" -if [ -n "${CHANNEL:-}" ]; then - channel="--channel $CHANNEL" -fi - -reset_snapd_state chroot - -env SNAPPY_STORE_NO_CDN=1 snap prepare-image \ - --classic config/classic-model-installer.model $channel chroot -mv chroot/system-seed/systems/* chroot/system-seed/systems/classic-installer -rm -rf chroot/var/lib/snapd/seed -mv chroot/system-seed chroot/var/lib/snapd/seed - -cat < chroot/var/lib/snapd/modeenv -mode=run -recovery_system=classic-installer -EOF - mv chroot/boot/initrd.img-* ${PWD}/livecd.${PROJECT}.initrd-generic mv chroot/boot/vmlinu?-* ${PWD}/livecd.${PROJECT}.kernel-generic chmod a+r ${PWD}/livecd.${PROJECT}.initrd-generic ${PWD}/livecd.${PROJECT}.kernel-generic diff --git a/live-build/ubuntu/hooks/020-canary-live.chroot_early b/live-build/ubuntu/hooks/020-canary-live.chroot_early index f5f165a5..06e2739e 100755 --- a/live-build/ubuntu/hooks/020-canary-live.chroot_early +++ b/live-build/ubuntu/hooks/020-canary-live.chroot_early @@ -10,15 +10,6 @@ case ${PASS:-} in ;; esac -# TODO: Make sure this is only executed for canary builds (in a way -# other then relying on the fact that these hooks are only copied for -# an ubuntu:canary build) - -# As described in LP: #2025339, an initrd built from a jammy userspace -# (which is what we use for canary builds currently) cannot fsck a -# mantic root filesystem created with the default options. -sed -i -e 's/,orphan_file//' /etc/mke2fs.conf - cat < /etc/initramfs-tools/conf.d/casperize.conf export CASPER_GENERATE_UUID=1 EOF @@ -26,10 +17,3 @@ EOF cat < /etc/initramfs-tools/conf.d/default-layer.conf LAYERFS_PATH=${PASS}.squashfs EOF - -if [ "$(dpkg --print-architecture)" = amd64 ]; then - echo "I: Enabling amd64 multiarch support on amd64" - dpkg --add-architecture i386 - - apt-get -y update -fi diff --git a/live-build/ubuntu/hooks/020-foreign-arch.chroot_early b/live-build/ubuntu/hooks/020-foreign-arch.chroot_early new file mode 100755 index 00000000..540cab3b --- /dev/null +++ b/live-build/ubuntu/hooks/020-foreign-arch.chroot_early @@ -0,0 +1,18 @@ +#! /bin/sh + +set -eu + +case ${PASS:-} in + standard) + ;; + *) + exit 0 + ;; +esac + +if [ "$(dpkg --print-architecture)" = amd64 ]; then + echo "I: Enabling amd64 multiarch support on amd64" + dpkg --add-architecture i386 + + apt-get -y update +fi diff --git a/update-source-catalog b/update-source-catalog index 158f412e..6de025de 100755 --- a/update-source-catalog +++ b/update-source-catalog @@ -44,7 +44,7 @@ for entry in output: else: # No entry with this id found, so add a new one. - if template['variations']: + if 'variations' in template: for variation in template['variations'].values(): if variation['path'] == opts.squashfs: variation['size'] = int(opts.size)