Mark external as explicit only when installing explicitly (#31665)
This commit is contained in:
parent
cfdfdf77e0
commit
fce861d2ac
@ -330,11 +330,10 @@ def _process_external_package(pkg, explicit):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Check if the package was already registered in the DB.
|
# Check if the package was already registered in the DB.
|
||||||
# If this is the case, then just exit.
|
# If this is the case, then only make explicit if required.
|
||||||
tty.debug('{0} already registered in DB'.format(pre))
|
tty.debug('{0} already registered in DB'.format(pre))
|
||||||
|
record = spack.store.db.get_record(spec)
|
||||||
# Update the explicit state if it is necessary
|
if explicit and not record.explicit:
|
||||||
if explicit:
|
|
||||||
spack.store.db.update_explicit(spec, explicit)
|
spack.store.db.update_explicit(spec, explicit)
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -1115,7 +1114,8 @@ def _add_tasks(self, request, all_deps):
|
|||||||
#
|
#
|
||||||
# External and upstream packages need to get flagged as installed to
|
# External and upstream packages need to get flagged as installed to
|
||||||
# ensure proper status tracking for environment build.
|
# ensure proper status tracking for environment build.
|
||||||
not_local = _handle_external_and_upstream(request.pkg, True)
|
explicit = request.install_args.get('explicit', True)
|
||||||
|
not_local = _handle_external_and_upstream(request.pkg, explicit)
|
||||||
if not_local:
|
if not_local:
|
||||||
self._flag_installed(request.pkg)
|
self._flag_installed(request.pkg)
|
||||||
return
|
return
|
||||||
|
@ -1289,3 +1289,16 @@ def test_term_status_line():
|
|||||||
x.add("a")
|
x.add("a")
|
||||||
x.add("b")
|
x.add("b")
|
||||||
x.clear()
|
x.clear()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('explicit_args,is_explicit', [
|
||||||
|
({'explicit': False}, False),
|
||||||
|
({'explicit': True}, True),
|
||||||
|
({}, True)
|
||||||
|
])
|
||||||
|
def test_single_external_implicit_install(install_mockery, explicit_args, is_explicit):
|
||||||
|
pkg = 'trivial-install-test-package'
|
||||||
|
s = spack.spec.Spec(pkg).concretized()
|
||||||
|
s.external_path = '/usr'
|
||||||
|
create_installer([(s, explicit_args)]).install()
|
||||||
|
assert spack.store.db.get_record(pkg).explicit == is_explicit
|
||||||
|
Loading…
Reference in New Issue
Block a user