[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Depending on Virtual Packages (Public Service Announcement)

  Just a reminder to everyone about how to depend on virtual packages.  I 
thought this knowledge was widespread, but I recently ran up against this 
problem in one of our core packages.

  When your package Depends upon or Recommends a pure-virtual package P, you 
should always OR the dependency with a dependency on something that provides 
P, as a hint to the package manager (particularly apt).  For instance, if you 
want to depend on an MTA, you should not write this:

Depends: mail-transport-agent

  Instead, you should write something like this:

Depends: exim4 | mail-transport-agent

  The reason is that when apt is trying to resolve dependencies, the first 
form will cause it to arbitrarily pick a package that provides 
"mail-transport-agent" for installation.  This is really all it *can* do, 
since it has no way to choose between them.  As a result, it might 
install exim4, ssmtp, nullmailer, or even courier-mta.  In the last case, 
installing your package will pull in an entire Web server, which is probably 
not what you want!

  The second form avoids this problem by giving apt a specific package to try 
first.  If the dependency is not satisfied, apt will try to select exim4 for 
installation, rather than grabbing a random provider of m-t-a.

  The same goes for Recommends, as those are also supposed to be installed 
automatically (although most frontends seem to ignore them).


/------------------- Daniel Burrows <dburrows@debian.org> ------------------\
|                  "Truly, you have a dizzying intellect."                  |
|                    -- "The Princess Bride"                                |
\--------------------- A duck! -- http://www.python.org --------------------/

Attachment: pgpnNQzUIlTQ_.pgp
Description: PGP signature

Reply to: