From ff03e2ef4cf24c4682fdf2858d6a2be6001ac7ec Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Sun, 15 May 2022 03:01:29 +0200 Subject: uninstall: fix dependency check (#30674) The dependency check currently checks whether there are only build dependencies left for a particular package. However, the database also contains uninstalled packages, which can cause the check to fail. For instance, with `bison` and `flex` having already been uninstalled, `m4` will have the following dependents: ``` bison ('build', 'run')--> m4 flex ('build',)--> m4 libnl ('build',)--> m4 ``` `bison` and `flex` should be ignored in this case because they are not installed anymore. Fixes #30673 --- lib/spack/spack/cmd/uninstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py index f7fbd67754..37fe98d0d0 100644 --- a/lib/spack/spack/cmd/uninstall.py +++ b/lib/spack/spack/cmd/uninstall.py @@ -235,7 +235,7 @@ def do_uninstall(env, specs, force): # If this spec is only used as a build dependency, we can uninstall return all( - dspec.deptypes == ("build",) + dspec.deptypes == ("build",) or not dspec.parent.installed for dspec in record.spec.edges_from_dependents() ) -- cgit v1.2.3-60-g2f50