I'm working on some machine setup instructions, and I was surprised to find out that apt-get install A B
can behave differently than apt-get install A && apt-get install B
.
My specific example is A == openjdk-7-jdk
and B == ant
.
So, openjdk-7-jdk
depends on openjdk-7-jre-headless
, which satisfies ant
's dependency java6-runtime-headless
. But if you install them as apt-get install openjdk-7-jdk ant
, APT doesn't seem to figure this out and installs default-jre-headless
. But if you install openjdk-7-jdk
prior to installing ant
, its dependency is satisfied and all is good.
APT is usually smart enough to figure this sort of thing out, so why can't it do so in this case? I'd like to have a better understanding as to why it works this way, so this sort of thing doesn't trip me up again in the future.
Best Answer
Seems that there is some kind of "weight" system playing here:
As you can see
ant
depends ofopenjdk-7-jdk
due a complicated and intricated amounts of suggestions, recommendations and dependency, while when usingopenjdk-6-jdk
the dependency is more direct:Of course
aptitude
methods of dependency resolution, could be different ofapt-get
's. BTW, running a simulation of ant without openjdk-7-jdk installed don't pulled openjdk-6-jdk:Maybe if you use the same methods as I did, you could figure out more, since I'm using Debian testing right now and repositories could have changed in the meanwhile.