在文件依赖性检查之前是否执行了 RPM Spec 部分?

发布于 2024-09-11 00:31:29 字数 541 浏览 7 评论 0原文

我正在尝试构建一个 RPM,如果文件依赖项不存在,它将安装它们。是否有 RPM 规范部分将在 RPM 检查依赖关系之前执行。 (我指的是文件依赖项,而不是“Requires”标头中列出的包依赖项)。

例子: 如果我有一个 perl 文件并且设置了执行权限位。 RPM 将检查 perl 是否安装在 perl 文件中“#!/bin/perl”指定的位置。 (看起来它会检查 RPM 数据库以查看 perl 是否安装在该位置,而不是检查实际文件位置)如果 perl 未安装在 /bin/perl 位置,我想在 RPM 出错之前安装它我“[MY_PACKAGE]需要/bin/perl”

附带问题: 由于文件依赖性检查 RPM 数据库,是否有办法更新安装位置?即,如果我的 perl 脚本指定“#!/usr/local/bin/perl”,但我的 RPM 数据库的 perl 位于“/usr/bin/perl”中,我该如何更新 RPM 数据库?手动符号链接“/usr/local/bin/perl”将不起作用,因为它不会更新 RPM 数据库。 RPM 安装程序仍会显示“[MY_PACKAGE] 需要 /usr/local/bin/perl”

I'm trying to build an RPM that will install file dependencies if they don't exist. Is there an RPM Spec Section that will be executed before the RPM checks for dependencies. (I'm refering to file dependencies not package dependencies listed in the "Requires" header).

Example:
If I have a perl file and the execution permissions bit is set. RPM will check to see if perl is installed in the location the "#!/bin/perl" specifies in the perl file. (It looks like it checks the RPM database to see if perl is installed in that location instead of checking the actual file location) If perl is not installed in the /bin/perl location I want to install it before the RPM will error out telling me "/bin/perl is needed by [MY_PACKAGE]"

Side Question:
Since the file dependency checks the RPM database is there a way to update the installed locations? i.e. If my perl script specifies "#!/usr/local/bin/perl" but my RPM database has perl located in "/usr/bin/perl" how do I update the RPM datbase? Symbolically linking "/usr/local/bin/perl" manually won't work becuase it doesn't updated the RPM database. The RPM installer will still say "/usr/local/bin/perl is needed by [MY_PACKAGE]"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

西瓜 2024-09-18 00:31:29

RPM 规范的设计指南之一是它们不应打印错误消息或以任何方式与用户交互。您不知道它们是手动安装还是通过 yum/GUI 安装。

您可以指定文件的依赖关系,就像文件包的依赖关系一样,请确保文件名以 / 开头。如果打印 RPM 的依赖项列表,您将看到一些 .so 库以这种方式列出。

如果您使用 Perl,最好的方法是将 perl 作为您的要求包含在规范中,并依赖于发行版的正常位置,即 /usr/bin/perl。

One of the design guidelines for RPM specs is that they should not print error messages or in any way interact with the user. You don't know if they will be installed manually or via yum/GUI.

You can specify dependencies on files just like dependencies on file packages, make sure you start the filename with /. If you print out the dependency lists for your RPMs you'll see some .so libraries listed there this way.

If you are using Perl, the best way would be to include perl as your requirement in the spec and rely on it's normal location for the distro, i.e. /usr/bin/perl.

姐不稀罕 2024-09-18 00:31:29

我认为你试图使用错误的工具来完成这项工作。 rpm 的工作是安装它被告知要安装的软件包,而不是去寻找其他软件包。引入依赖项是 apt、urpmi 或 yum 等高级工具的工作。

对于您给出的示例,如果您的软件包需要 /usr/local/bin/perl,那么其他一些软件包必须提供 /usr/local/bin/perl。这可能是一个包含从 /usr/local/bin/perl/usr/bin/perl 的符号链接的包,并声明对 /usr/ 的依赖bin/perl (不过我不知道如何让您需要最低版本的 /usr/local/bin/perl)。

I think you're trying to use the wrong tool for the job. The job of rpm is to install the packages it's told to install, not to go and look for other packages. Pulling in dependencies is the job of higher-level tools such as apt, urpmi or yum.

For the example you give, if your package requires /usr/local/bin/perl, then some other package must provide /usr/local/bin/perl. That could be a package that contains a symlink from /usr/local/bin/perl to /usr/bin/perl and declares a dependency on /usr/bin/perl (I don't know how that lets you require a minimum version of /usr/local/bin/perl though).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文