I'm trying to master how APT pinning works under Debian, but I'm having a hard time grasping how it resolves priorities.
I have a source.list file that has the following entries in this exact order:
deb <repository> stretch main
deb <repository> testing main
deb <repository> unstable main
The following repository contains these packages per branch:
- stretch contains the package
dependency version 1.0; - testing contains the package
dependency version 2.0; - unstable contains the packages
programanddependency version 2.0;
The package program depends on dependency version 2.0.
I need to install the package program, but I want to install as few packages as possible from unstable, so I create the following preferences file to pin this branch:
Package: *
Pin: release a=unstable
Pin-Priority: -1
If I understand correctly how it works, it should install packages from unstable only when I explicitly tell APT to.
I also create a apt.conf file to ensure the stable branch is the default:
APT::Default-Release "stable";
After running the command apt-get update, the branches should have the following priorities:
stable: 990
testing: 500
unstable: -1
Now I want to install the package program, to do so, I run the following command:
apt-get install -t unstable program
So now my question is, from which branch will APT pull the package dependency version 2.0? As both testing and unstable have the same version of the package, which one will get picked?
If I understand correctly, APT with the -t unstable option, will set a 990 priority to the packages belonging to unstable, but from what I've experienced, it pulls it from testing.
So why does APT pulls packages from testing that has a priority of 500 while unstable as its set to 990? Also, what would be the optimal way to install as few packages as possible from unstable?