[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Appreciate advice on %if %foo || %bar syntax



On Wed, 2007-08-29 at 17:48 -0400, Michael Jennings wrote:
> On Wednesday, 29 August 2007, at 20:28:19 (+0200),
> Patrick wrote:
> 
> > I have a spec file which tests for various distro's:
> > 
> > %define is_fc45 %(test -f /etc/fedora-release && cat /etc/fedora-release | egrep -q '4|5' && echo 1 || echo 0)
> > %define is_fc6 %(test -f /etc/fedora-release && grep -c Zod /etc/fedora-release || echo 0)
> > %define is_f7 %(test -f /etc/fedora-release && grep -c Moonshine /etc/fedora-release || echo 0)
> > %define is_rhel4 %(test -f /etc/redhat-release && cat /etc/redhat-release | egrep -q 'release 4' && echo 1 || echo 0)
> > %define is_rhel5 %(test -f /etc/redhat-release && cat /etc/redhat-release | egrep -q 'release 5' && echo 1 || echo 0)
> > 
> > Now I would like to use something like this:
> > 
> > %if %is_fc6 || %is_f7 || %is_rhel5
> > ..do something
> > %endif
> 
> %if %{is_fc6}%{is_f7}%{is_rhel5}
> 
> will expand to
> 
> %if 010
> 
> and will do exactly what you want.

One last question. You used %{is_fc6} while I use %is_fc6. Is your
syntax the one I should be using?

Thanks and regards,
Patrick


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]