Re: Running a command in spec file?

2013-08-30 Thread Miroslav Suchý

On 08/30/2013 05:56 AM, Dave Johansen wrote:

But that doesn't work


You mean that it is not executed at all? Then you probably do not have defined macro scl. Which is probably because you 
do not have installed meta-package (devtoolset-1.1-build) in you buildroot.
Note that if you are using buildroot, it will not help you to use BuildRequires as it need to be installed before 
src.rpm is evaluated. So you must modify mock config:

https://fedoraproject.org/wiki/User:Bkabrda/SCLGuidelinesDraft#Building_Packages

--
Miroslav Suchy, RHCE, RHCDS
Red Hat, Software Engineer, #brno, #devexp, #fedora-buildsys
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-30 Thread Dave Johansen
On Fri, Aug 30, 2013 at 12:46 AM, Miroslav Suchý msu...@redhat.com wrote:

 On 08/30/2013 05:56 AM, Dave Johansen wrote:

 But that doesn't work


 You mean that it is not executed at all? Then you probably do not have
 defined macro scl. Which is probably because you do not have installed
 meta-package (devtoolset-1.1-build) in you buildroot.
 Note that if you are using buildroot, it will not help you to use
 BuildRequires as it need to be installed before src.rpm is evaluated. So
 you must modify mock config:

 https://fedoraproject.org/wiki/User:Bkabrda/SCLGuidelinesDraft#Building_Packages


That seems a bit different than what I'm going for. These packages won't
build without the devtoolset SCL, so I can't support the package without
that SCL. So is using that macro really the right thing to do?
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Stanislav Ochotnicky
Quoting Dave Johansen (2013-08-28 21:58:38)
 On Wed, Aug 28, 2013 at 9:13 AM, Remi Collet fed...@famillecollet.com wrote:
 
  Le 28/08/2013 18:09, Dave Johansen a écrit :
   I'm trying to make a spec file that uses the devtoolset in RHEL 5/6 (
   rhn.redhat.com/errata/RHEA-2013-0175.html ) but I haven't been able
   to figure out how to enable devtoolset in the spec file. If I run 'scl
   enable devtoolset-1.1 bash' before doing rpmbuild it works, but how do
   I run a command like that in the spec file?
 
  In %build:
 
  . /opt/rh/devtoolset-or-sclname/enable
 
 The enable script wasn't executable, but sourcing it worked like a charm.

Technically, yes...the above works but doesn't ensure it will keep working. I
believe normally this convoluted way is proper way to execute some commands in
an SCL within spec file:

%{?scl:scl enable %{scl} }
# this is a shell
command 1
command 2
...
%{?scl:}

This way you can use the same spec file as SCL and out of SCL.

-- 
Stanislav Ochotnicky sochotni...@redhat.com
Software Engineer - Developer Experience

PGP: 7B087241
Red Hat Inc.   http://cz.redhat.com
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Vít Ondruch

Dne 29.8.2013 10:19, Stanislav Ochotnicky napsal(a):

Quoting Dave Johansen (2013-08-28 21:58:38)

On Wed, Aug 28, 2013 at 9:13 AM, Remi Collet fed...@famillecollet.com wrote:

Le 28/08/2013 18:09, Dave Johansen a écrit :

I'm trying to make a spec file that uses the devtoolset in RHEL 5/6 (
rhn.redhat.com/errata/RHEA-2013-0175.html ) but I haven't been able
to figure out how to enable devtoolset in the spec file. If I run 'scl
enable devtoolset-1.1 bash' before doing rpmbuild it works, but how do
I run a command like that in the spec file?

In %build:

. /opt/rh/devtoolset-or-sclname/enable

The enable script wasn't executable, but sourcing it worked like a charm.

Technically, yes...the above works but doesn't ensure it will keep working. I
believe normally this convoluted way is proper way to execute some commands in
an SCL within spec file:

%{?scl:scl enable %{scl} }
# this is a shell
command 1
command 2
...
%{?scl:}

This way you can use the same spec file as SCL and out of SCL.



Or using heredoc sytax:

%{?scl:scl enable %scl -  \EOF}
# this is a shell
command 1
command 2
...
%{?scl:EOF}



Vít
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Miroslav Suchý

On 08/29/2013 10:19 AM, Stanislav Ochotnicky wrote:

%{?scl:scl enable %{scl} }
# this is a shell
command 1
command 2
...
%{?scl:}


Just one command with this syntax. If you need more command, you have to use 
heredoc as Vít said in this thread.

