Do not issue a warning for a missing source id when installing from local sources (#24960)

This commit is contained in:
Harmen Stoppels 2021-08-02 14:17:41 +02:00 committed by GitHub
parent d628e3ba5c
commit ac8521e9b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -1180,6 +1180,10 @@ def undevelop(self, spec):
return True
return False
def is_develop(self, spec):
"""Returns true when the spec is built from local sources"""
return spec.name in self.dev_specs
def concretize(self, force=False, tests=False):
"""Concretize user_specs in this environment.

View File

@ -1537,7 +1537,9 @@ def content_hash(self, content=None):
# should this attempt to download the source and set one? This
# probably only happens for source repositories which are
# referenced by branch name rather than tag or commit ID.
if not self.spec.external:
env = spack.environment.get_env(None, None)
from_local_sources = env and env.is_develop(self.spec)
if not self.spec.external and not from_local_sources:
message = 'Missing a source id for {s.name}@{s.version}'
tty.warn(message.format(s=self))
hash_content.append(''.encode('utf-8'))

View File

@ -2591,3 +2591,15 @@ def test_virtual_spec_concretize_together(tmpdir):
e.concretize()
assert any(s.package.provides('mpi') for _, s in e.concretized_specs())
def test_query_develop_specs():
"""Test whether a spec is develop'ed or not"""
env('create', 'test')
with ev.read('test') as e:
e.add('mpich')
e.add('mpileaks')
e.develop(Spec('mpich@1'), 'here', clone=False)
assert e.is_develop(Spec('mpich'))
assert not e.is_develop(Spec('mpileaks'))