Fri, 30 Nov 2007 22:45:06 +0100 -n Xavier <shiningxc@gmail.com> írta:
On Fri, Nov 30, 2007 at 08:37:13AM -0600, Dan McGee wrote:
I'll be looking at it this weekend for sure. The "check localdb by hand" comment scares me a bit, but I haven't dove into the code yet.
Maybe some pseudo-code could help, but not sure if it's a good idea.
compute_requiredby(pkg) : for p in localdb for dep in p.deps if pkg satisfies dep add p to the return list
checkdeps : for p in {upgrade U remove} for q in compute_requiredby(p) for dep in q.deps if p satisfies dep /* check if dep is still satisfied by another pkg */
The minor problems with the above : 1) the localdb is scanned n times, with n = length of upgrade + remove lists. 2) the dependency that is the cause of q being required by p is lost (the "for dep in q.deps; if p satisfies dep ..." is done twice : first in compute_requiredby , then again in checkdeps)
Instead of that, the localdb just needs to be scanned once. And for each package, we check if it depends on a package going to be upgraded or removed. Some other small "issues": And when you compute requiredby you needn't check the whole db, dblist (see my patch) is enough (what's more: needed), which can be much smaller with -Su for example [however, you must dblist once] And compute_requiredby returns with a list of strings (grr), and you must do pkgcache scan for find the package. Bye