[Rpm-maint] Pruning self-dependencies?

Ville Skyttä ville.skytta at iki.fi
Mon Jul 2 18:50:03 UTC 2007


Hello,

Is there a good reason why packages "export" dependencies on things that they 
Provide/satisfy themselves?  For example, if a package ships/provides 
perl(Foo) and has some other things that also cause a dependency on 
perl(Foo), wouldn't it be a good idea to just prune the dependency at build 
time and not include it in the package's dependencies?  Pruning it would 
result in less dependencies in rpmdb, repository metadata etc etc.

The only case where I can see potential use for a self-dependency is that 
let's say my package foo needs something that is provided by a "virtual" 
package/Provides bar.  foo also includes an implementation of bar, but a very 
basic one, and there are other packages out there that include 
superior/alternative implementations of bar and Provide it.  Now, I 
have "Requires: bar" in foo, and when installing foo, depsolvers could 
present me a list of everything satisfying bar (including foo itself) and 
give me an option to choose one of them.  I think this is a pretty 
hypothetical case; are the depsolvers out there that would implement 
something like this?  apt at least used to list alternatives for a Provides, 
but what if the set of packages going to be installed anyway already satisfy 
it?

As for how many dependencies this would eliminate, running some quick queries 
[0] against the Fedora primary sqlite metadata database told me it'd be about 
7.3% of all dependencies (9246/126066).  This is inaccurate (no versions in 
dependencies taken into account etc) but I think it should be the correct 
order of magnitude.

Anyway, I'd guess it'd be fairly easy to implement the pruning in rpmbuild at 
build time - just first gather the Provides, then Requires, then drop all 
Requires that are satisfied by those Provides.

Worth it?  Did I miss something?


[0] Queries I used (might not hurt to check that they do what was intended):

- Total number of dependencies:
select count(*) from requires

- Number of self-dependencies:
select count(*) from packages p, requires r where p.pkgkey = r.pkgkey and 
exists (select pkgkey from provides where pkgkey = r.pkgkey and name = 
r.name)

- List of package keys, names and what they self-depend on:
select p.pkgkey, p.name, r.name from packages p, requires r where p.pkgkey = 
r.pkgkey and exists (select pkgkey from provides where pkgkey = r.pkgkey and 
name = r.name)



More information about the Rpm-maint mailing list