Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

My question is, how does apt-get decides which one to install when there are alternatives?

Is there a way to manually alter this selection using something similar to apt_preferences?

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

In the Debian Policy Manual, Chapter 7 - Declaring relationships between packages you can read

In the Depends, Recommends, Suggests, Pre-Depends, Build-Depends and Build-Depends-Indep control fields of the package, which declare dependencies on other packages, the package names listed may also include lists of alternative package names, separated by vertical bar (pipe) symbols |. In such a case, if any one of the alternative packages is installed, that part of the dependency is considered to be satisfied.

I cannot find any other useful information about list of alternatives in the whole document, so I should conclude that, in case none of the packages in the list is already installed, the first one in the list would be chosen. But be aware that this is only my interpretation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.