我怎样才能使 apt-pin 稳定?

Mic*_*man 7 debian apt

安装后一段时间我改变了主意,并且更喜欢稳定测试这个特定系统。不幸的是,我目前有旧测试版本的软件包。我需要强制降级以使它们重新回到挤压轨道上,同时在测试版本中保留一两个(加上依赖项)。可悲的是,我的首选项文件与其他人不兼容。我尝试过很多变化version n=version a=等等。

bash# cat /etc/apt/preferences.d/pinstable
Package: *
Pin: release a=testing
Pin-Priority: -10

Package: *
Pin: release a=stable
Pin-Priority: 1010
Run Code Online (Sandbox Code Playgroud)

我将默认版本设置为稳定版:

bash# cat /etc/apt/preferences.d/apt.conf.d/99release
APT::Default-Release "stable";
Run Code Online (Sandbox Code Playgroud)

下面是一个使用随机包的例子,它有几个可能的版本:

bash# apt-cache policy libapache2-mod-php5
libapache2-mod-php5:
  Installed: 5.3.6-13
  Candidate: 5.3.6-13
  Version table:
     5.3.9-1 0
        -10 http://mirror.rit.edu/debian/ testing/main i386 Packages
 *** 5.3.6-13 0
        100 /var/lib/dpkg/status
     5.3.3-7+squeeze7 0
        990 http://security.debian.org/ squeeze/updates/main i386 Packages
     5.3.3-7+squeeze3 0
        990 http://mirror.rit.edu/debian/ squeeze/main i386 Packages
Run Code Online (Sandbox Code Playgroud)

为什么优先级不是 1010 的挤压版本?

Zor*_*che 4

这里的问题是你的/etc/apt/apt.conf.d/99release文件。

来自man 5 apt_preferences

   If the target release has been specified then APT uses the following
   algorithm to set the priorities of the versions of a package. Assign:

   priority 990
       to the versions that are not installed and belong to the target
       release.
Run Code Online (Sandbox Code Playgroud)

看来 APT 中提到的显式释放将覆盖任何 pin 设置。我设置了一个测试系统并使用类似的99release文件,并且pinstable我在文件中看到与 apt-cache 中的值完全相同的值。但如果我删除该99release文件,我就会得到这个。

# apt-cache policy libapache2-mod-php5
libapache2-mod-php5:
  Installed: (none)
  Candidate: 5.3.3-7+squeeze8
  Version table:
     5.3.3-7+squeeze8 0
       1010 http://security.debian.org/ squeeze/updates/main amd64 Packages
     5.3.3-7+squeeze3 0
       1010 http://ftp.us.debian.org/debian/ squeeze/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)