diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2016-10-20 11:41:20 +0100 |
---|---|---|
committer | Daniel Firth <dan.firth@codethink.co.uk> | 2016-10-28 11:58:52 +0100 |
commit | d7ca2d2b34c18d56500a97027f94af33056d5d0b (patch) | |
tree | ad58f8d952ae49ba12cbe2c71f724335c38c6581 | |
parent | 1e1ff006ffe45ccf99d28b43875ea47e42f556b0 (diff) | |
download | ybd-lc/010.tar.gz |
Include all artifacts if not explicitly givenlc/010
Include all the stratum artifacts if no one was explicitly given using
the `artifact` field when building a system.
This fixes a problem where the non-minimal systems in definitions were
not including the artifacts on build-essential-minimal.
-rw-r--r-- | ybd/splitting.py | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/ybd/splitting.py b/ybd/splitting.py index 2a45b1a..1d8862a 100644 --- a/ybd/splitting.py +++ b/ybd/splitting.py @@ -31,21 +31,6 @@ def install_split_artifacts(dn): sandbox to the dn['install'] ''' - all_splits = [] - for i in app.defs.defaults['split-rules']['assemblage']: - all_splits += [i['artifact']] - for index, content in enumerate(dn['contents']): - for stratum, artifacts in content.items(): - if artifacts == []: - if config.get('default-splits', []) != []: - for split in config.get('default-splits'): - artifacts += [app.defs.get(stratum)['name'] + split] - else: - for split in all_splits: - artifacts += [os.path.basename(stratum) + split] - - dn['contents'][index] = {stratum: artifacts} - for content in dn['contents']: key = list(content.keys())[0] stratum = app.defs.get(key) @@ -53,19 +38,25 @@ def install_split_artifacts(dn): def move_required_files(dn, stratum, artifacts): - log(dn, 'Installing %s artifacts' % stratum['name'], artifacts) stratum_metadata = get_metadata(stratum) split_stratum_metadata = {} - split_stratum_metadata['products'] = [] - to_keep = [] - for product in stratum_metadata['products']: - for artifact in artifacts: - if artifact == product['artifact']: - to_keep += product['components'] - split_stratum_metadata['products'].append(product) - - log(dn, 'Splitting artifacts:', artifacts, verbose=True) - log(dn, 'Splitting components:', to_keep, verbose=True) + if not artifacts: + # Include all artifacts if no ones were explicitly given for an + # included stratum on a system. + artifacts = [p['artifact'] for p in stratum_metadata['products']] + + to_keep = [component + for product in stratum_metadata['products'] + for component in product['components'] + if product['artifact'] in artifacts] + + split_stratum_metadata['products'] = ( + [product + for product in stratum_metadata['products'] + if product['artifact'] in artifacts]) + + log(dn, 'Installing %s artifacts' % stratum['name'], artifacts) + log(dn, 'Installing components:', to_keep, verbose=True) baserockpath = os.path.join(dn['install'], 'baserock') if not os.path.isdir(baserockpath): |