build rpm without compiling the source file

痞子三分冷 提交于 2019-12-11 00:04:29

问题


I am trying a sample rpm package with single file.

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.

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 command rpmbuild -v -bb

Spec File:

Name: python_test_rpm

Version: 1

Release: 1

Summary: Sample RPM for Linux Installer

Group: Development/Tools

License: GPL

URL: None

Source: python_test_rpm.tar.gz

BuildRoot: /home/rpmdev/rpmbuild

%description

POC package for Linux RPM installer

%prep

%setup -n "python_test_rpm"

%install

rm -rf "$RPM_BUILD_ROOT"

mkdir -p "$RPM_BUILD_ROOT/python_test_rpm"

cp -R _mock_backport.py "$RPM_BUILD_ROOT/python_test_rpm"

%files

/python_test_rpm/_mock_backport.py

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)

error: Bad exit status from /var/tmp/rpm-tmp.4gSvIa (%install)

RPM build errors: Bad exit status from /var/tmp/rpm-tmp.4gSvIa (%install)


回答1:


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.

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.



来源:https://stackoverflow.com/questions/40802045/build-rpm-without-compiling-the-source-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!