diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index e1bb4d73e34..acb2af1a625 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -520,7 +520,8 @@ def _execute_conflicts(pkg): # Save in a list the conflicts and the associated custom messages when_spec_list = pkg.conflicts.setdefault(conflict_spec, []) - when_spec_list.append((when_spec, msg)) + msg_with_name = f"{pkg.name}: {msg}" if msg is not None else msg + when_spec_list.append((when_spec, msg_with_name)) return _execute_conflicts @@ -896,7 +897,8 @@ def _execute_requires(pkg): # Save in a list the requirements and the associated custom messages when_spec_list = pkg.requirements.setdefault(tuple(requirement_specs), []) - when_spec_list.append((when_spec, policy, msg)) + msg_with_name = f"{pkg.name}: {msg}" if msg is not None else msg + when_spec_list.append((when_spec, policy, msg_with_name)) return _execute_requires diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 7a4117667b2..acfd0326b1d 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -956,8 +956,8 @@ def target_ranges(self, spec, single_target_fn): return [fn.attr("node_target_satisfies", spec.name, target)] def conflict_rules(self, pkg): - default_msg = "{0} '{1}' conflicts with '{2}'" - no_constraint_msg = "{0} conflicts with '{1}'" + default_msg = "{0}: '{1}' conflicts with '{2}'" + no_constraint_msg = "{0}: conflicts with '{1}'" for trigger, constraints in pkg.conflicts.items(): trigger_msg = "conflict trigger %s" % str(trigger) trigger_id = self.condition(spack.spec.Spec(trigger), name=pkg.name, msg=trigger_msg)