How does apt-get choose which alternative when there are alternative dependencies?

Asked by mrantims

I understand that in the Depends: section of the deb control files, a package may specify alternative dependencies separated by '|' symbol to satisfy a single dependency. For example, if a package depends on java and in the Depends section we have openjdk-6-jre | sun-java6-jre, how can I force apt-get to install openjdk-6-jre provided that the system does not have either packages installed?

My question is, how does apt-get decides which one to install when there are alternatives? Does it use the same order as how they are specified in the depends line or is there a way to create a sort of a list using something similar to apt_preferences?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Doug McMahon
Solved:
Last query:
Last reply:
Revision history for this message
Sam_ (and-sam) said :
#1

Which Ubuntu release is it, which package depends on sun java?

https://help.ubuntu.com/community/Java
< Oracle (Sun) Java 6 is no longer available to be distributed by Ubuntu, because of license issues. >

Revision history for this message
mrantims (mrantims) said :
#2

It is just an example scenario, you can think of any two packages that are given as alternative to each other as a dependency for a package.

Revision history for this message
Best Doug McMahon (mc3man) said :
#3

In the case of an alternative(s) it will install the first listed that is available

Revision history for this message
mrantims (mrantims) said :
#4

Thanks Doug McMahon, that solved my question.