diff options
Diffstat (limited to 'lib/swupd/rootfs.py')
-rw-r--r-- | lib/swupd/rootfs.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/swupd/rootfs.py b/lib/swupd/rootfs.py index 53cef55..9cf9b37 100644 --- a/lib/swupd/rootfs.py +++ b/lib/swupd/rootfs.py @@ -1,7 +1,7 @@ import os import bb import oe.path -from swupd.utils import manifest_to_file_list +from swupd.utils import manifest_to_file_list, create_content_manifests from swupd.path import copyxattrfiles @@ -30,11 +30,15 @@ def create_rootfs(d): bb.debug(2, 'Skipping swupd_create_rootfs(), original rootfs can be used as no additional bundles are defined') return + contentsuffix = d.getVar('SWUPD_ROOTFS_MANIFEST_SUFFIX', True) + imagesuffix = d.getVar('SWUPD_IMAGE_MANIFEST_SUFFIX', True) + suffixes = (contentsuffix, imagesuffix) + # Sanity checking was already done in swupdimage.bbclass. # Here we can simply use the settings. imagebundles = d.getVarFlag('SWUPD_IMAGES', imageext, True).split() if imageext else [] rootfs = d.getVar('IMAGE_ROOTFS', True) - rootfs_contents = [] + rootfs_contents = set() if not pn_base: # the base image import subprocess @@ -46,23 +50,20 @@ def create_rootfs(d): outfile = d.expand('${WORKDIR}/orig-rootfs-manifest.txt') rootfs = d.getVar('IMAGE_ROOTFS', True) # Generate a manifest of the current file contents - # TODO: use the same common utility method - manifest_cmd = 'cd %s && find . ! -path . > %s' % (rootfs, outfile) - subprocess.call(manifest_cmd, shell=True, stderr=subprocess.STDOUT) - # Remove the current rootfs contents - oe.path.remove('%s/*' % rootfs) - for entry in manifest_to_file_list(outfile): - rootfs_contents.append(entry[2:]) + create_content_manifests(rootfs, outfile, None, []) + rootfs_contents.update(manifest_to_file_list(outfile)) # clean up os.unlink(outfile) else: # non-base image, i.e. swupdimage - manifest = d.expand("${DEPLOY_DIR_SWUPD}/image/${OS_VERSION}/os-core${SWUPD_ROOTFS_MANIFEST_SUFFIX}") - rootfs_contents.extend(manifest_to_file_list(manifest)) + manifest = d.expand("${DEPLOY_DIR_SWUPD}/image/${OS_VERSION}/os-core") + for suffix in suffixes: + rootfs_contents.update(manifest_to_file_list(manifest + suffix)) bb.debug(3, 'rootfs_contents has %s entries' % (len(rootfs_contents))) for bundle in imagebundles: - manifest = d.expand("${DEPLOY_DIR_SWUPD}/image/${OS_VERSION}/%s${SWUPD_ROOTFS_MANIFEST_SUFFIX}") % bundle - rootfs_contents.extend(manifest_to_file_list(manifest)) + manifest = d.expand("${DEPLOY_DIR_SWUPD}/image/${OS_VERSION}/") + bundle + for suffix in suffixes: + rootfs_contents.update(manifest_to_file_list(manifest + suffix)) mega_rootfs = d.getVar('MEGA_IMAGE_ROOTFS', True) bb.debug(2, 'Re-copying rootfs contents from mega image %s to %s' % (mega_rootfs, rootfs)) |