Delivery of * .so and binary files when creating an RPM package

I created a python application in which I would like to send .so and some binaries in the latest RPM package. After a long read, I found a way to add files / images and other data files to setup.py . Now when I create an RPM using the python setup.py bdist_rpm , it complains about architecture dependency:

  Arch dependent binaries in noarch package error: command 'rpmbuild' failed with exit status 1 

After googling, I found that we can add:

 #%define _binaries_in_noarch_packages_terminate_build 0 

or delete the line BuildArch: noarch in the packagename.spec file to overcome the rpmbuild error. However, every time I add or remove a line from build/bdist.linux-i686/rpm/SPECS/packagename.spec , the python setup.py bdist_rpm always overwrites the .spe file.

Is there a way to avoid Arch dependent binaries and send * .so and other binaries to rpm?

+6
source share
2 answers

The behavior of bdist_rpm is determined by a set of settings in:

  • /usr/lib/rpm/macros
  • /etc/rpm/macros
  • $HOME/.rpmmacros

I bet you only have /usr/lib/rpm/macros on your system. This is normal.

So, to prevent an Arch Binary in noarch package dependent error, you should create /etc/rpm/macros or ~/.rpmmacros and add the following:

 %_unpackaged_files_terminate_build 0 %_binaries_in_noarch_packages_terminate_build 0 

Do not modify /usr/lib/rpm/macros because this file will be overwritten by the system whenever the rpm-build package is updated, lowered, or reinstalled.

If you want to override the behavior for everyone on the system, put the settings in /etc/rpm/macros . If you want to override the behavior for a specific user, add the settings to $HOME/.rpmmacros .

.rpmmacros trumps /etc/rpm/macros , which is superior to /usr/lib/rpm/macros .

Note: It is useful to examine /usr/lib/rpm/macros to find out what settings are available and sample syntax.

As a side note, setting %_unpackaged_files_terminate_build 0 prevents the error error: Installed (but unpackaged) file(s) found:

+1
source
As far as I know, files

.so always arch dependent.

In your case, to avoid having to edit the specification file all the time, you can add --force-arch=<your_arch> to our setup.py bdist_rpm

eg.

 python setup.py bdist_rpm --force-arch=x86_64 
+4
source

All Articles