specs: save/restore concrete & patches when exporting/importing Specs

This commit is contained in:
Elizabeth Fischer 2018-05-18 16:34:11 -07:00 committed by Todd Gamblin
parent 7f224b616d
commit 037457adc9

View File

@ -1462,6 +1462,13 @@ def to_node_dict(self, hash_function=None, all_deps=False):
'module': self.external_module
}
d['concrete'] = self._concrete
if 'patches' in self.variants:
variant = self.variants['patches']
if hasattr(variant, '_patches_in_order_of_appearance'):
d['patches'] = variant._patches_in_order_of_appearance
# TODO: restore build dependencies here once we have less picky
# TODO: concretization.
if all_deps:
@ -1553,6 +1560,19 @@ def from_node_dict(node):
spec.external_path = None
spec.external_module = None
if 'concrete' in node:
spec._concrete = node['concrete']
if 'patches' in node:
patches = node['patches']
if len(patches) > 0:
mvar = spec.variants.setdefault(
'patches', MultiValuedVariant('patches', ())
)
mvar.value = patches
# FIXME: Monkey patches mvar to store patches order
mvar._patches_in_order_of_appearance = patches
# Don't read dependencies here; from_node_dict() is used by
# from_yaml() to read the root *and* each dependency spec.