3

所以我有一个在我的私人仓库中制作的 Debian 包,我想安装一个特定的版本。

该软件包具有通用的 lib 依赖项,我想安装该软件包的匹配版本。apt-get坚持安装依赖的最新版本,而不是包所依赖的版本。

您可以在此处查看命令的输出:

cmcc@cmcc-VirtualBox:~/Desktop/repo$ sudo apt-get install my_program=57.0.93
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 my_program : Depends: my_program-common (= 57.0.93) but 57.3.102 is to be installed
E: Unable to correct problems, you have held broken packages.
4

1 回答 1

8

只需安装版本化的公共包:

aptitude install my_program=57.0.93 my_program-common=57.0.93

注意:通常aptitude在解决依赖关系方面比apt-get. 用法非常相似,因此很容易切换。

更新

如果您可以接受交互式过程,最简单的方法可能是aptitude给您一些建议并选择降级软件包的方法。例如:

# aptitude install my_program=57.0.93-1
The following packages will be DOWNGRADED:
  my_program{b} 
0 packages upgraded, 0 newly installed, 1 downgraded, 0 to remove and 3 not upgraded.
Need to get 180 kB of archives. After unpacking 12.3 kB will be used.
The following packages have unmet dependencies:
 my_program : Depends: my_program-common (= 57.0.93-1) but 57.3.102-1 is to be installed
The following actions will resolve these dependencies:

     Remove the following packages:              
1)     my_program-common                                  
2)     my_program

     Leave the following dependencies unresolved:
3)     my_program recommends my_program-foo      


Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:
1)     my_program-common [57.3.102-1 (now, unstable) -> 57.0.93-1 (stable)]

Accept this solution? [Y/n/q/?] Y

关于包版本的注意事项

看来您的包的版本类似于57.0.93. 这样的版本控制方案是明确禁止的non-native,例如检查DebianMentorsFAQ

由于您创建包的方式,您确实应该创建类似57.3.102-1(即<upstreamversion>-<pkgversion>)的版本,即使<pkgversion>始终为“1”。

于 2013-08-04T14:21:31.733 回答