summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-05-26 20:16:22 +0100
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-05-28 22:36:49 +0100
commit016398f3720fcc46a53eeed69cb12a933f38bea4 (patch)
tree56c293ee4a7bd5308d2a25bf72480abdcc594108
parentd33e0c8a967d13e546272b660e24987b91968408 (diff)
downloadybd-016398f3720fcc46a53eeed69cb12a933f38bea4.tar.gz
Make 'contents' field dict, containing splits if any
-rw-r--r--ybd/assembly.py6
-rw-r--r--ybd/cache.py2
-rw-r--r--ybd/definitions.py9
3 files changed, 8 insertions, 9 deletions
diff --git a/ybd/assembly.py b/ybd/assembly.py
index e740839..f4dd30a 100644
--- a/ybd/assembly.py
+++ b/ybd/assembly.py
@@ -94,9 +94,9 @@ def install_contents(defs, component, contents=None):
if component.get('kind', 'chunk') == 'system':
artifacts = None
- for index, path in enumerate(component['contents']):
- if path == this['path']:
- artifacts = component['splits'][index]
+ for content in component['contents']:
+ if content.keys()[0] == this['path']:
+ artifacts = content[this['path']]
break
if config.get('default-splits', []) != []:
diff --git a/ybd/cache.py b/ybd/cache.py
index 63fc8f9..d800b43 100644
--- a/ybd/cache.py
+++ b/ybd/cache.py
@@ -80,7 +80,7 @@ def hash_factors(defs, definition):
hash_factors[factor] = cache_key(defs, factor)
for factor in definition.get('contents', []):
- hash_factors[factor] = cache_key(defs, factor)
+ hash_factors[factor.keys()[0]] = cache_key(defs, factor.keys()[0])
for factor in ['tree', 'submodules'] + defs.defaults.build_steps:
if definition.get(factor):
diff --git a/ybd/definitions.py b/ybd/definitions.py
index 3f7a17a..29a3997 100644
--- a/ybd/definitions.py
+++ b/ybd/definitions.py
@@ -34,6 +34,7 @@ class ExplicitDumper(yaml.SafeDumper):
def ignore_aliases(self, data):
return True
+
class Definitions(object):
def __init__(self, directory='.'):
@@ -143,11 +144,9 @@ class Definitions(object):
# system .morph file.
item['contents'] = item.get('contents', [])
item['contents'] += item.pop('chunks', []) + item.pop('strata', [])
- item['splits'] = []
lookup = {}
for index, component in enumerate(item['contents']):
- item['splits'] += [None]
self._fix_keys(component)
lookup[component['name']] = component['path']
if component['name'] == item['name']:
@@ -159,8 +158,8 @@ class Definitions(object):
component['build-depends'] = (item.get('build-depends', []) +
component.get('build-depends', []))
- item['splits'][index] = component.get('artifacts', None)
- item['contents'][index] = self._insert(component)
+ splits = component.get('artifacts', [])
+ item['contents'][index] = {self._insert(component): splits}
return self._insert(item)
@@ -229,7 +228,7 @@ class Definitions(object):
if type(item) is str:
return self._data.get(item)
- return self._data.get(item['path'])
+ return self._data.get(item.get('path', item.keys()[0]))
def _check_trees(self):
'''True if the .trees file matches the current working subdirectories