0
votes

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
1
You should install virtualenv in a directory like /opt/<app name>. Your %files section should correspond to that. Currently it is the one giving you errors, because you're packaging the whole build root! It must be specific in what files are packaged. - Danila Vershinin
Thank you for your suggestion. I was able to extract RPM after adding files in file section. - Chaitali

1 Answers

0
votes

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.