Given this /etc/apt/sources.list
file:
deb http://us.archive.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ disco main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ disco main restricted universe multiverse
and this /etc/apt/preferences
file:
Package: *
Pin: release a=cosmic
Pin-Priority: 900
Package: *
Pin: release a=disco
Pin-Priority: -10
Running apt install some-package
will install the version from cosmic
, as I'd expect.
However, running apt source some-package
will download the (newer) version from disco
.
How can I make apt source
obey pin-priorities?
It turns out that this is not possible, per a friend of a friend on the APT team.
apt source
doesn't pay attention to pinning.Strictly speaking source packages are a different namespace than binary packages. A very recent version of apt (post-Buster, even, so it's only in testing+ right now) started to support pinning by source package instead of binary package, using a
src:
prefix.I would've set up the following pinning entry if Buster supported it already for preferring Ceph 14 packages (from backports) over the stale v12 ones from stable, for example:
Rather a lot better than having to enumerate the dozens of binary packages generated from that one source.
I've checked with a more recent apt and sadly even with this new feature,
apt source
still ignores pinning. :-(