This is mainly an RFC on the whole idea. Nagy, you made me think enough about it that I just went ahead and whipped something up. I'd first like to say that I did this in the quickest way possible, so there is no guarantee I did everything right. I also did nothing to optimize for efficiency. In some cases, we could be calling the alpm_pkg_compute_requiredby() function way more than we should, because I basically replaced any call to alpm_pkg_get_requiredby() with a corresponding alpm_pkg_compute_requiredby() and free(). Note that we should definitely find a way to pactest or otherwise test the computed requiredby entries. Some quick observations: $ time pacman -Qt > /dev/null (pacman 3, latest GIT release) real 0m0.084s user 0m0.020s sys 0m0.043s $ time ./src/pacman/pacman -Qt > /dev/null (with compute_requiredby switch) real 0m1.893s user 0m1.800s sys 0m0.037s Obviously a slowdown, but is it all that bad in the big scheme of things when corrupted requiredby entries no longer hurt us? Also: $ pacman -Qt > orphans-old $ ./src/pacman/pacman -Qt > orphans-new $ diff orphans-old orphans-new 5a6
agg 2.5-2 121a123 libnet 1.1.2.1-1 144a147 mysql 5.0.45-1 184a188 python-eyed3 0.6.14-1 237a242 ttf-bitstream-vera 1.10-5 306a312 xmlsec 1.2.10-3
At first, I was worried. Then I see that the new code is much better! openoffice-base has at least two stale entries in the requiredby fields of agg and xmlsec, while libnet is stale from being an old depend of ettercap. So yeah, this new code helps us in a lot of places (everywhere but speed). -Dan