[packagers] noob help needed with %{dist}

Martin Hamant mh at accelance.fr
Fri May 4 18:13:38 CEST 2007


Dag Wieers a écrit :
> On Fri, 4 May 2007, Martin Hamant wrote:
> 
>> Le Fri, 4 May 2007 16:30:55 +0200 (CEST)
>> Dag Wieers <dag at wieers.com> écrivait:
>>
>>> On Fri, 4 May 2007, Martin Hamant wrote:
>>>
>>>> Le Fri, 4 May 2007 13:58:11 +0200 (CEST)
>>>> Dag Wieers <dag at wieers.com> écrivait:
>>>> And so we use it, if defined :
>>>> %{?rh8:%define _without_elfutils 1}
>>>>
>>>> now if i call --define "dist rh8" ; and I disable the first line I
>>>> mentionned in the spec file (the one with dist expansion), then i
>>>> notice that %{rh8} still exists and contains "1" : is it normal ?
>>> I bet you did not really disable it. The macro language in RPM still 
>>> performs the expand even when the line is commented.
>> I didn't know this :-O 
>> I'm not a programmer but I never seen this phenomen before !
>> What's the interest ?
> 
> It's not designed to be like this. Macro expansion is just replacing known 
> pieces (macros) by whatever is behind the macro. It is not necessarly 
> line-oriented. Before the SPEC file is being parsed, they replace whatever 
> needs to be replaced. As a result, comments have no effect.
> 
> In fact, you may want to use a macro in a comment.

Yes it could be useful, and it's not possible do that in a bash script 
for example. But so, there is a remaining question : "how do I quote a 
sample of code which contains expansions, as comment" : I will RTFM.

> 
> 
>> RPM programming is definitively mysterious, and mysteriously not that
>> much documented :/
> 
> RPM is not programming. And it certainly is not mysterious :) In fact, 
> it's very strict and logic if you understand what is going on.
> 
> Here is some information about macro expansion:
> 
> 	http://wraptastic.org/apidocs/html/macros.html
> 
> And I'm sure JBJ can point to more information or explain it much better 
> than me.

It's programming in the way that with macros you can do conditional 
tests, etc. In fact if I understand correctly, RPM "language" is only a 
pre-processing layer before it's passed to the shell.

Thank you for the link and for the help !


More information about the packagers mailing list