--
Miroslav Suchy, RHCE, RHCDS
Red Hat, Software Engineer, #brno, #devexp, #fedora-buildsys
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Dave Johansen
On Thu, Aug 29, 2013 at 2:17 AM, Miroslav Suchý msu...@redhat.com wrote:

 On 08/29/2013 10:19 AM, Stanislav Ochotnicky wrote:

 %{?scl:scl enable %{scl} }
 # this is a shell
 command 1
 command 2
 ...
 %{?scl:}


 Just one command with this syntax. If you need more command, you have to
 use heredoc as Vít said in this thread.


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?

Thanks,
Dave
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Miroslav Suchý

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.


--
Miroslav Suchy, RHCE, RHCDS
Red Hat, Software Engineer, #brno, #devexp, #fedora-buildsys
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Vít Ondruch

Dne 29.8.2013 11:17, Miroslav Suchý napsal(a):

On 08/29/2013 10:19 AM, Stanislav Ochotnicky wrote:

%{?scl:scl enable %{scl} }
# this is a shell
command 1
command 2
...
%{?scl:}


Just one command with this syntax. If you need more command, you have 
to use heredoc as Vít said in this thread.




Actually the syntax is correct. However, one advantage of heredoc is 
that you can use quotes freely, e.g. this does *not* work (unless you 
escape the double quotes):


%{?scl:scl enable %{scl} }
# this is a shell
command 1
command 2
...
%{?scl:}


while this is perfectly OK:


%{?scl:scl enable %scl -  \EOF}
# this is a shell
command 1
command 2
...
%{?scl:EOF}


In other words, heredoc makes the conversion from regular .spec to SCL 
.spec a bit easier in some cases.



Vít
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-29 Thread Dave Johansen
On Thu, Aug 29, 2013 at 4:09 AM, Miroslav Suchý msu...@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
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Running a command in spec file?

2013-08-28 Thread Dave Johansen
I'm trying to make a spec file that uses the devtoolset in RHEL 5/6 (
rhn.redhat.com/errata/RHEA-2013-0175.html ) but I haven't been able
to figure out how to enable devtoolset in the spec file. If I run 'scl
enable devtoolset-1.1 bash' before doing rpmbuild it works, but how do
I run a command like that in the spec file?

The closest thing I could find is this:
http://www.rpm.org/wiki/PackagerDocs/Macros

But when I tried using a macro or running just %(shell_command) it
appears that's happening in a subshell and not having the necessary
effect when returning to the main shell. Is there some trick to run a
shell command in the main shell?

Thanks,
Dave
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-28 Thread Remi Collet
Le 28/08/2013 18:09, Dave Johansen a écrit :
 I'm trying to make a spec file that uses the devtoolset in RHEL 5/6 (
 rhn.redhat.com/errata/RHEA-2013-0175.html ) but I haven't been able
 to figure out how to enable devtoolset in the spec file. If I run 'scl
 enable devtoolset-1.1 bash' before doing rpmbuild it works, but how do
 I run a command like that in the spec file?

In %build:

. /opt/rh/devtoolset-or-sclname/enable


Remi.
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-28 Thread Alec Leamas

On 2013-08-28 18:09, Dave Johansen wrote:

I'm trying to make a spec file that uses the devtoolset in RHEL 5/6 (
rhn.redhat.com/errata/RHEA-2013-0175.html ) but I haven't been able
to figure out how to enable devtoolset in the spec file. If I run 'scl
enable devtoolset-1.1 bash' before doing rpmbuild it works, but how do
I run a command like that in the spec file?

The closest thing I could find is this:
http://www.rpm.org/wiki/PackagerDocs/Macros

But when I tried using a macro or running just %(shell_command) it
appears that's happening in a subshell and not having the necessary
effect when returning to the main shell. Is there some trick to run a
shell command in the main shell?

Thanks,
Dave
Do you need it enabled while parsing the spec? Then I have no idea. 
Otherwise, can't you just run the command in e. g., %build like:


%build

scl
enable devtoolset-1.1 bash
more commands

--alec


--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Re: Running a command in spec file?

2013-08-28 Thread Dave Johansen
On Wed, Aug 28, 2013 at 9:13 AM, Remi Collet fed...@famillecollet.com wrote:

 Le 28/08/2013 18:09, Dave Johansen a écrit :
  I'm trying to make a spec file that uses the devtoolset in RHEL 5/6 (
  rhn.redhat.com/errata/RHEA-2013-0175.html ) but I haven't been able
  to figure out how to enable devtoolset in the spec file. If I run 'scl
  enable devtoolset-1.1 bash' before doing rpmbuild it works, but how do
  I run a command like that in the spec file?

 In %build:

 . /opt/rh/devtoolset-or-sclname/enable

The enable script wasn't executable, but sourcing it worked like a charm.

Thanks,
Dave
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct