Build CentOS 5 generic RPM on CentOS 6

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

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Leave a comment?

Leave a Reply