summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorscheibelp <scheibel1@llnl.gov>2017-10-06 14:23:28 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2017-10-06 14:23:28 -0700
commitb08d457dfda4e03c16cde1a1ea28a614b1e3a10e (patch)
tree2d98ed1f012b4129eba36e389358201a0e689adf /lib
parent3d8d3e888204d52008b8e2777ffa0605bfe9f9f7 (diff)
downloadspack-b08d457dfda4e03c16cde1a1ea28a614b1e3a10e.tar.gz
spack-b08d457dfda4e03c16cde1a1ea28a614b1e3a10e.tar.bz2
spack-b08d457dfda4e03c16cde1a1ea28a614b1e3a10e.tar.xz
spack-b08d457dfda4e03c16cde1a1ea28a614b1e3a10e.zip
Don't check package.installed in _mark_concrete if value=True (#5634)
* spec and spec.package.spec can refer to different objects in the database. When these two instances of spec differ in terms of the value of the 'concrete' property, Spec._mark_concrete can fail when checking Spec.package.installed (which requires package.spec to be concrete). This skips the check for spec.package.installed when _mark_concrete is called with 'True' (in other words, when the database is marking all specs as being concrete). * add test to confirm this fixes #5293
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py2
-rw-r--r--lib/spack/spack/test/database.py17
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 24da1af564..ea00e1723d 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1888,7 +1888,7 @@ class Spec(object):
unless there is a need to force a spec to be concrete.
"""
for s in self.traverse(deptype_query=all):
- if s.concrete and s.package.installed:
+ if (not value) and s.concrete and s.package.installed:
continue
s._normal = value
s._concrete = value
diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py
index 131730e40f..bc7354a4b4 100644
--- a/lib/spack/spack/test/database.py
+++ b/lib/spack/spack/test/database.py
@@ -32,6 +32,7 @@ import os.path
import pytest
import spack
import spack.store
+from spack.test.conftest import MockPackageMultiRepo
from spack.util.executable import Executable
from llnl.util.tty.colify import colify
@@ -380,6 +381,22 @@ def test_110_no_write_with_exception_on_install(database):
assert install_db.query('cmake', installed=any) == []
+def test_115_reindex_with_packages_not_in_repo(database, refresh_db_on_exit):
+ install_db = database.mock.db
+
+ saved_repo = spack.repo
+ # Dont add any package definitions to this repository, the idea is that
+ # packages should not have to be defined in the repository once they are
+ # installed
+ mock_repo = MockPackageMultiRepo([])
+ try:
+ spack.repo = mock_repo
+ spack.store.db.reindex(spack.store.layout)
+ _check_db_sanity(install_db)
+ finally:
+ spack.repo = saved_repo
+
+
def test_external_entries_in_db(database):
install_db = database.mock.db