Re: [Nagios-devel] nrpe RPM spec file bug(s)

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] nrpe RPM spec file bug(s)

Post by Guest »

Hi

Just to add my 2 cents to this threat:

On Fri, 11 Jan 2008 15:06:56 +0100, "SCHAER Frederic"
wrote:
> I have to admit I tend to agree with you about portability... but then
> the specfiles are still buggy, since they already contain the -r option
> in some places ;)
>
>>Not really, no. The spec-file should be portable enough to work just
>>about everywhere.


What about using rpm-macros?

I know SUSE has the macro %suse_version which is set to the current SUSE
version like 1020 (openSUSE 10.2).
With that, you can just make something like this in your specfile:

%if 0%{?suse_version} > 1020
do_this
%else
do_that
%endif

If you don't need the "> 1020" just leave it out. If the macro is not
present, it will expand to "0" and so RPM jumps in the %else tree (if you
have one). I'm doing this already with some RPMs in the openSUSE
buildservice [1]. I don't know if other distributions like Fedora or
Mandriva have these macros defined on their real plattforms (a look into
/usr/lib/rpm/*macros* should help), but with this you can do thinks like:
%if 0%{?mandriva_version}
...
%endif
%if 0%{?fedora_version}
...
%endif

This makes writing specfiles not really easier, but hopefully in some
future time we always just use one specfile for all... ;-) Other projects
have a directory "distribution" which contains specfiles for each version
and distribution sorted in subdirectories in it.

Regards,
Lars

[1]:
http://en.opensuse.org/Build_Service/cr ... age_how_to







This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked