1

我正在处理一个规范文件(foo.spec),该文件在构建时会产生两个 RPM:foo-1-1.i386.rpm(主程序)和libfoo-1-1.i386.rpm(所需的库文件)。foo.spec 文件指出 foo 需要相同版本和发行级别的 libfoo:

Requires: libfoo = %{version}-%{release}

foo-1-1 安装得很好:

rpm -ivh libfoo-1-1.i386.rpm

它安装依赖库,然后:

rpm -ivh foo-1-1.i386.rpm

但是由于对库的依赖,升级到较新的版本(foo-2-1)不起作用:

$ rpm -Uvh libfoo-2-1.i386.rpm
error: Failed dependencies:
       libfoo = 1-1 is needed by (installed) foo-1-1.i386

$ rpm -Uvh foo-2-1.i386.rpm
error: Failed dependencies:
       libfoo = 2-1 is needed by foo-2-1.i386

所以我被困住了。我希望用户能够执行 rpm -Uvh 来升级 foo 包(要求他们忽略依赖项等,这对新手用户要求太多)。

关于如何解决这个问题的任何想法,以便在新版本可用时可以使用 rpm -Uvh 升级包的所有部分?

提前致谢。

4

1 回答 1

2

rpm shouldn't and doesn't allow you to update these RPMs individually as the the state between installing the first RPM and the second is not valid.

You can, as Hasturkun points out, install both of them in the same command:

rpm -Uvh libfoo-2-1.i386.rpm foo-1-1.i386.rpm

FWIW, if you creaate a yum repo and used that to update you would find that updating one RPM would automatically drag in the other.

于 2011-08-22T20:06:42.727 回答