On Wed, Jul 18, 2007 at 03:33:07PM +0200, ngaba@petra.hos.u-szeged.hu wrote:
Yes, but I was mostly asking about the implementation from Aurelien that was removed. If finally it was ok and it should be added back, or if it should be implemented in another better way.
Well, Aurelien's implementation is quite complicated (but maybe fine), I think easier to use alpm_db_get_pkg for dummy package "creation".
Bye, ngaba PS: After reading your code, it looks independent from libalpm version (it using alpm_depcmp), so it seems to be perfect ;-)
Hm finally it doesn't seem easy (on the code side) to detect invalid duplicated requiredby entries (after your new update_trans_depends function). For example if pkg1 has pkg2 twice in its requiredby field, while pkg2 satisfy only one dependency of pkg1. We can't just detect for duplicate in requiredby fields anymore, because they might be valid (if pkg2 provided two deps of pkg1). I would need to compute requiredby fields fully for each pkg, and compare to the old one. By calling check_depends(pkg) on all package from the local database, I have enough information for computing all requiredby fields. But the problem is I can't store these. In this part : 139 if(deppkg && alpm_depcmp(deppkg, dep)) { 140 found = 1; I would need to do something like : alpm_list_t *newrqdby = alpm_pkg_get_newrequiredby(deppkg); newrqdby = alpm_list_add(newrqdby, pkgname). And when everything is done, compare old and new requiredby lists for each package. But I don't see any way to do that. (that would also make my check_requiredby() function useless). Or maybe I could achieve the same (in a less efficient way) with a more complicated check_requiredby function. But on the algorithm side, this check_requiredby function is stupid because everything is done by check_depends..