environments: transactional concretization

This commit is contained in:
Gregory Becker 2023-05-23 20:23:54 +02:00
parent e1bcefd805
commit 0f1d36585e

View File

@ -1346,24 +1346,33 @@ def concretize(self, force=False, tests=False):
List of specs that have been concretized. Each entry is a tuple of List of specs that have been concretized. Each entry is a tuple of
the user spec and the corresponding concretized spec. the user spec and the corresponding concretized spec.
""" """
if force: old_concretized_user_specs = self.concretized_user_specs[:]
# Clear previously concretized specs old_concretized_order = self.concretized_order
self.concretized_user_specs = [] old_specs_by_hash = self.specs_by_hash
self.concretized_order = []
self.specs_by_hash = {}
# Pick the right concretization strategy try:
if self.unify == "when_possible": if force:
return self._concretize_together_where_possible(tests=tests) # Clear previously concretized specs
self.concretized_user_specs = []
self.concretized_order = []
self.specs_by_hash = {}
if self.unify is True: # Pick the right concretization strategy
return self._concretize_together(tests=tests) if self.unify == "when_possible":
return self._concretize_together_where_possible(tests=tests)
if self.unify is False: if self.unify is True:
return self._concretize_separately(tests=tests) return self._concretize_together(tests=tests)
msg = "concretization strategy not implemented [{0}]" if self.unify is False:
raise SpackEnvironmentError(msg.format(self.unify)) return self._concretize_separately(tests=tests)
msg = "concretization strategy not implemented [{0}]"
raise SpackEnvironmentError(msg.format(self.unify))
except Exception:
self.concretized_user_specs = old_concretized_user_specs
self.concretized_order = old_concretized_order
self.specs_by_hash = old_specs_by_hash
def _get_specs_to_concretize( def _get_specs_to_concretize(
self, self,