我正在尝试在 Centos 7 lxc 容器中使用 mock(从源 rpm)安装 tornado:
mock -r epel-7-x86_64 python-tornado-4.4.2-3.fc26.src.rpm
一切似乎都进展顺利,直到它因以下错误而停止。我已检查该文件是否存在:
# which python2
/usr/bin/python2
这是完整的错误:
Finish: chroot init
Start: build phase for python-tornado-4.4.2-3.fc26.src.rpm
Start: build setup for python-tornado-4.4.2-3.fc26.src.rpm
sh: /usr/bin/python2: No such file or directory
sh: /usr/bin/python2: No such file or directory
Building target platforms: x86_64
Building for target x86_64
Wrote: /builddir/build/SRPMS/python-tornado-4.4.2-3.el7.centos.src.rpm
Getting requirements for python-tornado-4.4.2-3.el7.centos.src
--> python-devel-2.7.5-48.el7.x86_64
--> python2-backports_abc-0.5-1.el7.noarch
--> python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
Error: No Package found for python2-singledispatch
ERROR: Exception(/root/share/python-tornado-4.4.2-3.fc26.src.rpm) Config(epel-7-x86_64) 0 minutes 25 seconds
INFO: Results and/or logs in: /var/lib/mock/epel-7-x86_64/result
ERROR: Command failed:
# /usr/bin/yum-builddep --installroot /var/lib/mock/epel-7-x86_64/root/ --releasever 7 /var/lib/mock/epel-7-x86_64/root//builddir/build/SRPMS/python-tornado-4.4.2-3.el7.centos.src.rpm --setopt=tsflags=nocontexts
Getting requirements for python-tornado-4.4.2-3.el7.centos.src
--> python-devel-2.7.5-48.el7.x86_64
--> python2-backports_abc-0.5-1.el7.noarch
--> python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
Error: No Package found for python2-singledispatch
This the output of build.log:
Mock Version: 1.3.3
ENTER ['do'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/python-tornado.spec'], chrootPath='/var/lib/mock/epel-7-x86_64/root'shell=FalseprintOutput=Trueenv={'LANG': 'en_IE.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ '}gid=135user='mockbuild'timeout=0logger=<mockbuild.trace_decorator.getLog object at 0x1212a50>uid=0)
Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/python-tornado.spec'] with env {'LANG': 'en_IE.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ '} and shell False
sh: /usr/bin/python2: No such file or directory
sh: /usr/bin/python2: No such file or directory
Building target platforms: x86_64
Building for target x86_64
Wrote: /builddir/build/SRPMS/python-tornado-4.4.2-3.el7.centos.src.rpm
Child return code was: 0
知道为什么找不到 python2 吗?或者错误实际上是完全不同的?谢谢!
rpm -qa | grep python-singledispatch
python-singledispatch-3.4.0.2-2.el7.noarch
答案1
答案已在评论中提供。为了完成它,我找到了适用于 CentOS 7 的正确 tornado 源 rpmhttps://centos.pkgs.org/7/epel-x86_64/python34-tornado-4.4.2-1.el7.x86_64.rpm.html。出现错误的是 Fedora(我之前使用的网站没有 CentOS 的网站)。
现在,这个可以工作了:
mock -r epel-7-x86_64 python3-tornado-4.4.2-1.el7.src.rpm
该错误信息具有误导性。
答案2
sh: /usr/bin/python2: No such file or directory
这只是一个警告,不会停止执行。这是因为 spec 文件宏在模拟 chroot 中安装 python 之前尝试运行 python 命令时引发的。
Error: No Package found for python2-singledispatch
这是实际问题。自 EL7 以来,Fedora 改变了 Python 打包策略。基本上,您现在拥有 python2-$x 和 python3-$x 版本的软件包,并且未版本化的 python-$x 名称由 python2-$x 软件包提供。将来的某个时候,这种情况将会改变,python3-$x 将提供 python-$x。F26 龙卷风规范文件要求 python2-singledispatch,而 EL7 中没有提供任何内容。可以向 Fedora 维护者建议的一个解决方案是将“2”包装在仅在 Fedora 上扩展的条件中,如下所示:python%{?fedora:2}-singledispatch
。这将在 Fedora 上扩展为 python2-singledispatch,但在 CentOS 上扩展为 python-singledispatch,这是所需的行为。