«

»

Jun
15
2011

Building for older RHEL/Fedora releases on newer systems

If you have ever tried to use a new Fedora or RHEL to build packages for older systems you may have run into errors at installation time. For example, if you were to roll a package on Fedora >=10 or RHEL >=6 and tried to install it on RHEL 5 you will get rpmlib(FileDigests) errors. This is because newer versions of RPM use new compression and hashing algorithms. To force an RPM to be build using the older algorithms add these lines to your spec file:
%define _binary_payload w9.gzdio
%define _binary_filedigest_algorithm 1
%define _source_filedigest_algorithm 1

You can wrap them in a conditional check if you only want to use the older algorithms when targeted older versions of RHEL/Fedora but they are forward compatible, ie you can install a package compiled with these flags on RHEL 6 without a problem.