[pacman-dev] do we need requiredby?
Nagy Gabor
ngaba at bibl.u-szeged.hu
Mon Nov 12 11:21:31 EST 2007
> Well, nowadays I started to dislike requiredby:
> 1. The requiredby handling was _very_ negligent earlier, so most users have
> corrupt localdbs.
> 2. When the old deps.c just trusted on these fields blindly (-R), these db
> corruptions caused wrong pacman operation too. After we implemented a slower
> but
> more clever checkdeps, all of these problems disappeared.
> 3. So now a missing requiredby can generate a bug, a false cannot. Note: we
> use
> requiredby as a speed-up only (probably speed-up was the main reason for
> implementing it).
> 4. Do we really need this speed-up?
> a.) This is not as efficient as it could be:
> %REQUIREDBY% should show the dependency also [%REQUIREDBY% gcc:bash>=3.2];
> since
> now foo's %REQUIREDBY% says gcc only, so we have to _scan_ pkgcache for gcc;
> then check _all_ dependencies of gcc to find the foo-satisfies-this ones.
> b.) If we didn't use requiredby at all, we should just scan pkgcache (only
> once!, now we scans it n times, if foo has n requiredby fields), and simply
> check all depends of all packages to find the satisfied-by-foo dependencies.
> This would probably slower, and evaluate its degree, but testdb is extremely
> fast, which makes me optimist.
What's more, this is not a speed-up at all! So I'm pretty sure now, that storing
requiredby is _useless_ (no, even worse: a bug generator):
I simply forgot about update_requiredby! Requiredby is computed when the package
was born on localdb <- requiredby computation is ~exactly 4./b.). This result is
used only in the following cases:
*) by pacman: -Si and -Qi (wow), --orphan
*) deps.c/checkdeps && can_remove
*) libalpm/sync.c:566,1256 what are these?! we don't copy requiredby fields on
package upgrade neither, why should we copy it between to-be-replaced and replacer?!
[And I didn't say anything about trans_update_depends, grr.]
Summary: if we just simply followed 4./b.), we would compute requiredby on
package death instead of on package born. The question is: how many times we use
this information without removal (-Qi, -Si and can_remove, --orphan). But as
testdb shows: compute requiredby for _all_ packages is not costly at all.
So I will create a patch for killing requiredby soon. The patched pacman will be
compatible with the old dbs; however, old pacmans with new dbs will fail.
What do you say? Any contras? [my patch would simulate alpm_pkg_get_requiredby
with compute_requiredby]
Bye, ngaba
----------------------------------------------------
SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu
This mail sent through IMP: http://horde.org/imp/
More information about the pacman-dev
mailing list