roa*_*ner 8 ubuntu dependencies package-management
我有一个自定义包foo,它的控制文件依赖于另一个包的固定版本bar:
Depends: bar (= 1.2.3)
Run Code Online (Sandbox Code Playgroud)
无论是foo和bar包都发表在我自己的回购协议。此外,我bar在 repo 中有多个版本,比如 1.2.3 和 2.1.0。现在,当尝试foo使用
apt-get install foo
Run Code Online (Sandbox Code Playgroud)
它失败了
The following packages have unmet dependencies:
foo : Depends: bar (= 1.2.3) but 2.1.0 is to be installed
Run Code Online (Sandbox Code Playgroud)
即 apt-get 似乎无法正确找出要使用的正确版本的软件包。
我尝试添加一个冲突:
Depends: bar (= 1.2.3)
Conflicts: bar (>> 1.2.3)
Run Code Online (Sandbox Code Playgroud)
但这只会导致错误更改为
The following packages have unmet dependencies:
foo : Depends: bar (= 1.2.3) but it is not going to be installed
Run Code Online (Sandbox Code Playgroud)
如果我在安装时指定 bar 的版本,则有效:
apt-get install foo bar=1.2.3
Run Code Online (Sandbox Code Playgroud)
但这不可行(实际情况有多个级别的依赖项,我真的不想为了在命令行上手动查找和指定所有内容而必须实现自己的依赖项解析器 -apt在这种情况下最好跳过)。
所以问题是,有没有办法让 apt 正常运行并自动安装正确版本的依赖项(无需在命令行上明确指定这些版本)?而且我应该补充一点,我也真的不想走带有版本固定的 apt_preferences 路线,因为这需要在两个不同的地方管理版本。
为了完整起见,这是打开各种 apt 调试输出时的完整输出:
apt-get -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgDepCache::Marker=1 install foo
Reading package lists... Done
Building dependency tree
Reading state information... Done
foo:amd64 Depends on bar [ amd64 ] < none -> 2.1.0 > ( universe/utils ) (= 1.2.3) can't be satisfied!
Starting pkgProblemResolver with broken count: 1
Starting 2 pkgProblemResolver with broken count: 1
Investigating (0) foo [ amd64 ] < none -> 1.0.0 > ( misc )
Broken foo:amd64 Depends on bar [ amd64 ] < none -> 2.1.0 > ( universe/utils ) (= 1.2.3)
Considering bar:amd64 0 as a solution to foo:amd64 9998
Re-Instated bar:amd64
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:
foo : Depends: bar (= 1.2.3) but 2.1.0 is to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)
apt 解析器不会考虑您可能想要安装的东西不是给定目标版本中软件包的最新可用版本的可能性;Debian 只是不支持为您的系统安装除最新版本的软件包之外的任何内容。
如果您对(一组)包的每个版本使用不同的存储库,那么您可以使用固定来首选给定的来源,或者给它们一个不同的代号并使用 apt 的 -t 选项来选择目标版本。否则这是不可能的。
| 归档时间: |
|
| 查看次数: |
3600 次 |
| 最近记录: |