我已经(在 CentOS 7 中)安装了一个名为 Rational Software Architect (RSA 9.5) 的程序,它是一个功能类似于 Eclipse 的富客户端平台,但实际上没有安装 RPM。 RSA 带有一个安装 bash 脚本,它几乎只是将 eclipse 文件放到文件系统上。我的 Eclipse 可执行文件位于 /opt/IBM/SDP/eclipse
中,与普通 Eclipse 文件夹(如“插件”、“功能”和“dropins”)处于同一级别。
我为以前版本的“真正的”Eclipse 编写了一个规范文件,它只是安装了一些我编写为 jar 文件的 java 插件,将它们放在“dropins”文件夹中并调用 eclipse -clean -initialize
之后将 Eclipse 与我的新插件同步。这仍然适用于 RSA。
我的问题归结为这样一个事实,之前,我只是在规范文件中有一行类似于
要求:eclipse >= 4.4.2
因为 Eclipse 是作为 RPM 安装的。现在 RSA 已安装,取代了 Eclipse,并且没有与之关联的 RPM,我需要找到一种方法来告诉规范文件要求在安装 RPM 之前存在“dropins”文件夹。也许是这样的:
要求:/opt/IBM/SDP/eclipse
我在上述方法上没有取得任何成功,想知道是否有可能根据文件而不是包来设置 RPM 要求?我找不到有关该主题的任何文档,希望大家能提供帮助!提前致谢。
仅供引用...我在 CentOS 7.2 中使用 rpm-build-4.11.3 和 rpmdevtools-8.3 工作。
编辑:在规范中使用绝对路径时添加从 yum 返回的错误消息
[root@localhost trunk]# yum localinstall myplugin-1.1.6-rev1255.x86_64.rpm
加载的插件:fastestmirror、langpacks、rhnplugin
该系统正在接收来自 RHN Classic 或 Red Hat Satellite 的更新。
检查 myplugin-1.1.6-rev1255.x86_64.rpm:myplugin-1.1.6-rev1255.x86_64
标记要安装的 myplugin-1.1.6-rev1255.x86_64.rpm
解决依赖关系
--> 运行事务检查
---> 包 myplugin.x86_64 0:1.1.6-rev1255 将被安装
--> 处理依赖:/opt/IBM/SDP/eclipse 包:myplugin-1.1.6-rev1255.x86_64
从缓存的主机文件加载镜像速度
--> 处理依赖:/opt/IBM/SDP/eclipse 包:myplugin-1.1.6-rev1255.x86_64
--> 完成依赖解析
错误:包:myplugin-1.1.6-rev1255.x86_64 (/myplugin-1.1.6-rev1255.x86_64)
要求:/opt/IBM/SDP/eclipse
您可以尝试使用 --skip-broken 来解决该问题
您可以尝试运行:rpm -Va --nofiles --nodigest
[root@localhost trunk]# ll/opt/IBM/SDP/eclipse
-rwxr-xr-x。 1 root root 74675 2015 年 1 月 28 日/opt/IBM/SDP/eclipse
最佳答案
根据 Fedora Packaging Guidelines :
... rpm file dependencies don't work according to what's on the filesystem, they work according to the path specified in the rpm %files section.
因此,您不能使用 Requires:
来请求不属于 RPM 的文件。
一种可能的替代方法是检查 %pre
部分中的文件是否存在,如果不存在则以非零状态退出。有关如何使用该技术的示例,请参阅 Paul Rubel's reply 到 Failing an RPM install programatically in a spec step 或 ᴳᵁᴵᴰᴼ's reply 到 How 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。
关于linux - 如何在规范文件 "Requires"行中要求不属于 RPM 的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40538249/