Priorities for APT repositories (debian-based distributions)

I knew I could pin a package version, setting up an /etc/apt/preferences file, please see
here.
newtonfn on the ubuntuforums elegantly worked this resource out to set up a priority to repositories as well.
In this particular example, the medibuntu repos are set to have a lower priority, so that any package present in two repos from the /etc/apt/sources.list (here, medibuntu and skype) gets installed and upgraded preferably from the other repo (the skype one in the example):

Package: *
Pin: release l=Medibuntu
Pin-Priority: 400

A package present only in the medibuntu repo will be installed/upgraded from medibuntu. As I said, very elegant!

6 Responses to “Priorities for APT repositories (debian-based distributions)”

  1. Marius Scurtescu Says:

    Just to make sure, the preferences file mentioned above is at:
    /etc/apt/preferences
    and not at:
    /etc/preferences

    Right?

    Great tip, thanks.

  2. bapoumba Says:

    Yes, fixed, thanks :)

  3. BrokenCrystal Says:

    How did you get that code displayed like that? I would like to do that on my Ubuntu page… (The numbered lines with the menu above the code)

    Thanks,
    BrokenCrystal

  4. bapoumba Says:

    @ BrokenCrystal, it’s a feature offered by wp.com: http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/
    based on a Google Code project by Alex Gorbatchev:
    http://code.google.com/p/syntaxhighlighter/

  5. Simon Says:

    I’ve been trying to use this method, but I’m somewhat disconcerted by the fact that the output of apt-cache policy does not reflect contents /etc/apt/preferences …

    Does this actually work?

  6. bapoumba Says:

    It did work when I wrote the post, I used it. It was a while ago, and I switched computers and upgraded since then. I have not used it recently, I’ll check, thanks.


Leave a Reply