[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Macros get expanded in comments..



On Sun, 24 Sep 2000, Tim Mooney wrote:

>>I have a spec file which I have a construct like:
>>
>>%define this	that
>>#%define this    somethingelse
>>
>>After a bit of hair pulling I found that the commented out macro
>>definition is acting as if not commented out after all.  Is this
>>a bug or a feature?  If the latter, how can I get the desired
>>operation?
>
>It's not a bug.  See past discussion on this list regarding this issue.
>%define is context free, unlike what you may be used to with cpp et. al.
>Jeff Johnson (RPM grand-poobah) has stated that when more pressing issues
>with RPM are resolved, he plans to spend some more time on the macro system.

Ok, sounds good.


>It's not what you expected, and you're not alone in this regard.  :-)
>Jeff has it on his "to look at" list.  I think his motto is "quality
>patches graciously accepted".   ;-)

Actually, I would give it a shot if RPM had documentation to get
started with, but I've looked at the source, and it would take
some time to get totally familiar with the whole thing enough to
be a useful contributor I believe.  Not outside the realm of
possibility though as I will be digging into RPM before long for
a project I'm working on anyways.


>>In english, what I'm _really_ wanting to do is: 
>> 
>>if( build_os <= Red Hat 6.2 )
>>	%define this	that
>>else
>>	%define this	somethingelse
>>fi
>
>You don't say what version of RPM you're using, but I'll assume 3.0.4 or
>later.

My specific version is 3.0.5, but I would ideally like my
packages to work on stock Red Hat 6.x and possibly 5.x as well.


>Is this package one where you want to be able to distribute
>the source RPMs too, so that anyone can build your package from the SRPMs,
>or is this mainly for in-house builds on different versions of the OS?

It is for creating RPM's of software not currently available in
RPM format for distribution to the masses.  Stuff like Red Hat
contrib..

The package I'm currently working on is the Caudium webserver:

http://sourceforge.net/projects/caudium

>If it's just in-house, you could stick the
>
>	%define this that
>
>in a separate macros file that would be sourced at build time.  Then
>it just becomes a matter of keeping different in-house macro files for
>your different build machines.

Yeah, that would be ok for internal stuff, but not for widespread
distribution.

>If you want to not depend on external files (which other sites wouldn't
>have, so they would be unable to trivially build RPMs from your SRPMs)
>you need to read up on the rpm-3.0.N/doc/manual/macros, specifically
>the part about shell expansion.  If you can determine if it is RH 6.2 or
>less through one (possibly complex) line of shell code, you can %define
>"this" via the shell expansion.

Like the one Matt Wilson just sent to me.  ;o)  That one line
answered a LOT of questions for me.  ;o)


>I'm not an RPM 3.x (or 4.x) expert, so I'm being a little vague (and I
>may have already generated incorrect information despite staying away
>from specifics -- if so, sorry).  There is a way to do what you want, though.
>Hopefully you have enough info to proceed.

Yep, I think the answers everyone has given me have solved the
problem, I just have to implement it now and play a bit.  I think
it will work ok now..

Thanks for your comments.
TTYL


--
         Mike A. Harris  -  Linux advocate  -  Open source advocate
                   Copyright 2000 all rights reserved
                               ----------
Want to run Microsoft Windows software in Linux?  You can!  VMware allows 
you to install and run other operating systems inside a window in X windows.
You can install Windows 95/98/NT/2000, FreeBSD, Solaris, and many more.
3D Games do not work yet, but virtually all office and productivity software
runs excellent.           http://www.vmware.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []