On Aug 12, 2010, at 3:12 PM, Mitko Haralanov wrote: > 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? > The %{?foo} is an existence, not a value test. The %{!?foo} is just the negation of the existence test, i.e. TRUE if foo does not exist. So you've always defined %{debug} but sometimes with value 0. Hint: %if 0%{?debug} ... %endif is one way to map the existence test back to a value test. hth 73 de Jeff > -- > Mitko Haralanov mitko@xxxxxxxxxx > Senior Software Engineer 650.934.8064 > NSG InfiniBand Engineering http://www.qlogic.com > ========================================== > _______________________________________________ > Rpm-list mailing list > Rpm-list@xxxxxxxxxxxxx > http://lists.rpm.org/mailman/listinfo/rpm-list _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxxxxx http://lists.rpm.org/mailman/listinfo/rpm-list