bugfix: conflicts should print out the spec that has the conflict (#11947)

- Fix a bug introdcued by removing parse_anonymous_spec()

- Conflicts' when specs are now *actually* anonymous, and the name of the
  package is implicit, so we need to remember to add it back to error
  messages.
This commit is contained in:
Todd Gamblin 2019-07-08 08:00:43 -07:00 committed by GitHub
parent e8506994b1
commit 51b58f1478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2017,13 +2017,18 @@ def concretize(self, tests=False):
# Now that the spec is concrete we should check if # Now that the spec is concrete we should check if
# there are declared conflicts # there are declared conflicts
#
# TODO: this needs rethinking, as currently we can only express
# TODO: internal configuration conflicts within one package.
matches = [] matches = []
for x in self.traverse(): for x in self.traverse():
for conflict_spec, when_list in x.package_class.conflicts.items(): for conflict_spec, when_list in x.package_class.conflicts.items():
if x.satisfies(conflict_spec, strict=True): if x.satisfies(conflict_spec, strict=True):
for when_spec, msg in when_list: for when_spec, msg in when_list:
if x.satisfies(when_spec, strict=True): if x.satisfies(when_spec, strict=True):
matches.append((x, conflict_spec, when_spec, msg)) when = when_spec.copy()
when.name = x.name
matches.append((x, conflict_spec, when, msg))
if matches: if matches:
raise ConflictsInSpecError(self, matches) raise ConflictsInSpecError(self, matches)