【问题标题】:How to author a .spec file that requires either sl-release or centos-release or redhat-release?如何编写需要 sl-release 或 centos-release 或 redhat-release 的 .spec 文件?
【发布时间】:2013-09-07 02:12:15
【问题描述】:

我认为我的问题与“https://serverfault.com/q/299179”和“https://serverfault.com/q/283330/71790”有些相关,但其中任何一个都没有让我满意的答案。

为了确保我的.rpm 的依赖项是正确的,我需要一个特定的最低版本。在我的情况下sl-release >= 6.1。好吧,所以我在.spec 文件中写了Requires: sl-release >= 6.1,然后我突然想到:“如果有人试图在相关发行版之一上安装它怎么办?” (如 CentOS 或 RHEL 本身)。

由于 Scientific Linux 与 CentOS 一样基于 RHEL,因此应该有一种方式来表达我需要基于特定 RHEL 版本的东西。唉,一个快速的yum list installed|grep release 只产生了:

sl-release.x86_64  6.1-2         @anaconda-ScientificLinux-201107272231.x86_64/6

当,sl-release 显然是针对 Scientific Linux 的(yum list 没有任何帮助,yum grouplist 也没有提供任何帮助)。所以我认为依赖必须以某种方式由Provides: 表达并发出yum deplist sl-release。唉,输出再次对我的事业没有帮助。

【问题讨论】:

    标签: centos redhat rpmbuild


    【解决方案1】:

    ... 事实证明,除了“https://serverfault.com/q/283330/71790”中指出的条件之外,上面还有一个符号/别名。稍微猜测一下,网络搜索出现了 centos-release,当然还有 redhat-release 作为其他两个相关发行版上使用的包名称。

    由于我花了一些时间想出解决方案并且分享是关怀,我决定写下我的发现,以供下一位进行网络搜索的国际用户使用。

    所以,接下来我运行yum install redhat-release 来安装它,希望它可用。

    $ sudo yum install redhat-release
    Setting up Install Process
    Package sl-release-6.1-2.x86_64 already installed and latest version
    Nothing to do
    

    显然redhat-release 这个名字神奇地转换为sl-release。 IE。这是一个别名。

    结论

    您可以使用通用名称 redhat-release,甚至在两个派生发行版 CentOS 和 Scientific Linux 上都可以引用各自特定于发行版的软件包 centos-releasesl-release。所以:

    Require: redhat-release >= 6.1
    

    对所有这些都有效。


    在相关说明中,我知道他们都有一个文件 /etc/redhat-releaseyum whatprovides /etc/redhat-release 给了我:

    $ yum whatprovides /etc/redhat-release
    sl-release-6.1-2.x86_64 : Scientific Linux release file
    Repo        : local
    Matched from:
    Filename    : /etc/redhat-release
    
    
    
    sl-release-6.1-2.x86_64 : Scientific Linux release file
    Repo        : installed
    Matched from:
    Other       : Provides-match: /etc/redhat-release
    

    【讨论】:

    • slf-release 是另一个常见的变体。
    猜你喜欢
    • 1970-01-01
    • 2019-09-11
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    • 2011-11-13
    • 2019-07-12
    • 1970-01-01
    • 2017-10-20
    相关资源
    最近更新 更多