[CentOS] Helper variables like %{rhel} on CentOS

Mon Jan 3 16:01:57 UTC 2011
Santi Saez <santisaez at woop.es>


I'm trying to use helper variables like %{rhel} in a .SPEC file on 
CentOS (as they are defined in RHEL and Fedora [1]), but it seems they 
are not available.

Is there any way to detect automatically CentOS release from a .SPEC 
file in a RPM build process?

As a workaround, I use this hack:

     %if 0%{?rhel} >= 5

And when calling rpmbuild I use a conditional build, like:

     $ rpmbuild -ba --clean --define "rhel 5"


[1] http://goo.gl/dkGUg

Santi Saez