apt doesn't respect repository order or pin preference

Bug #572613 reported by robrob
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: apt

10.04

Purpose: I want to set up a repository which will contain a custom-built version of a standard Ubuntu package. I want this repository to be preferred over the official Ubuntu mirror for my machines.

Observations:
According to "man sources.list": the most preferred source should be listed first. However, the order in sources.list and ordering-by-filename in sources.list.d has no effect.

Also, pinning via preferences using the origin should cause my repository to be preferred. However, it has no effect.

This is with apt 0.7.25.3ubuntu7 on Ubuntu 10.04.

Contents of sources.list:
deb http://192.168.0.2/ 10.04/

deb http://ubuntu.mirrors.tds.net/ubuntu/ lucid main restricted multiverse universe

Contents of preferences:
Package: *
Pin: origin 192.168.0.2
Pin-Priority: 999

It appears that the first repositories shown by "apt-cache policy" is the one used from which the package is installed. Example output when broken:
apt-cache policy libcap2
libcap2:
  Installed: 1:2.17-2ubuntu-1
  Candidate: 1:2.17-2ubuntu-1
  Version table:
 *** 1:2.17-2ubuntu1 0
    500 http://ubuntu.mirrors.tds.net/ubuntu/ lucid/main Packages
    999 http://192.168.0.2/ 10.04/ Packages
    100 /var/lib/dpkg/status

Sometimes it works. I see the "999" line above the "500" line in the "apt-cache policy" output when it uses the package in my repository.

I used apt-build to build the version of the package in my repository on 192.168.0.2. I can see which build is installed by the date on /lib/libcap.so.2.17

Revision history for this message
Braiam Peguero (braiampe) wrote :

I add this lines to my preferences file to get the local apt-build source have the priority:

Package: *
Pin: release o=apt-build
Pin-Priority: 990
Package: *
Pin: release o=lucid
Pin-Priority: 100

I use apt-build to build bind9, here is the output of apt-cache policy:

braiam@braiam-desktop:~$ apt-cache policy bind9
bind9:
  Instalados: 1:9.7.0.dfsg.P1-1
  Candidato: 1:9.7.0.dfsg.P1-1
  Tabla de versión:
 *** 1:9.7.0.dfsg.P1-1 0
        500 file:/var/cache/apt-build/repository/ stable/main Packages
        500 file:/var/cache/apt-build/repository/ apt-build/main Packages
        100 /var/lib/dpkg/status
     1:9.7.0.dfsg.P1-1 0
        500 http://do.archive.ubuntu.com/ubuntu/ lucid/main Packages
braiam@braiam-desktop:~$

You have to modify depending of your requirements.

Revision history for this message
robrob (rob-eklhq) wrote :

I don't see your "990" priority take effect in your "apt-cache policy" output.

Revision history for this message
Julian Andres Klode (juliank) wrote :

APT can't guess that the two packages are not identical. Please always change version numbers for local builds. Your pin is obviously respected, but then again, once there are multiple sources for one version, APT takes the first one. Pin Priorities are only relevant for choosing versions, not sources.

Changed in apt (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.