永久阻止发行版包安装?

永久阻止发行版包安装?

我在 Ubuntu 上使用 PPA 提供的软件包。我使用 PPA 版本是因为 Debian 的版本太过贫乏,以至于它实际上已经崩溃。

今天,当我经历这个循环时apt-get update and apt=get dist-upgrade,我看到了:

$ sudo apt-get dist-upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-dev
The following packages will be upgraded:
  gcc-arm-none-eabi libcurl3 libcurl3-gnutls
3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 338 kB/24.7 MB of archives.
After this operation, 9,572 kB disk space will be freed.

dist-upgrade正在尝试安装过去给我带来麻烦的软件包:binutils-arm-none-eabigcc-arm-none-eabi。即使是标准upgrade也会尝试安装一些给我带来麻烦的相同软件包。

binutils-arm-none-eabi我想永久阻止和的发行版软件包gcc-arm-none-eabi。如何永久阻止发行版软件包,但允许提供相同软件包的 PPA?

答案1

在 APT 中,您可以“固定”软件包 – 例如,根据各种属性指定自定义软件包首选项。

首先运行apt-cache policy以查看已配置存储库的属性,并查找特定于您的 PPA 的存储库。它可能具有类似内容release n=precise(基于其针对的 Ubuntu 版本)或至少origin launchpad.net(基于源站点):

$ apt-cache policy | egrep -i "(ppa|arm)"
 500 http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main i386 Packages
     release v=14.04,o=LP-PPA-terry.guo-gcc-arm-embedded,a=trusty,n=trusty,l=GNU ARM Embedded Toolchain,c=main
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main amd64 Packages
     release v=14.04,o=LP-PPA-terry.guo-gcc-arm-embedded,a=trusty,n=trusty,l=GNU ARM Embedded Toolchain,c=main
     origin ppa.launchpad.net
     release v=14.04,o=LP-PPA-app-review-board,a=trusty,n=trusty,l=Application Review Board PPA,c=main
     release v=14.04,o=LP-PPA-app-review-board,a=trusty,n=trusty,l=Application Review Board PPA,c=main

然后创建一个文件/etc/apt/preferences

Package: binutils-arm-none-eabi
Pin: origin ppa.launchpad.net
Pin-Priority: 900

Package: gcc-arm-none-eabi
Pin: origin ppa.launchpad.net
Pin-Priority: 900

对于Pin,使用您之前找到的存储库属性。对于优先级,选择一个高于任何常规 Debian 存储库的数字。

最后,运行apt-cache policy binutils-arm-none-eabi(这次使用包名称)以验证首选项是否正确应用:

$ apt-cache policy gcc-arm-none-eabi
gcc-arm-none-eabi:
  Installed: 4-8-2014q2-0trusty10
  Candidate: 4-8-2014q2-0trusty10
  Package pin: 4-8-2014q2-0trusty10
  Version table:
     4.8.2-14ubuntu1+6 900
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
 *** 4-8-2014q2-0trusty10 900
        500 http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

相关内容