Best (cleanest?) conditional formation in a spec file for distro version and arch

Paul Howarth paul at city-fan.org
Wed Jun 18 13:15:42 UTC 2014


On 18/06/14 13:56, Richard Shaw wrote:
> My package freecad has a missing optional dependency on RHEL 6, ppc64
> ONLY so for that build I need to drop a "Requires:"
>
> The dependency doesn't build on ppc64 w/ older gcc and is not easily
> fixable so I decided just to drop the optional dependency for that build
> and arch, but how to accomplish this?
>
> I started building the NOT conditional version but realized it won't
> work as intended even if it worked at all since both NOT conditions
> would have to be true:
>
> %if ! 0%{?rhel} <= 6 && ! %{_arch} ppc64
> Requires:       python-pivy
> %endif
>
> I guess I could layer it but it get's ugly and repetitive:
>
> %if ! 0%{?rhel} <= 6
>      Requires:       python-pivy
> %else
>      %ifnarch ppc64
> Requires:       python-pivy
>      %endif
> %endif
>
> Ideas?

Does this work?

%if 0%{?fedora} || 0%{?rhel} > 6 || "%{_arch}" != "ppc64"
Requires:	python-pivy
%endif

Paul.



More information about the devel mailing list