Passing conditional parameters into a rpm build

Keith G. Robertson-Turner redhat-forums at genesis-x.nildram.co.uk
Sun Jan 25 15:44:31 UTC 2004


On Sun, 25 Jan 2004 11:02:32 +0100, Michael Schwendt wrote:

> On Sun, 25 Jan 2004 06:37:25 +0000, Keith G. Robertson-Turner wrote:
> 
>> Just hit a small snag building a package:
>> 
>> %install
>> .... snip ....
>> # FIXME: how to combine [!?_without_gtk OR ?_with_qt] into a single test?
>> %{!?_without_gtk:install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/pixmaps/nvclock.xpm}
>> %{?_with_qt:install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/pixmaps/nvclock.xpm}

>> Specifically, [IF either X OR Y are TRUE, THEN install the file nvclock.xpm]
>> 
>> How?
> 
> Do some programming. Add another variable. :) Else these conditionals get
> unreadable quickly. Example:
> 
> %{?_with_qt: --define _with_pixmap 1}
> %{!?_without_gtk: --define _with_pixmap 1}

Thanks Michael.

I did consider defining more variables, and short term I'll have to do
this anyway, since as the spec stands it is wrong - the manifest lists the
same file twice.

However I can see that there may be other scenarios where an [X OR Y] may
be necessary.

I need to read up on this more, but I can't seem to locate any advanced
docs on things like conditional opts ... maybe I need to start looking on
Amazon :)

To what extent can bash constructs be used in this context?:

%if [%{?_X:1} -o %{?_Y:1}]
foobar
%endif

Or even:

%{%{?_X:1}:%{?_Y:1}:foobar}

That would be ideal if it worked :)

-
K.





More information about the fedora-devel-list mailing list