bugfix: preserve patch ordering when specs are copied

- The `Spec` class maintains a special `_patches_in_order_of_appearance`
  attribute on patch variants, but it is was preserved when specs are
  copied.

- This caused issues for some builds

- Add special logic to `Spec` to preserve this variant on copy

- TODO: in the long term we should get rid of the special variant and
  make it the responsibility of one of the variant classes.
This commit is contained in:
Todd Gamblin 2018-11-03 00:23:06 -07:00
parent a41bce2148
commit 13aca774e3

View File

@ -2709,6 +2709,15 @@ def _dup(self, other, deps=True, cleardeps=True, caches=None):
self.compiler_flags = other.compiler_flags.copy()
self.compiler_flags.spec = self
self.variants = other.variants.copy()
# FIXME: we manage _patches_in_order_of_appearance specially here
# to keep it from leaking out of spec.py, but we should figure
# out how to handle it more elegantly in the Variant classes.
for k, v in other.variants.items():
patches = getattr(v, '_patches_in_order_of_appearance', None)
if patches:
self.variants[k]._patches_in_order_of_appearance = patches
self.variants.spec = self
self.external_path = other.external_path
self.external_module = other.external_module