From 13aca774e3af1040e916bc9c53f1f84c6a42cc44 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sat, 3 Nov 2018 00:23:06 -0700 Subject: 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. --- lib/spack/spack/spec.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 8b48da52e5..084b8176ec 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2709,6 +2709,15 @@ class Spec(object): 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 -- cgit v1.2.3-70-g09d2