我构建的 Python RPM 无法安装 [英] Python RPM I built won't install

查看:42
本文介绍了我构建的 Python RPM 无法安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我必须在通过 kickstart 过程构建的多个 Oracle Linux 服务器上安装多个版本的 Python,所以我想为我们的 yum 存储库构建一个 python rpm.我能够使用make altinstall"手动构建 Python,它不会安装在您的默认系统 Python 安装上,所以我认为这是可行的方法.

经过多次反复试验,我设法构建了一个以 .bz2 python 2.7 包开始的 rpm - 但是现在当我尝试安装它时,出现错误:

 错误:依赖项失败:Python-2.7.2-1.i386 需要/usr/local/bin/python

什么……???Python是我要安装的!!!系统默认 Python (2.4) 在/usr/bin/python 中!!!我的python目录原型位置是/tmp/python2.7(可执行文件是/tmp/python2.7/bin/python2.7).那么为什么它会在/usr/local/bin 中查找?

这是我的 RPM SPEC 的核心:

%prep%setup -q%建造./configure --prefix=/tmp/python2.7制作%安装进行 altinstall

我仔细查看了 rpm 构建日志,我看到:

需要:/bin/sh/tmp/python2.7/bin/python2.7/usr/bin/env/usr/local/bin/python libc.so.6 libc.so.6(GLIBC_2.0)...[更多...]

好的,那么/usr/local/bin 就在这里...现在,问题是,它是如何确定这些要求的?我是否指定了错误?我需要覆盖某些东西吗?

像许多 rpm 新手一样,我得到了构建部分,但我并没有真正理解"rpmbuild 结束时发生的事情以及实际放入 rpm 文件的内容(除了您在 %files 中指定的文件)然后当你进行 rpm 安装时实际发生了什么.

谁能建议我的安装失败的原因,或者我可以阅读什么来理解为什么我的 rpm 构建需要我正在尝试构建的内容?

解决方案

您应该能够通过在规范文件中添加以下行来解决此问题:

<块引用>

AutoReq:无

这是我对为什么需要这样做的理解.当 rpmbuild 在带有 #! 的 .py 文件中运行时(shebang) 它将自动添加 shebang 指定为要求的二进制文件.不仅如此,如果shebang 是#!/usr/bin/env python,它将为解析为的任何内容添加依赖项($PATH 上的第一个python).

您要么需要关闭自动需求处理,要么找到所有会导致问题的shebang并将其更改为其他内容.

Because I have to install multiple versions of Python on multiple Oracle Linux servers which are built via a kickstart process, I wanted to build a python rpm for our yum repository. I was able to build Python manually using 'make altinstall' which doesn't install over your default system Python installation, so I thought that would be the way to go.

After much trial and error, I managed to build an rpm starting with a .bz2 python 2.7 package - but now when I try to install it, I get an error:

error: Failed dependencies:
    /usr/local/bin/python is needed by Python-2.7.2-1.i386

What the...??? Python is what I'm trying to install!!! And system default Python (2.4) is in /usr/bin/python!!! And my prototyping location for the python directory is /tmp/python2.7 (and the executable was /tmp/python2.7/bin/python2.7). So why is it looking in /usr/local/bin?

Here is the core of my RPM SPEC:

%prep
%setup -q

%build
./configure --prefix=/tmp/python2.7
make

%install

make altinstall

I take a closer look at the rpm build log and I see:

Requires: /bin/sh /tmp/python2.7/bin/python2.7 /usr/bin/env /usr/local/bin/python libc.so.6 libc.so.6(GLIBC_2.0)...[a lot more...]

Ok, so there's where /usr/local/bin comes in... Now, the question is, how is it determining these requirements? Did I specify something wrong? Do I need to override something?

Like many rpm newbies, I get the build part, but I don't really "grok" what happens at the end of rpmbuild and what actually gets put into the rpm file (other than the files you specify in %files) and then what actually happens when you do the rpm install.

Can anyone suggest why my install is failing or what I might read to understand why my rpm build is requiring what I'm trying to build?

解决方案

You should be able to fix this issue by adding the following line to your spec file:

AutoReq: no

Here is my understanding of why this is necessary. When rpmbuild runs across .py files with a #! (shebang) it will automatically add the binary that the shebang specifies as a requirement. Not only that, if the shebang is #!/usr/bin/env python, it will add a dependency for whatever that resolves to (first python on $PATH).

You either need to turn off the automatic requirement processing or find all shebangs that will cause problems and change them to something else.

这篇关于我构建的 Python RPM 无法安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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