summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2018-02-06 10:50:49 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2018-03-20 00:29:54 -0700
commite97c28e5b3c8b65dc57d6fe737a14b7bc2a5d8ac (patch)
tree9bdf94f1aad0405dd60395bd0f18d99e3674b538 /lib
parent2379ed54b9e8183bec8487c08d66e5f4c51eeb64 (diff)
downloadspack-e97c28e5b3c8b65dc57d6fe737a14b7bc2a5d8ac.tar.gz
spack-e97c28e5b3c8b65dc57d6fe737a14b7bc2a5d8ac.tar.bz2
spack-e97c28e5b3c8b65dc57d6fe737a14b7bc2a5d8ac.tar.xz
spack-e97c28e5b3c8b65dc57d6fe737a14b7bc2a5d8ac.zip
package: ensure patches are applied in-order
This helps to ensure that patches are applied consistently and will also be used as the source for the patch part of full package hashes.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 0b49cf5db3..19a565e019 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -37,6 +37,7 @@ import contextlib
import copy
import functools
import inspect
+import itertools
import os
import re
import shutil
@@ -1107,7 +1108,7 @@ class PackageBase(with_metaclass(PackageMeta, object)):
# Apply all the patches for specs that match this one
patched = False
- for patch in patches:
+ for patch in self.patches_to_apply():
try:
with working_dir(self.stage.source_path):
patch.apply(self.stage)
@@ -1151,6 +1152,15 @@ class PackageBase(with_metaclass(PackageMeta, object)):
else:
touch(no_patches_file)
+ def patches_to_apply(self):
+ """If the patch set does not change between two invocations of spack,
+ then all patches in the set will be applied in the same order"""
+ patchesToApply = itertools.chain.from_iterable(
+ patch_list
+ for spec, patch_list in self.patches.items()
+ if self.spec.satisfies(spec))
+ return sorted(patchesToApply, key=lambda p: p.path_or_url)
+
@property
def namespace(self):
namespace, dot, module = self.__module__.rpartition('.')