4

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?

smammy
  • 179
  • Which Ubuntu you are having. If you dont know run lsb_release -a an post the output. – Vijay Mar 06 '19 at 16:56
  • @Vijay it is pretty obvious, since he pinned cosmic (18.10) of which I assume is his current main and disco (19.04) – Videonauth Mar 06 '19 at 17:17
  • 1
    @smammy can you please try to use apt source -t cosmic <package name> and tell me if this works for you? – Videonauth Mar 06 '19 at 17:21
  • @Videonauth yes, that works, but I was hoping not to have to remember to use the -t switch. – smammy Mar 07 '19 at 01:04

2 Answers2

2

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.

smammy
  • 179
1

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:

Package: src:ceph
Pin: version 14.*
Pin-Priority: 1002

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. :-(

Wilmer
  • 508