如何拆分现有的Debian软件包,使其中一个新软件包预先依赖于另一个软件包?

时间:2013-01-01 05:28:30

标签: dependencies debian

Debian Policy Manual的7.47.6.1部分描述了将Debian软件包分成两部分的正确方法。但是,我的情况有点复杂。

我目前有两个软件包,比如版本1.2.3:

Package: foo-base

Package: foo-dbserver
Depends: foo-base (>= 1.2.3)

最初,这种关系是有道理的,但随着时间的推移,有些意外, foo-base 的元素已经依赖于 foo-dbserver 的元素。更糟糕的是,现实情况是 foo-base 预先依赖 foo-dbserver 的元素上。因此,对于版本1.2.4,我现在想要的是将 foo-base 分成 foo-essential foo-base ,如下所示: / p>

Package: foo-essential
Replaces: foo-base (<< 1.2.3)
Breaks: foo-base (<< 1.2.3)

Package: foo-dbserver
Depends: foo-essential (>= 1.2.4)

Package: foo-base
Pre-Depends: foo-dbserver (>= 1.2.4)

这三个软件包很快安装在新安装上,但它们不能干净地升级:

dpkg: regarding foo-base_1.2.4_all.deb containing foo-base, pre-dependency problem:
 foo-base pre-depends on foo-dbserver (>= 1.2.4)
  foo-dbserver latest configured version is 1.2.3
dpkg: error processing foo-base_1.2.4_all.deb (--install):
 pre-dependency problem - not installing foo-base
dpkg: regarding foo-essential_1.2.4_all.deb containing foo-essential:
 foo-essential breaks foo-base (<< 1.2.3)
  foo-base (version 1.2.3) is present and installed.
dpkg: error processing foo-essential_1.2.4_all.deb (--install):
 installing foo-essential would break foo-base, and
 deconfiguration is not permitted (--auto-deconfigure might help)
(Reading database ... 39107 files and directories currently installed.)
Preparing to replace foo-dbserver 1.2.3 (using foo-dbserver_1.2.4_all.deb) ...
Unpacking replacement foo-dbserver ...
dpkg: dependency problems prevent configuration of foo-dbserver:
 foo-dbserver depends on foo-essential (>= 1.2.4); however:
  Package foo-essential is not installed.
dpkg: error processing foo-dbserver (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 foo-base_1.2.4_all.deb
 foo-essential_1.2.4_all.deb
 foo-dbserver

有没有办法正确表达这种关系,以便升级?将foo-base完全重命名为其他东西(并使用名称 foo-essential foo-dbserver foo-base2 )会更好溶液

1 个答案:

答案 0 :(得分:1)

我找到的解决方案是将包拆分为另一个方向。也就是说,将原始包名称保留为预先依赖的名称,并为执行预先依赖的名称使用新的包名称。

Package: foo-base

Package: foo-dbserver
Depends: foo-essential (>= 1.2.4)

Package: foo-extra
Pre-Depends: foo-dbserver (>= 1.2.4)
Replaces: foo-base (<< 1.2.3)
Breaks: foo-base (<< 1.2.3)