in legacy/autodmg_cache_builder/autodmg_cache_build.py [0:0]
def process_manifest_for_key(manifest, manifest_key, parentcatalogs=None):
"""
Process keys in manifests to get the lists of items to install and remove.
Can be recursive if manifests include other manifests.
Probably doesn't handle circular manifest references well.
manifest can be a path to a manifest file or a dictionary object.
"""
if isinstance(manifest, basestring): # NOQA
display.display_debug1(
"** Processing manifest %s for %s" %
(os.path.basename(manifest), manifest_key))
manifestdata = manifestutils.get_manifest_data(manifest)
else:
manifestdata = manifest
manifest = 'embedded manifest'
cataloglist = manifestdata.get('catalogs')
if cataloglist:
catalogs.get_catalogs(cataloglist)
elif parentcatalogs:
cataloglist = parentcatalogs
if not cataloglist:
display.display_warning('Manifest %s has no catalogs', manifest)
return
for item in manifestdata.get('included_manifests', []):
nestedmanifestpath = manifestutils.get_manifest(item)
if not nestedmanifestpath:
raise manifestutils.ManifestException
process_manifest_for_key(nestedmanifestpath, manifest_key, cataloglist)
return (cataloglist, manifestdata.get(manifest_key, []))