summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2022-06-06 17:33:03 -0500
committerGitHub <noreply@github.com>2022-06-06 15:33:03 -0700
commit9d7cc436732eaa21679480219a5c7ed96450eea0 (patch)
treec0a0ba9df9a4beb2cdc76fa9f3cf5415ef52a77f /lib
parent932065beca653ee7b0fa85f8bbf98c464294fad6 (diff)
downloadspack-9d7cc436732eaa21679480219a5c7ed96450eea0.tar.gz
spack-9d7cc436732eaa21679480219a5c7ed96450eea0.tar.bz2
spack-9d7cc436732eaa21679480219a5c7ed96450eea0.tar.xz
spack-9d7cc436732eaa21679480219a5c7ed96450eea0.zip
Package: Don't warn for missing source on bundle packages without code (#30913)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package_base.py2
-rw-r--r--lib/spack/spack/test/install.py18
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py
index 1c736fb326..f88d907974 100644
--- a/lib/spack/spack/package_base.py
+++ b/lib/spack/spack/package_base.py
@@ -1721,7 +1721,7 @@ class PackageBase(six.with_metaclass(PackageMeta, PackageViewMixin, object)):
# referenced by branch name rather than tag or commit ID.
env = spack.environment.active_environment()
from_local_sources = env and env.is_develop(self.spec)
- if not self.spec.external and not from_local_sources:
+ if self.has_code and 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'))
diff --git a/lib/spack/spack/test/install.py b/lib/spack/spack/test/install.py
index 42c68fd6bd..845bdd92b2 100644
--- a/lib/spack/spack/test/install.py
+++ b/lib/spack/spack/test/install.py
@@ -414,9 +414,27 @@ def test_nosource_pkg_install(
pkg.do_install()
out = capfd.readouterr()
assert "Installing dependency-install" in out[0]
+
+ # Make sure a warning for missing code is issued
assert "Missing a source id for nosource" in out[1]
+@pytest.mark.disable_clean_stage_check
+def test_nosource_bundle_pkg_install(
+ install_mockery, mock_fetch, mock_packages, capfd):
+ """Test install phases with the nosource-bundle package."""
+ spec = Spec('nosource-bundle').concretized()
+ pkg = spec.package
+
+ # Make sure install works even though there is no associated code.
+ pkg.do_install()
+ out = capfd.readouterr()
+ assert "Installing dependency-install" in out[0]
+
+ # Make sure a warning for missing code is *not* issued
+ assert "Missing a source id for nosource" not in out[1]
+
+
def test_nosource_pkg_install_post_install(
install_mockery, mock_fetch, mock_packages):
"""Test install phases with the nosource package with post-install."""