RPM is a package management tool used commonly by SuSE, Fedora and other common linux distros.


Building RPMs on Fedora for another OS

At work we build our software for SLES since that is the OS that our product uses. On my laptop for work I have used various linux distros over the years. As of this time I’ve found Fedora to be one of the nicest distros to use for development; however, it isn’t completely without quirks.

By default the Fedora RPM infrastructure comes configured with all the appropriate options and macros for packaging software for the Fedora distro. This makes sense. What that means is that in order to create compatible RPMs for work I need to undo a lot of the Fedora config. One change I needed to make was to reconfigure RPM to use md5 checksums instead of sha256.

The second more frustrating change was that I needed to disable the "brp-python-bytecompile" macro. Now, I’ll start by saying that I think the Fedora people have gotten it right for python. It’s a bit confusing but they are actually solving a complicated problem which is if python’s *.pyc and *.pyo files are not included in the RPM manifest but instead are created at run time then the RPM doesn’t know that they need to be removed when the RPM is removed. …and there’s not much I hate more than a software package that doesn’t completely remove everything it installs!

Unfortunately the simplest way to disable that macro was to add the following line to the very top of /usr/lib/rpm/brp-python-bytecompile:

# Don't execute. 20150318
exit 0

Extracting files from an RPM

rpm2cpio myrpmfile.rpm | cpio -idmv
" "