Comment 31 for bug 1874272

Revision history for this message
Julian Andres Klode (juliank) wrote :

So at the moment this loops over all packages that seem obsolete, and tries to remove them and then undoes that if it removes other packages, using one actiongroup per package. This is horrible.

What we should do is use the ProblemResolver's resolve_by_keep something like this

with an actiongroup:
   problemsolver = apt_pkg.ProblemResolver(depcache)
   for package in obsolete:
       depcache.mark_delete(package)
   for package in not_obsolete:
       depcache.mark_keep(package)
       problemsolver.protect(package)
   problemsolver.resolve_by_keep()

Caveat is that this may also affect any other actions currently queued, but I think at this point there aren't any others.