RPM_OPT_FLAGS causing problems in spec2scl-modified spec file

Bohuslav Kabrda bkabrda at redhat.com
Thu May 9 07:04:00 UTC 2013


----- Original Message -----
> spec2scl alters specs file by wrapping many commands inside the scl enable
> %{scl} command. This is causing problems in my spec file. For example, I'm
> rebuilding mod_perl as an SCL package for perl514. I've modified the
> mod_perl.spec by hand and have the following:
> 
> %{?scl:scl enable %{scl} "}
> CFLAGS="%RPM_OPT_FLAGS -fpic" %{__perl} Makefile.PL </dev/null \
> 	PREFIX=$RPM_BUILD_ROOT/usr \
> 	INSTALLDIRS=vendor \
> 	MP_APXS=%{_root_sbindir}/apxs \
> 	MP_APR_CONFIG=%{_bindir}/apr-1-config
> %{?scl:"}
> 

So the solution is using a heredoc:
%{?scl:scl enable %{scl} - << \EOF}
# one or more commands
%{?scl:EOF}

This is needed when you want to invoke multiple commands in SCL environment in a row or when you need to do "ENV_VAR=foo command" (your case).
spec2scl should handle these things correctly, if I understand it correctly, you altered this by hand, right? If not, then it's a bug in spec2scl.

Slavek.

> When this gets executed by mock, I get:
> 
> + scl enable perl514 '
> CFLAGS=-O2' -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-
> protector --param=ssp-buffer-size=4 -m64 -mtune=generic '-fpic
> /opt/rh/perl514/root/usr/bin/perl Makefile.PL </dev/null
> PREFIX=/builddir/build/BUILDROOT/perl514-mod_perl-2.0.4-10.el6.x86_64/usr
> INSTALLDIRS=vendor       MP_APXS=/usr/sbin/apxs
> MP_APR_CONFIG=/opt/rh/perl514/root/usr/bin/apr-1-config
> '
> Unable to open /etc/scl/prefixes/
> CFLAGS=-O2!
> RPM build errors:
> error: Bad exit status from /var/tmp/rpm-tmp.P27TDo (%build)
>     Bad exit status from /var/tmp/rpm-tmp.P27TDo (%build)
> Child return code was: 1
> 
> The problem appears to me to be that the RPM_OPT_FLAGS variable contains
> quotes which conflict with the quotes used by the 'scl enable' command.
> 
> Has anyone else run into something like this? If so, how did you deal with
> it?
> 
> --
> Doran L. Barton <doran at bluehost.com> - Senior Developer, Bluehost, RHCE
>  "We serve people like you as good food!"
>     -- A sign outside a Japanese restaurant

-- 
Regards,
Bohuslav "Slavek" Kabrda.


More information about the softwarecollections mailing list