Running a command in spec file?

Dave Johansen davejohansen at gmail.com
Fri Aug 30 03:56:27 UTC 2013


On Thu, Aug 29, 2013 at 4:09 AM, Miroslav Suchý <msuchy at redhat.com> wrote:

> On 08/29/2013 12:04 PM, Dave Johansen wrote:
>
>> So does that mean that this is the correct statement to put in the .spec
>> file?
>>
>> %{?scl:scl enable %{scl} "}
>> source /opt/rh/devtoolset-1.1/enable
>> %{?scl:"}
>>
>> What is the %{?scl} macro doing? And am I using it correctly in the above?
>>
>
> This scriplet:
>
>
> %{?scl:scl enable %{scl} "}
> command 1
> %{?scl:"}
>
> basicaly expand to:
>
> %if 0%{?scl}
>   scl enable "command 1"
> %endif
>
> Therefore your scriplet:
>
>
> %{?scl:scl enable %{scl} "}
> source /opt/rh/devtoolset-1.1/enable
> %{?scl:"}
>
> would expand to:
>
> %if 0%{?scl}
>   scl enable "source /opt/rh/devtoolset-1.1/enable"
> %endif
>
> which does not have sense.
> I see that you want to enable SCL and from that moment you want to have
> collection enabled.
> This is not recommended (and therefore there is no such tool to do that).
> You must enable collection for each specific command. Or block of commands
> by heredoc syntax.
>
> For operating on command line, you can do:
>   scl enable devtoolset-1.1 bash
> which will open you shell where collection is enabled until you exit. But
> for spec file, please enable collection for each command/block.
>

Based on my understanding of what you said, this is my best guess at what
the lines in the .spec should be:

%{?scl:scl enable devtoolset-1.1 "}
%configure --disable-static
%{?scl:"}

But that doesn't work, so I'm obviously doing something wrong.

If I just do these two lines, then it works:
source /opt/rh/devtoolset-1.1/enable
%configure --disable-static

But my understanding was that there was something wrong with doing that, so
what is the proper way to enable the devtoolset-1.1 scl for use with the
configure macro?

Thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20130829/b4cdba69/attachment.html>


More information about the devel mailing list