On Wed, Jul 18, 2007 at 05:23:50PM +0200, Xavier wrote:
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..
Well, here is the original testdb file I already posted, plus the above suggestion implemented (which allows more efficient code + the detection of wrongly duplicated requiredby). But that really sucks of course :( I hate C.. There is really no clean way to do what I want? I guess I could create a new pkg structure type only for that testdb file, for storing the new requiredby field, or having a second local pkgcache (duplicating every package and storing them in a list, and modifying the requiredy field there). But the code is already huge compared to the simple things it does. It would make it even more huge :p I think I'll start learning C# so I can hack on Maelstorm when its released :) Or maybe the best thing here would be to use libalpm bindings with an higher level language.