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
This commit is contained in:
scheibelp 2017-10-06 14:23:28 -07:00 committed by Todd Gamblin
parent 3d8d3e8882
commit b08d457dfd
2 changed files with 18 additions and 1 deletions

View File

@ -1888,7 +1888,7 @@ def _mark_concrete(self, value=True):
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

View File

@ -32,6 +32,7 @@
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 fail_while_writing():
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