Mailinglist Archive: opensuse-packaging (139 mails)

< Previous Next >
Re: [opensuse-packaging] RPM condition
  • From: "Dominique Leuenberger" <Dominique.Leuenberger@xxxxxxxxxxxxx>
  • Date: Tue, 18 Mar 2008 16:53:07 +0100
  • Message-id: <47E00183.2554.0029.1@xxxxxxxxxxxxx>
On 3/18/2008 at 17:45, Bernhard Walle <bwalle@xxxxxxx> wrote:
Hello,

can somebody help me in writing

%if %{undefined rhel_version} && %{undefined centos_version}
# code
%else
# code
%endif

in a way that the build in the OBS / SUSE_Linux_10.0 succeeds? I
currently get a parser error. Thanks for your help.

you could simply use something like

%if 0%{rhel_version}%{centos_version} == 0
#code
%else
#code
%endif

This should even work in OBS. But a suggestion for general coding practice: try
not to negate questions like not RHEL and not Centos.
why not asking if RHEL or Centos, then do something? Is normally much easier to
achieve and to read later on.

Dominique

PS: no warranty on whatsoever.. I did not test this snipplet and I am not sure
about the variables for rhel_version and centos_version (but they can easily be
found in the obs projects config file normally).

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >
References