简体   繁体   中英

Build RPM from python code which contains virtulal env

I have been asked to create RPM of git repo which has Python code and repo is installed using virtual env of python. Code for virtal env is inside that repo. My rpm is created successfully, but getting errors while extracting RPM using rpm -ivh. Files from the directory of virtual env are conflicting rpm extract. I'm posting errors and my spec file below. Any help in the direction would be appreciated.

Thanks in advance.

RPM spec file
Name: xyz
Version: 1.0
Release: 0
License: GPL
Source: %{name}-%{version}.tar.gz
Prefix: %{_prefix}
Packager: abc
BuildRoot: %{_tmppath}/%{name}-root
%description
rpm
%prep
rm -rf %{_topdir}/BUILD/*
%setup -n xyz

%build

%install
cp -rfa * %{buildroot}

%clean
#rm -rf %{buildroot}
rm -rf $RPM_BUILD_ROOT

%files
/*

%changelog
* Tue Oct 24 2017 abc 1.0.0

In this file, under % prep section you may noticed the macro “%setup -q -n %{name}-%{version}”. This macro executes the following command in the background.

Errors:

file /lib/python2.7/site-packages/setuptools/site-patch.pyc from install of abc conflicts with file from package python-setuptools-0.9.8-7.el7.noarch

file /lib/python2.7/site-packages/setuptools/site-patch.pyo from install of abc conflicts with file from package python-setuptools-0.9.8-7.el7.noarch

file /lib/python2.7/site-packages/setuptools/ssl\_support.py from install of abc conflicts with file from package python-setuptools-0.9.8-7.el7.noarch

file /lib/python2.7/site-packages/setuptools/ssl\_support.pyc from install of abc conflicts with file from package python-setuptools-0.9.8-7.el7.noarch

file /lib/python2.7/site-packages/setuptools/ssl\_support.pyo from install of abc con

The errors at the end show the problem - your RPM is trying to overwrite the system's setuptools files like /lib/python2.7/site-packages/setuptools/site-patch.pyc . This is likely because your "install" simply dumps all files at the top-level of the machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM