在不编译源文件的情况下构建 rpm [英] build rpm without compiling the source file
问题描述
我正在尝试使用单个文件的示例 rpm 包.
I am trying a sample rpm package with single file.
在我的源文件夹中有 python_test_rpm.tar.gz,它只包含一个 python 脚本文件.但是,该文件不是有效的 python 脚本.
In my source folder I have python_test_rpm.tar.gz which contains only one python script file. But, the file is not a valid python script.
我要做的就是将其打包并将其部署在特定文件夹中.在执行 rpm build 命令时,它在 python 脚本中显示编译/语法错误.如何跳过此验证并进行构建.
All I want to do is package this and deploy it in a specific folder. While executing the rpm build command it is showing the compilation/syntax error in the python script. How to skip this validation and make the build.
rpmbuild 命令rpmbuild -v -bb
rpmbuild command rpmbuild -v -bb
规范文件:
名称:python_test_rpm
Name: python_test_rpm
版本:1
发布:1
总结:Linux 安装程序的示例 RPM
Summary: Sample RPM for Linux Installer
组:开发/工具
许可证:GPL
网址:无
来源:python_test_rpm.tar.gz
Source: python_test_rpm.tar.gz
BuildRoot:/home/rpmdev/rpmbuild
BuildRoot: /home/rpmdev/rpmbuild
%说明
Linux RPM 安装程序的 POC 包
POC package for Linux RPM installer
%准备
%setup -n "python_test_rpm"
%setup -n "python_test_rpm"
%安装
rm -rf "$RPM_BUILD_ROOT"
rm -rf "$RPM_BUILD_ROOT"
mkdir -p "$RPM_BUILD_ROOT/python_test_rpm"
mkdir -p "$RPM_BUILD_ROOT/python_test_rpm"
cp -R _mock_backport.py "$RPM_BUILD_ROOT/python_test_rpm"
cp -R _mock_backport.py "$RPM_BUILD_ROOT/python_test_rpm"
%个文件
/python_test_rpm/_mock_backport.py
/python_test_rpm/_mock_backport.py
错误信息:编译/home/rpmdev/rpmbuild/BUILDROOT/python_test_rpm-1-1.x86_64/python_test_rpm/_mock_backport.py...语法错误:函数中不允许使用不合格的 exec'_set_signature' 它包含一个带有自由变量的嵌套函数(_mock_backport.py,第 191 行)
Error Message: Compiling /home/rpmdev/rpmbuild/BUILDROOT/python_test_rpm-1-1.x86_64/python_test_rpm/_mock_backport.py ... SyntaxError: unqualified exec is not allowed in function '_set_signature' it contains a nested function with free variables (_mock_backport.py, line 191)
错误:来自/var/tmp/rpm-tmp.4gSvIa (%install) 的错误退出状态
error: Bad exit status from /var/tmp/rpm-tmp.4gSvIa (%install)
RPM 构建错误:来自/var/tmp/rpm-tmp.4gSvIa (%install)
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.4gSvIa (%install)
推荐答案
简单的解决方法:在 %install 末尾添加exit 0"将禁用试图生成 %.pyo/%.pyc 的构建根策略脚本文件.
The easy fix: Adding "exit 0' at the end of %install will disable build root policy scripts that are trying to generate %.pyo/%.pyc files.
更好的修复包括覆盖编译 python 文件的特定构建根策略脚本,或者简单地修复/注释未编译的代码.
Better fixes include overriding the specific build root policy script that is compiling python files, or simply fixing/commenting the code that does not compile.
这篇关于在不编译源文件的情况下构建 rpm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!