From e3aca44601b8eeedaddd25909e29a48b290c293e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 20 Jul 2022 12:09:45 +0200 Subject: installer.py: require "explicit: True" in the install arguments to mark a package "explicit" (#31646) --- lib/spack/spack/installer.py | 3 ++- lib/spack/spack/test/installer.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index af34388eb4..6f6af97812 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -2212,7 +2212,8 @@ class BuildTask(object): @property def explicit(self): """The package was explicitly requested by the user.""" - return self.pkg == self.request.pkg + return self.pkg == self.request.pkg and \ + self.request.install_args.get('explicit', True) @property def key(self): diff --git a/lib/spack/spack/test/installer.py b/lib/spack/spack/test/installer.py index f2bd5e1a10..8a36978cab 100644 --- a/lib/spack/spack/test/installer.py +++ b/lib/spack/spack/test/installer.py @@ -1176,6 +1176,18 @@ def test_install_skip_patch(install_mockery, mock_fetch): assert inst.package_id(spec.package) in installer.installed +def test_install_implicit(install_mockery, mock_fetch): + """Test the path skip_patch install path.""" + spec_name = 'trivial-install-test-package' + const_arg = installer_args([spec_name], + {'fake': False}) + installer = create_installer(const_arg) + pkg = installer.build_requests[0].pkg + assert not create_build_task(pkg, {'explicit': False}).explicit + assert create_build_task(pkg, {'explicit': True}).explicit + assert create_build_task(pkg).explicit + + def test_overwrite_install_backup_success(temporary_store, config, mock_packages, tmpdir): """ -- cgit v1.2.3-70-g09d2