Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
63
rated 0 times [  63] [ 0]  / answers: 1 / hits: 27631  / 2 Years ago, fri, august 5, 2022, 8:28:25

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?


More From » apt

 Answers
7

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:



$ sudo add-apt-repository ppa:webapps/preview
...
$ sudo apt-get update
...


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.



$ sudo apt-cache policy chromium-browser
chromium-browser:
Installed: 18.0.1025.168~r134367-0ubuntu0.12.04.1
Candidate: 20.0.1132.47~r144678-0precise1+webapps3
Version table:
20.0.1132.47~r144678-0precise1+webapps3 0
500 http://ppa.launchpad.net/webapps/preview/ubuntu/ precise/main amd64 Packages
*** 18.0.1025.168~r134367-0ubuntu0.12.04.1 0
500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/universe amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
500 http://ppa.launchpad.net/chromium-daily/beta/ubuntu/ precise/main amd64 Packages
100 /var/lib/dpkg/status
18.0.1025.151~r130497-0ubuntu1 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
E: Unable to parse package file /etc/apt/preferences.d/webapps-preview-pin-400 (1)
$


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:



$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
bamfdaemon gwibber gwibber-service gwibber-service-facebook gwibber-service-twitter indicator-appmenu libbamf0 libbamf3-0 shotwell
The following packages will be upgraded:
chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg gwibber-service-identica indicator-messages indicator-status-provider-mc5
indicator-status-provider-pidgin libindicator-messages-status-provider1
8 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
Need to get 25.3 MB of archives.
After this operation, 5,034 kB of additional disk space will be used.
Do you want to continue [Y/n]?


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).



$ cat /etc/apt/preferences.d/webapps-preview-pin-400
Package: *
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 400


Package: *chromium*
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 500


To identify the correct string for "Pin: release" option we can use apt-cache policy again.



$ apt-cache policy
...
500 http://ppa.launchpad.net/webapps/preview/ubuntu/ precise/main i386 Packages
release v=12.04,o=LP-PPA-webapps-preview,a=precise,n=precise,l=preview,c=main
origin ppa.launchpad.net
...


For apt versions < 0.8.14 pinned packages have to be specified explicitly as wildcards do not work:



$ cat /etc/apt/preferences.d/webapps-preview-pin-400
Package: *
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 400


Package: chromium-browser chromium-codecs-ffmpeg chromium-browser-l10n chromium-codecs-ffmpeg-extra
Pin: release o=LP-PPA-webapps-preview
Pin-Priority: 500


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:



$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
chromium-browser chromium-browser-l10n chromium-codecs-ffmpeg
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.1 MB of archives.
After this operation, 5,026 kB of additional disk space will be used.
Do you want to continue [Y/n]?

[#36473] Saturday, August 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lowovey

Total Points: 287
Total Questions: 98
Total Answers: 117

Location: Bosnia and Herzegovina
Member since Thu, Jan 14, 2021
3 Years ago
;