#868276 apt_preferences(5): explain how one would combine e.g. origin, version and release Pins

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Christoph Anton Mitterer
Date:
2024-07-12 16:51:03 UTC
Severity:
wishlist
#868276#5
Date:
2017-07-14 00:17:07 UTC
From:
To:
Hi.

Looking at apt_preferences(5), it does, AFAICS, not explain the following:

a) What happen if multiple e.g. Pin: directives are found? It seems only
   the last one is taken and the former ones ignored (per block).
   btw: Perhaps it would be even good, if apt gives warnings in such cases.


b) How can one combine origin, version and release Pins?
   e.g. for a package named foo, when it's from Origin ACME, the version 10 shall get Priority 600:
Is this:
Package: foo
Pin: version 10 release o=ACME
Pin-Priority: 600

or would it be
Pin: version 10, release o=ACME

or would swapping work?
Pin: release o=ACME version 10
What if my Origin contains spaces?


Cheers,
Chris.

#868276#10
Date:
2021-12-01 20:57:49 UTC
From:
To:
I think the comma works:

Pin: version 10, release o=ACME

and indeed, the man page is missing some clear documentation about that.

Jérémy

#868276#15
Date:
2022-06-22 08:19:43 UTC
From:
To:
repositories at hand that allows me to properly test this yet), but at
least in 1.8.2.3 (buster, yeah, I know), I can't seem to combine
multiple keywords:

 > Pin: release n=buster, l=Vendor

works, but:

 > Pin: release n=buster, origin "debian.vendor.tld"

does not (and applies to all "release n=buster", no warnings attached)
-- yet they work separately, e.g. each alone in a Pin: line.

Often enough we can use some "release" tags to get our way, but it's an
inconvenient and sad limitation -- and as mentioned in the OP, the
documentation is unclear on the subject matter.

- Colomban

PS: my test includes 2 packages that appear both in both Debian and a
vendor repository, one newer in Debian's n=buster, and the other newer
in vendor's n=buster-backports.  The idea is that I should be able to
match all Debian n=buster, Debian n=buster-backports, Vendor's n=buster
and Vendor n=buster-backports *separately*.