Skip to content

Computing full_hash() of external package fails #8929

@scottwittenburg

Description

@scottwittenburg

What does it (should it) mean to compute the full_hash() of a concretized spec of an external package like opengl or openglu, which are both system providers of virtual packages? I'm getting a stack trace that doesn't seem to state the true problem.

Expected Result

I would expect/hope for either an exception stating that the full_hash cannot be computed for this kind of package, or else perhaps it should work and actually compute the hash. I'm actually unsure of what the expected behavior should be.

Actual Result

There are two different cases for what actually happens, depending on whether you have an entry in your local packages.yaml or not. Let's consider the opengl case for the time being, though I verified that openglu has the same issue.

Case 1: You have an entry in packages.yaml

Mine looks like this:

packages:
  opengl:
    paths:
      [email protected]: /opt/opengl
    buildable: False

Then I do:

$ spack python
Spack version 0.11.2
Python 2.7.12, Linux x86_64
>>> from spack.spec import Spec
>>> s1 = Spec('opengl')
>>> s1.concretize()
>>> s1.full_hash()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/data/scott/projects/spack/lib/spack/spack/spec.py", line 1442, in full_hash
    package_hash = self.package.content_hash()
  File "/data/scott/projects/spack/lib/spack/spack/package.py", line 1084, in content_hash
    source_id = fs.for_package_version(self, self.version).source_id()
  File "/data/scott/projects/spack/lib/spack/spack/fetch_strategy.py", line 1051, in for_package_version
    return _extrapolate(pkg, version)
  File "/data/scott/projects/spack/lib/spack/spack/fetch_strategy.py", line 1022, in _extrapolate
    return URLFetchStrategy(pkg.url_for_version(version))
ExtrapolationError: Can't extrapolate a URL for version 4.5.0 because package opengl defines no URLs

Case 2: You don't have an entry in packages.yaml

When I removed my packages.yaml and tried again, the problem was a little different:

$ spack python
Spack version 0.11.2
Python 2.7.12, Linux x86_64
>>> from spack.spec import Spec
>>> s1 = Spec('opengl')
>>> s1.concretize()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/data/scott/projects/spack/lib/spack/spack/spec.py", line 1847, in concretize
    self._concretize_helper())
  File "/data/scott/projects/spack/lib/spack/spack/spec.py", line 1690, in _concretize_helper
    concretizer.concretize_version(self),
  File "/data/scott/projects/spack/lib/spack/spack/concretize.py", line 216, in concretize_version
    raise NoValidVersionError(spec)
NoValidVersionError: There are no valid versions for opengl that match ':'

Steps to reproduce the issue

Hopefully the information above is enough to reproduce the issue, but please let me know if more is needed.

Information on your system

$ uname -a
Linux beast 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions