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
This commit is contained in:
Michael Kuhn 2022-05-15 03:01:29 +02:00 committed by GitHub
parent bee311edf3
commit ff03e2ef4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,7 +235,7 @@ def is_ready(dag_hash):
# 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()
)