Need some help understanding the RPM spec bit operator

Mitko Haralanov mitko at qlogic.com
Thu Aug 12 19:12:23 UTC 2010


Hi all,

I am having some trouble understanding how the RPM spec bit operator
seems to work. The documentation that I have been able to find confirms
my understanding of it but, in practice, it doesn't work that way.

In my spec file, I define a variable like this:
%{!?debug: %global debug 0}
%if %{debug}
%define __strip /bin/true
%endif

Later on I use that same variable like this:
./configure --prefix=%{_prefix} %{?debug: --enable-debug}

The rpmbuild command line can be called with "--define 'debug 1'" when
compiling with debugging enabled of without that "--define" when
compiling without debugging.

However, no matter what the value of the %{debug} variable is,
"--enable-debug" is present on the ./configure command line. Why is
that? I thought that the bit operator tests not only whether a variable
is defined but also whether it's value is 0 or 1?

-- 
Mitko Haralanov					 mitko at qlogic.com
Senior Software Engineer			     650.934.8064
NSG InfiniBand Engineering		    http://www.qlogic.com
==========================================


More information about the Rpm-list mailing list