我构建的 Python RPM 无法安装

发布于 2024-12-04 18:19:40 字数 1120 浏览 4 评论 0原文

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

经过多次尝试和错误,我设法从 .bz2 python 2.7 包开始构建一个 rpm - 但现在当我尝试安装它时,我收到一个错误:

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

What the...???我正在尝试安装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

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

%install

make altinstall

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

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...]

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

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

任何人都可以建议为什么我的安装失败或者我可以阅读什么来理解为什么我的 rpm 构建需要我正在尝试构建的内容?

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?

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

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

发布评论

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

评论(2

北音执念 2024-12-11 18:19:40

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

自动请求:否

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

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

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.

缪败 2024-12-11 18:19:40

rpmbuild 可以变得非常聪明,这就是其中之一。 包含类似内容的脚本文件之一中提取了 /usr/local/bin/python

#!/usr/local/bin/python

它可能从顶部 。尝试在 bz2 文件内的文件中 grep 查找此路径。

rpmbuild can get pretty smart and this is one of those cases. It probably pulled the /usr/local/bin/python from one of your script files containing something like:

#!/usr/local/bin/python

at the top. Try grep'ing for this path in the files within your bz2 file.

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