spack arch currently has a --known-targets flag that prints a list of targets it is capable of detecting. I would like to add --known-platforms and --known-operating-systems flags that do the same thing.
Oftentimes, when writing a package, you need to add conflicts for all platforms/OSes other than a certain one. For example, py-matplotlib backend=macosx only works on darwin, so the package contains:
msg = 'MacOSX backend requires the Cocoa headers included with XCode'
conflicts('platform=linux', when='backend=macosx', msg=msg)
conflicts('platform=bgq', when='backend=macosx', msg=msg)
conflicts('platform=cray', when='backend=macosx', msg=msg)
However, I have no way of knowing if this is all the platforms that Spack knows of. Until we have a way of expressing "not" in the spec syntax, we should at least be able to list all platforms/OSes Spack is aware of.
I completely agree with adding the two flags, but the use case would probably be better solved by allowing logical operators in constraints:
conflicts('backend=macosx', 'NOT platform=darwin', msg=msg)
Most helpful comment
I completely agree with adding the two flags, but the use case would probably be better solved by allowing logical operators in constraints: