【问题标题】:How to require a file not owned by an RPM in a spec file "Requires" line?如何在规范文件“需要”行中要求不属于 RPM 的文件?
【发布时间】:2016-11-10 22:37:59
【问题描述】:

我已经(在 CentOS 7 中)安装了一个名为 Rational Software Architect (RSA 9.5) 的程序,它是一个富客户端平台,其作用类似于 Eclipse,但实际上并未安装 RPM。 RSA 附带了一个安装 bash 脚本,它几乎只是将 eclipse 文件放到了文件系统中。我的 Eclipse 可执行文件位于 /opt/IBM/SDP/eclipse,与普通 Eclipse 文件夹(如“plugins”、“features”和“dropins”)位于同一级别。

我为“真实”Eclipse 的早期版本编写了一个规范文件,该文件只是安装了一些我编写为 jar 文件的 java 插件,将它们放在“dropins”文件夹中,然后调用 eclipse -clean -initialize 将 Eclipse 与我的新插件。这仍然适用于 RSA。

我的问题归结为这样一个事实,在此之前,我只需在规范文件中有一行类似于

Requires: eclipse >= 4.4.2

因为 Eclipse 是作为 RPM 安装的。现在 RSA 已安装,取代了 Eclipse,并且没有与之关联的 RPM,我需要找到一种方法来告诉规范文件在安装 RPM 之前要求“dropins”文件夹存在。也许是这样的:

Requires: /opt/IBM/SDP/eclipse

我对上述方法没有任何成功,想知道是否甚至可以基于文件而不是包来设置 RPM 要求?我找不到有关该主题的任何文档,希望大家能提供帮助!提前致谢。

仅供参考...我正在使用 rpm-build-4.11.3 和 rpmdevtools-8.3 在 CentOS 7.2 中工作。


编辑:添加在规范中使用绝对路径时从 yum 返回的错误消息

[root@localhost trunk]# yum localinstall myplugin-1.1.6-rev1255.x86_64.rpm Loaded plugins: fastestmirror, langpacks, rhnplugin This system is receiving updates from RHN Classic or Red Hat Satellite. Examining myplugin-1.1.6-rev1255.x86_64.rpm: myplugin-1.1.6-rev1255.x86_64 Marking myplugin-1.1.6-rev1255.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package myplugin.x86_64 0:1.1.6-rev1255 will be installed --> Processing Dependency: /opt/IBM/SDP/eclipse for package: myplugin-1.1.6-rev1255.x86_64 Loading mirror speeds from cached hostfile --> Processing Dependency: /opt/IBM/SDP/eclipse for package: myplugin-1.1.6-rev1255.x86_64 --> Finished Dependency Resolution Error: Package: myplugin-1.1.6-rev1255.x86_64 (/myplugin-1.1.6-rev1255.x86_64) Requires: /opt/IBM/SDP/eclipse You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

[root@localhost trunk]# ll /opt/IBM/SDP/eclipse -rwxr-xr-x. 1 root root 74675 Jan 28 2015 /opt/IBM/SDP/eclipse

【问题讨论】:

  • 我很确定你可以有一个绝对路径。它应该会阻止您在没有它的情况下进行安装,但由于在任何 RPM 中都找不到它,yum/dnf 将无法帮助您找到它。我之前已经这样做了,以强制 glibc 32 位库作为 RPM 的要求。
  • @AaronD.Marasco 见上面的编辑。使用绝对路径时(在文件上运行ls -al 时可以看到存在)我仍然有问题。
  • 在使用 mock 构建 rpm 时可能会自动满足该要求。

标签: linux eclipse rpm centos7 rpm-spec


【解决方案1】:

根据Fedora Packaging Guidelines

... rpm 文件依赖项不会根据文件系统上的内容起作用,它们根据 rpm %files 部分中指定的路径起作用。

因此,您不能使用 Requires: 来请求不属于 RPM 的文件。

一种可能的替代方法是检查%pre 部分中的文件是否存在,如果不存在则以非零状态退出。有关如何使用该技术的示例,请参阅 Paul Rubel's replyFailing an RPM install programatically in a spec stepᴳᵁᴵᴰᴼ's replyHow to abort the installation of an rpm package if some conditions are not met in specfile?

请注意,%pre 部分的非零退出状态将导致 RPM 无法安装,但 RPM 事务似乎仍然成功,这可能会导致混淆。见How to exit rpm install in case of an error

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-14
    • 1970-01-01
    • 2019-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多