-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[Bug] Namespace=None in packages.py, prevents proper comparison between Specs. #1622
Description
@tgamblin
The problem was that things "don't work." See below for an (eventual) summary of how I got it working.
To simplify things, I've hacked my openmpi/package.py as follows:
# version('2.0.0', 'cdacc800cb4ce690c1f1273cb6366674')
# version('1.10.3', 'e2fe4513200e2aaa1500b762342c674b')
# version('1.10.2', 'b2f43d9635d2d52826e5ef9feb97fd4c')
version('1.10.1', 'f0fcd77ed345b7eafb431968124ba16e')
version('1.10.0', '280cf952de68369cebaca886c5ce0304')
version('1.8.8', '0dab8e602372da1425e9242ae37faf8c')
version('1.6.5', '03aed2a4aa4d0b27196962a2a65fc475')
...
# provides('mpi@:2.2', when='@1.6.5')
# provides('mpi@:3.0', when='@1.7.5:')
provides('mpi@:3.0', when='@1.10.1:')
# provides('mpi@:3.1', when='@2.0.0:')
spack spec mpi gives the right answer: [email protected]%[email protected]~mxm~pmi~psm~psm2~slurm~sqlite3~thread_multiple~tm+verbs+vt arch=linux-SuSE11-x86_64
HOWEVER... now I put the following in my packages.yaml file:
openmpi:
paths:
[email protected]: /usr/local/other/SLES11.3/openmpi/1.10.1/gcc-5.3
buildable: False
This causes spack spec mpi to crash:
Traceback (most recent call last):
File "/home/rpfische/spack2/bin/spack", line 184, in <module>
main()
File "/home/rpfische/spack2/bin/spack", line 161, in main
return_val = command(parser, args)
File "/gpfsm/dnb53/rpfische/spack2/lib/spack/spack/cmd/spec.py", line 57, in spec
spec.concretize()
File "/gpfsm/dnb53/rpfische/spack2/lib/spack/spack/spec.py", line 1252, in concretize
self._expand_virtual_packages(),
File "/gpfsm/dnb53/rpfische/spack2/lib/spack/spack/spec.py", line 1169, in _expand_virtual_packages
spec)
File "/gpfsm/dnb53/rpfische/spack2/lib/spack/spack/concretize.py", line 129, in choose_virtual_or_external
candidates = self._valid_virtuals_and_externals(spec)
File "/gpfsm/dnb53/rpfische/spack2/lib/spack/spack/concretize.py", line 121, in _valid_virtuals_and_externals
usable.sort(cmp=cmp_externals)
File "/gpfsm/dnb53/rpfische/spack2/lib/spack/spack/concretize.py", line 108, in cmp_externals
bi = candidates.index(b)
ValueError: list.index(x): x not in list
I added some debugging printout to see what's going on:
def cmp_externals(a, b):
if a.name != b.name and (not a.external or a.external_module and
not b.external and b.external_module):
# We're choosing between different providers, so
# maintain order from provider sort
print('candidates', candidates)
print('a', a)
print('b', b, type(b))
ai = candidates.index(a)
print('ai', ai)
print('aa', [a == x for x in candidates])
print('bb', [b == x for x in candidates])
bi = candidates.index(b)
return ai - bi
I also did:
rm -rf ~/.spack/cache
Here's the output:
candidates [[email protected]:, mpich@1:, mpich@3:, intel-parallel-studio@cluster:+mpi, [email protected]:, [email protected]]
a mpich@1:
b [email protected] <class 'spack.spec.Spec'>
ai 1
aa [False, True, False, False, False, False]
bb [False, False, False, False, False, False]
Notice that [email protected]: != [email protected]! Hmm, maybe there's a problem with the colon. So I changed package.py to:
provides('mpi@:3.0', when='@1.10.1')
Then deleted the cache and tried again. Same result; now [email protected] != [email protected].
The key here seems to be that the [email protected] read from packages.yaml is incompatible with the same from elsewhere.