How to pack Python as an RPM to install in / opt?

How to create a binary RPM package from Python 2.7.2 sources for installation in a non-standard prefix such as / opt / python 27?

Assume the following assemblies are correct.

wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz tar zxvf Python-2.7.2.tgz cd Python-2.7.2 ./configure --prefix=/opt/python27 --enable-shared make make test sudo make install 

Instead of the last command, I would like to create a binary RPM.

+4
source share
2 answers

RPMs are created using rpmbuild from the .spec file. As an example, consider python.spec from Fedora.

If you don't need to build from sources, try rpm -relocate to enable the built-in RPM for your distribution:

 rpm -i --relocate /usr=/opt/python27 python-2.7.rpm 
+4
source

It is probably a bit late to answer, but I tried to do something similar, and I did not want to use -relocate because my package was not created to install anywhere other than in / opt.

As I did this, the following two lines were added:

  Prefix: /opt %define _prefix /opt/ 

Remember that you also need to update the% files section to reflect what it now installs in / opt

+1
source

Source: https://habr.com/ru/post/1379359/


All Articles