Build CentOS 5 generic RPM on CentOS 6

This article was published 4 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

I’ve been trying to build a generic RPM (PHP code only, nothing linked) that installs on CentOS 5 and CentOS 6. We used to do this on CentOS 5, but when we moved our build box to CentOS6 we started to see errors that looked the the following:

rpmlib(FileDigests) is needed by my-example-project-1.2.3-1.noarch
rpmlib(PayloadIsXz) is needed by my-example-project-1.2.3-1.noarch

This is because the RPM was built on CentOS 6, which uses a new compression algorithm that CentOS 5 doesn’t know about.

To make your RPM CentOS 5 and CentOS 6 compatible, add the following to your spec file below the Requires section.

%define _source_filedigest_algorithm md5
%define _binary_filedigest_algorithm md5
%define _source_payload w0.gzdio
%define _binary_payload w0.gzdio

This makes your RPM CentOS 5 compatible

Thoughts on this post

Leave a comment?

Leave a Reply