From 34c29fa69216442b282912889a10427f5a2f8993 Mon Sep 17 00:00:00 2001 From: Cody Shepherd Date: Tue, 16 Oct 2018 09:53:42 -0700 Subject: [PATCH] swapped arg order in common function; added logging function to parser script. --- live-build/functions | 5 ++--- live-build/snap_seed_parse.py | 11 ++++++++--- .../ubuntu-cpc/hooks/031-0-create-root-dir.binary | 3 +-- .../ubuntu-server/hooks/030-root-squashfs.binary | 3 +-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/live-build/functions b/live-build/functions index e05e59ce..0295dc47 100644 --- a/live-build/functions +++ b/live-build/functions @@ -44,10 +44,9 @@ create_empty_disk_image() { } create_manifest() { - local dpkg_opts=${1} + local chroot_root=${1} local target_file=${2} - local chroot_root=${3} - dpkg-query ${dpkg_opts} > ${target_file} + dpkg-query --show --admindir="${chroot_root}/var/lib/dpkg" > ${target_file} (>&2 echo "create_manifest chroot_root: ${chroot_root}") /build/config/snap_seed_parse "${chroot_root}" >> ${target_file} } diff --git a/live-build/snap_seed_parse.py b/live-build/snap_seed_parse.py index d062b357..14ff0cbc 100755 --- a/live-build/snap_seed_parse.py +++ b/live-build/snap_seed_parse.py @@ -10,12 +10,17 @@ import sys import yaml import os.path -sys.stderr.write("Parsing seed.yaml\n") + +def log(msg): + sys.stderr.write("snap_seed_parse: {}\n".format(msg)) + + +log("Parsing seed.yaml") CHROOT_ROOT = sys.argv[1] if len(sys.argv) > 1 and len(sys.argv[1]) > 0 \ else '' '''The chroot rooth path should be passed in by the caller''' -sys.stderr.write("CHROOT_ROOT: {}\n".format(CHROOT_ROOT)) +log("CHROOT_ROOT: {}".format(CHROOT_ROOT)) if len(CHROOT_ROOT) > 0 and CHROOT_ROOT[-1] == '/': CHROOT_ROOT = CHROOT_ROOT[:-1] @@ -24,7 +29,7 @@ YAML_PATH = CHROOT_ROOT + '/var/lib/snapd/seed/seed.yaml' LINE_PREFIX = 'snap:' '''Snaps are prepended with this string in the manifest''' -sys.stderr.write("yaml path: {}\n".format(YAML_PATH)) +log("yaml path: {}".format(YAML_PATH)) if not os.path.isfile(YAML_PATH): sys.stderr.write("yaml path not found.\n") exit(1) diff --git a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary index 3d29ef5e..6ba4fe9c 100755 --- a/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary +++ b/live-build/ubuntu-cpc/hooks/031-0-create-root-dir.binary @@ -26,5 +26,4 @@ mkdir -p $rootfs_dir/lib/modules teardown_mountpoint $rootfs_dir -# dpkg-query --admindir=$rootfs_dir/var/lib/dpkg -W > $rootfs_dir.manifest -create_manifest "--admindir=${rootfs_dir}/var/lib/dpkg -W" "${rootfs_dir}.manifest" "${rootfs_dir}" +create_manifest "${rootfs_dir}" "${rootfs_dir}.manifest" diff --git a/live-build/ubuntu-server/hooks/030-root-squashfs.binary b/live-build/ubuntu-server/hooks/030-root-squashfs.binary index 6145f235..41c15001 100755 --- a/live-build/ubuntu-server/hooks/030-root-squashfs.binary +++ b/live-build/ubuntu-server/hooks/030-root-squashfs.binary @@ -28,8 +28,7 @@ cp -a chroot/* binary/boot/squashfs.dir squashfs_f="${PWD}/livecd.${PROJECT}.squashfs" squashfs_f_manifest="${squashfs_f}.manifest" -# dpkg-query --admindir=binary/boot/squashfs.dir/var/lib/dpkg -W > ${squashfs_f_manifest} -create_manifest "--admindir=binary/boot/squashfs.dir/var/lib/dpkg -W" "${squashfs_f_manifest}" "binary/boot/squashfs.dir" +create_manifest "binary/boot/squashfs.dir" "${squashfs_f_manifest}" (cd "binary/boot/squashfs.dir/" && mksquashfs . ${squashfs_f} \