TL;DR: I made a .spec file that successfully builds a .rpm
, but rpm -i <file>.rpm
doesn't do all the actions I think it should. Why?
Excerpt from <file>.spec
:
%install
sudo python2.7 -m pip install 'tornado<5'
...#other pip commands...
cp -r $RPM_BUILD_DIR/%{name}-%{version}/* %{buildroot}
(I know this isn't the ideal way to do it, but I'm forced to use CentOS 6 and can't upgrade the system version of python because corporate/shared environment so this was the best way I could figure out.)
All the commands under %install
are correctly run when building the .rpm
, so all of the pip
packages get installed on the machine creating the .rpm
from the .spec
. rpmbuild -ba <file>.spec
completes with exit 0
. However, when I try to install the .noarch.rpm
file that is created (on another system with identical OS/architecture), all that happens is the rpm-specified dependencies get installed and the files get shoved to the correct directories, but the other commands from %install
are not run. What ends up happening is that I try to call the executable that gets made and it errors out because of the missing python packages.
RPM.org says:
Performing any tasks required before the install:
There are cases where one or more commands must be given prior to the actual installation of a package. RPM performs these commands exactly as directed by the package builder, thus eliminating a common source of problems during installations.
...Where am I supposed to specify the commands run prior to package installation if not in the %install
field of the .spec
file?