Distutils,较旧的rpm和自定义规格文件 [英] Distutils, older rpm, and customized spec file

查看:97
本文介绍了Distutils,较旧的rpm和自定义规格文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我终于在Fedora 14上的RPM中打包了程序,我认为以同样的方式在CentOS 4.8机器上构建它很容易。事实证明,较早版本的rpm和distutils受到一些限制,而且我没有运气。

I finally got my program packaged in a RPM on Fedora 14 yesterday, and I thought that it would be easy to build it the same way on a CentOS 4.8 box. It turns out that the older version of rpm and distutils are severally limited, and I'm not having any luck working around it.

基本问题是,带有Python 2.7的distutils支持名为 --post-install的选项,我可以在其中指定脚本。当我使用yum或rpm安装时,脚本已包含并运行。一切都很好。
但是,在Python 2.3中,没有--post-install选项(实际上在RPM中不可用)。无论如何,我都可以将其添加到.spec文件中的%install部分。
因此,我以

The basic problem is that distutils with Python 2.7 supports an option called "--post-install" where I can specify a script. The script is included and is run when I install with yum or rpm. Everything is great. However, with Python 2.3, there is no --post-install option (it's actually not available in RPM). Whatever, I can just add it to the "%install" section in my .spec file. So I start the RPM building process with

python setup.py bdist_rpm --spec-only 开始RPM的构建过程

python setup.py bdist_rpm --spec-only

会创建我的.spec。我对其进行编辑,然后将脚本粘贴到.spec中。然后,我用

which creates my .spec. I edit it and paste my script into the .spec. Then, I go to build the source with

python setup.py bdist_rpm --only-source

这似乎开始出现问题。
distutils创建以下子目录./build/bdist.linux-i686/rpm/。在其中有一个名为SPECS / netinfo.spec的文件夹(我的程序称为netinfo)。但是,它不使用我刚刚创建的自定义.spec。
这很奇怪,因为它应该使用生成的.spec。如果我尝试使用默认的.spec进行构建,则可以预见,我的脚本未包含在RPM中。如果我用自定义.spec覆盖了它,则仍然无法正常工作。就像为每个命令重新创建.spec一样。

This is where problems seem to start occurring. distutils creates the following sub-directories ./build/bdist.linux-i686/rpm/. Inside that there is a folder called SPECS/netinfo.spec (my program is called netinfo). However, that doesn't use the custom .spec that I just created. That's weird since it should use the generated .spec. If I try to build with the default .spec, then predictably my script isn't included in the RPM. If I overwrite that with my custom .spec, it still doesn't work. It's like it recreates the .spec for every command.

bdist_rpm有各种命令,可以用

There are various commands that bdist_rpm has, and they can be listed with

python setup.py bdist_rpm --help

我希望找到一个otpion,您可以在其中指定要使用的.spec文件。但是,在Python 2.3和2.7上,不存在任何选项。

I expected to find an otpion where you can specify the .spec file to use. Yet, on Python 2.3 and 2.7, no option exists.

必须有一些简单的方法来使distutils使用我的自定义.spec文件。有人知道如何指定吗?

There has to be some simple way to get distutils to use my custom .spec file. Does anyone know how to specify this?

谢谢

推荐答案

没有。使用 rpmbuild -bs 构建SRPM,然后使用 Mock 为EL4构建一个程序包。

There isn't. Build the SRPM with rpmbuild -bs and then use Mock to build a package for EL4.

这篇关于Distutils,较旧的rpm和自定义规格文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