Is there a way to cherry pick packages from a ppa repository you add? That is, to exclude some from updating while including others?
For example, I want just the chromium-browser package from this repository but not the others. So I don't want my sudo apt-get upgrade
to have that ppa's other (besides chromium-browser) packages install over my existing ones, just that one.
I realize this is a license to shoot myself in the foot if I misread dependencies and exclude ones that are needed to ones that I included, but I know for a fact in this case that the other packages are not dependencies for that one.
Is this at all possible? Maybe there is some whitelist/blacklist file or something?
Best Answer
Found one way to do it.
The trick is using two pinning clauses. The first to disallow ALL packages from the PPA and the second to select the ones you want.
So for the example above, I first add the ppa as usual:
Now if i run apt-cache policy, it will show me that there's a newer version of chromium-browser available and that it will install with an upgrade because it's in the same priority (500) as my current chromium-browser.
That's great as far as that package but I don't want the others in this ppa (which also have a 500 priority) to install. Right now if I try to upgrade, I'll get more than just the chromium packages I want from that repository:
So what I can do is tell apt that I want all the packages in that ppa, webapps-preview in this case, to have a lower priority except the ones with "chromium" in their name. The mechanism for this is pinning a package
I create a file in /etc/apt/preferences.d/ with two clauses. The first one says give all the packages in the webapps-preview ppa a lower priority than the regular one (so that they are not preferred even if they have a higher version number. The second clause partly overrides the first by saying give the packages in that ppa with "chromium" in their name the same priority as other packages so that it will get installed (by it having a higher version number).
To identify the correct string for "Pin: release" option we can use apt-cache policy again.
For apt versions < 0.8.14 pinned packages have to be specified explicitly as wildcards do not work:
And now, when i try to upgrade I get only the packages I want from that ppa and not the other ones. All nicely cherry picked for me: