[Apt-Rpm] multiple good providers, how does apt pick the right one?

Panu Matilainen pmatilai at laiskiainen.org
Thu Feb 21 05:22:45 PST 2008


On Mon, 18 Feb 2008, Vincent Danen wrote:

> I've got a question here about how apt picks from multiple good
> providers of a dependency.
>
> For instance, I want to have meta-packages that are nothing but requires
> on packages.  I have a task-mail package which has requires on
> imaps-server and pops-server, and this is provided by both dovecot and
> courier-imap.
>
> apt isn't letting me choose, however, which one to install.  It's
> arbitrarily selecting courier-imap, so it seems to be
> alphabetical-based, which is ok, but coming from something like urpmi
> where it asks you to pick which package to install, that was the
> behaviour I was hoping to get.
>
> For instance, if neither courier-imap nor dovecot is installed and a
> user does "apt-get install task-mail", I want it to ask them which they
> want installed.  Another example would be for a virtual provides of
> "smtpdaemon"... both postfix and exim provide it, but I suspect that apt
> will arbitrarily pick exim, which isn't what I want.
>
> Is there a way to accomplish this with apt?

I'm afraid not. Like you noticed, when a package depends on a virtual 
provide, whatever matches the provide first is picked. OTOH when you try 
to install a virtual provide with several provides directly, it'll ask you 
to choose one. Inconsistent, annoying and limiting :-/

The problem is that way too much logic is built into apt-get itself 
instead of libapt-pkg: on direct install of virtual provide, it's apt-get 
that "manually" looks for the providers, but when processing a dependency, 
it's libapt-pkg which just picks whatever has highest priority.

I remember having had a look at this at some point, possibly while 
scratching head over handling multilib issues, and IIRC strange things 
started happening when messing with MarkInstall() logic. But that's a 
long time ago and memory is hazy...

One possibility might be adding a lua slot into the provider selection, 
that'd allow building in special policies for things that need it (would 
help dealing with kernel module packages a lot for example), with 
possibility to go interactive when necessary / appropriate etc.

 	- Panu -



More information about the Apt-Rpm mailing list