diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2017-08-21 16:54:59 +0100 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2017-09-01 17:41:06 +0100 |
commit | 871128c2cb7561b9f3185ae7ce479c3648ccaca1 (patch) | |
tree | 9befa5baafddb4a7d7249ed4bfc5d7e2eff2b837 | |
parent | d6d56bec0e809b6f13eaa7f22be1ef3d724cbc5c (diff) | |
download | ybd-871128c2cb7561b9f3185ae7ce479c3648ccaca1.tar.gz |
Remove magic ref/sha logic
This has caused far more trouble than it's worth, just be explicit about
what should be used.
-rw-r--r-- | ybd/config/defaults.conf | 1 | ||||
-rw-r--r-- | ybd/morphs.py | 4 | ||||
-rw-r--r-- | ybd/pots.py | 11 |
3 files changed, 1 insertions, 15 deletions
diff --git a/ybd/config/defaults.conf b/ybd/config/defaults.conf index 8d3576b..c464b77 100644 --- a/ybd/config/defaults.conf +++ b/ybd/config/defaults.conf @@ -13,7 +13,6 @@ morph-fields: ['arch', 'max-jobs', 'morph', 'name', - 'orig_ref', 'path', 'prefix', 'products', diff --git a/ybd/morphs.py b/ybd/morphs.py index c99b36d..fe021ec 100644 --- a/ybd/morphs.py +++ b/ybd/morphs.py @@ -215,13 +215,9 @@ class Morphs(object): 'WARNING: multiple definitions of %s \n' % key, '%s | %s' % (dn.get(key), new_def[key]), exit=exit) - # If a sha was specified, we want to build it instead of the ref - # but preserve the ref in the output <target>.yml file. if new_def.get('sha'): if len(new_def['sha']) != 40: log(new_def, 'ERROR: invalid sha:', new_def['sha'], exit=True) - new_def['orig_ref'] = new_def['ref'] - new_def['ref'] = new_def['sha'] if dn is None: self._data[new_def['path']] = new_def diff --git a/ybd/pots.py b/ybd/pots.py index 90869a2..07bb644 100644 --- a/ybd/pots.py +++ b/ybd/pots.py @@ -54,17 +54,8 @@ class Pots(object): return self._data.get(dn.get('path', dn.keys()[0])) def save(self, filename): - - # Make a copy, restore any refs which may have been overridden - # with the sha field while building. - data = copy.deepcopy(self._data) - for key, value in data.items(): - if value.get('orig_ref') is not None: - value['ref'] = value['orig_ref'] - del value['orig_ref'] - with open(filename, 'w') as f: - f.write(morph_dump(data, self.defaults)) + f.write(morph_dump(self._data, self.defaults)) log('CHECK', 'Saved yaml definitions at', filename) def _load_pots(self, filename): |