swapped arg order in common function; added logging function to parser

script.
This commit is contained in:
Cody Shepherd 2018-10-16 09:53:42 -07:00
parent cb0f121d9f
commit 34c29fa692
No known key found for this signature in database
GPG Key ID: 0DB7E5F05C3FAB5F
4 changed files with 12 additions and 10 deletions

View File

@ -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}
}

View File

@ -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)

View File

@ -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"

View File

@ -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} \