1

I have two repositories with one package "libtidy-dev":

$ apt-cache policy libtidy-dev

libtidy-dev:
  Installed: 20091223cvs-1.2ubuntu1.1
  Candidate:   1:5.2.0-1+deb.sury.org~trusty+1
  Фиксатор пакета: 1:5.2.0-1+deb.sury.org~trusty+1
  Version table:
     1:5.2.0-1+deb.sury.org~trusty+1 400
        500 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main amd64 Packages
 *** 20091223cvs-1.2ubuntu1.1 400
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     20091223cvs-1.2ubuntu1 400
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

I want to set priority for package "libtidy-dev" of "ppa:ondrey/php" repository to 400. So I created /etc/apt/preferences.d/libtidy-dev.pref with this content:

Package: libtidy-dev
Pin: release o=LP-PPA-ondrej-php
Pin-Priority: 400

But it doesn't work. If i replace first row

Package: *
Pin: release o=LP-PPA-ondrej-php
Pin-Priority: 400

it will works but for all packages from this repo. I dont't need to reduce priority for all packages, I want to do this only for "libtidy-dev". So I tried another way. I wrote to pref file this:

Package: libtidy-dev
Pin: origin archive.ubuntu.com
Pin-Priority: 990

Package: libtidy-dev
Pin: origin security.ubuntu.com
Pin-Priority: 990

This config does the same thing. If first row has package name it not works, but if I specify asterisk instead of package name, it works but for all packaes of these repos. What I'm doing wrong? How to set priority for one package of one repository?

1 Answers1

0

Based on the output of apt-cache policy libtidy-dev, your configuration for pinning the priority of libtidy-dev did apply: 400 is listed next to the version number.

For example, taking a Ubuntu 16.04 Xenial system with the default configuration and illustrating with appstream, as different versions of this package are available in the xenial and xenial-backports archives (which have different default priorities):

$ apt-cache policy appstream
appstream:
  Installed: (none)
  Candidate: 0.9.4-1ubuntu3
  Version table:
     0.10.6-1~ubuntu16.04.2 100
        100 http://de.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
     0.9.4-1ubuntu3 500
        500 http://de.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     0.9.4-1 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Adding the following file:

$ cat /etc/apt/preferences.d/appstream
Package: appstream
Pin: release a=xenial-backports
Pin-Priority: 500

Results in the output changing to:

$ apt-cache policy appstream
appstream:
  Installed: (none)
  Candidate: 0.10.6-1~ubuntu16.04.2
  Version table:
     0.10.6-1~ubuntu16.04.2 500
        100 http://de.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
     0.9.4-1ubuntu3 500
        500 http://de.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     0.9.4-1 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

You can also run apt-cache policy without specifying a package name, which will list any pinned packages at the end of output:

$ apt-cache policy
[...]
Pinned packages:
     appstream -> 0.10.6-1~ubuntu16.04.2 with priority 500

The confusion stems from the fact that pinning all packages with a catch-all glob pattern changes the priority listed next to the archive, which is easier to spot than the one next to the package version:

$ cat /etc/apt/preferences.d/appstream
Package: *
Pin: release a=xenial-backports
Pin-Priority: 500
$ apt-cache policy appstream
appstream:
  Installed: (none)
  Candidate: 0.10.6-1~ubuntu16.04.2
  Version table:
     0.10.6-1~ubuntu16.04.2 500
        500 http://de.archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
     0.9.4-1ubuntu3 500
        500 http://de.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     0.9.4-1 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages