Luciano Miguel Ferreira Rocha wrote:
On Wed, Oct 25, 2006 at 05:18:22PM +0200, Erez Zilber wrote:
Luciano Miguel Ferreira Rocha wrote:
On Wed, Oct 25, 2006 at 05:05:17PM +0200, Erez Zilber wrote:
Hi,
I still have some problems. Here's the piece of code that sets the name
of the binary rpm:
if [ "%_vendor" = "suse" ] ; then
my_build_name_fmt=suse_name
echo "suse"
else if [ "%_vendor" = "redhat" ] ; then
my_build_name_fmt=redhat-name
echo "redhat"
else
echo "This version is not supported"
fi
fi
%define _build_name_fmt $my_build_name_fmt.%_arch.rpm
echo "_build_name_fmt = %_build_name_fmt"
When I run it, it does print the _build_name_fmt that I expect to see:
+ echo '_build_name_fmt = suse_name.x86_64.rpm'
_build_name_fmt = suse_name.x86_64.rpm
However, later it prints the following:
Wrote: /usr/src/packages/RPMS/$my_build_name_fmt.x86_64.rpm
Why doesn't it treat my_build_name_fmt as a variable?
I don't know if rpmbuild parses $ in all its steps.
Call it like this instead:
rpmbuild package.spec --define "_build_name_fmt
$my_build_name_fmt.%_arch.rpm"
But $my_build_name_fmt gets its value in run-time. You can see that in
the code piece above. How should that work?
I see shell code. Where do you call it? From %build, %prep or other
places like that? It doesn't work. rpmbuild will change:
--cut--
if [ "%_vendor" = "suse" ] ; then
my_build_name_fmt=suse_name
echo "suse"
else if [ "%_vendor" = "redhat" ] ; then
...
%define _build_name_fmt $my_build_name_fmt.%_arch.rpm
echo "_build_name_fmt = %_build_name_fmt"
--endcut--
to
--cut--
if [ "realvendor" = "suse" ] ; then
my_build_name_fmt=suse_name
echo "suse"
else if [ "realvendor" = "redhat" ] ; then
...
echo "_build_name_fmt = $my_build_name_fmt.realarch.rpm"
--endcut--
(executing the %define before)
And only then, run the code. So it will seem to be working correctly,
but it isn't redefining _build_name_fmt at all.
You'll have to use spec control statements for that, not shell script.
------------------------------------------------------------------------
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list
OK. So I understand that this is not the place for scripting (BTW - I
tried to use the code above in the %install section). I guess that I
need something like:
%if_vendor suse
%define _build_name_fmt open-iscsi-2.0.716.%_arch.rpm
%else
%define _build_name_fmt unknown
%endif
I guess that something is still wrong because it produces an error:
thyme:/home/erezz/work/ofed/OFED-1.1-new-iscsi/SRPMS # rpmbuild -bs
open-iscsi-usr.spec --define "_sourcedir $PWD"
error: parse error in expression
error:
/home/erezz/work/ofed/OFED-1.1-new-iscsi/SRPMS/open-iscsi-usr.spec:25:
parseExpressionBoolean returns -1
Wrote: /usr/src/packages/SRPMS/open-iscsi-usr-1-2.src.rpm
Thanks,
--
____________________________________________________________
Erez Zilber | 972-9-971-7689
Software Engineer, Storage Team
Voltaire – _The Grid Backbone_
__
www.voltaire.com <http://www.voltaire.com/>
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list