2007/6/18, ngaba@petra.hos.u-szeged.hu <ngaba@petra.hos.u-szeged.hu>:
As you see, this patch contains my usual "for (pkg in pkgcache) if(alpm_depcmp(pkg, depend))..." stuff. We should discuss something now: This method has a drawback sometimes in speed: This method implicitly reads the pkgcache with full pkginfo, because alpm_depcmp needs provisions. If we've already done this (or we need to do this later) or we must collect ALL dependency satisfier in pkgcache this is not a problem. However, for example if we just want to know if there is ANY package in pkgcache which satisfies a dependency (something similar to can_remove_package without using requiredby fields), then FIRST check for package names THEN for providers is probably faster, if the pkgcache is loaded with pkgname-pkgver info only: because we have great chance to find a satisfier pkgname-pkgver pair and we can stop, we can answer the question without reading the ugly PKGINFO files for providers.
Hmm, maybe this is an interesting idea, I don't know, but can't we decide about this later ? Once all this repetitive code is moved to one function, then it'll probably be much easier to see the benefit of only looking at providers in a second time. Sorry if I didn't understand or overlooked something :) Thanks