[Rpm-maint] [PATCH] forbid #%define
Manfred Hollstein
mh at novell.com
Fri Jun 6 09:15:03 UTC 2008
On Fri, 06 Jun 2008, 11:00:00 +0200, Panu Matilainen wrote:
> [...]
> This sounds like a no-brainer - why should anything be done for comment
> lines? But consider the following spec snippet:
>
> %build
> cat << EOF > example.conf
> # To enable feature foo, uncomment the following:
> #[myplugin]
> #pluginpath = %{_libdir}/%{name}/myplugin.so
> EOF
>
> In this case, you'd actually want the macros to be expanded, despite being
> apparently being commented out. Of course the comment markers here aren't
> intended for the spec parser at all, but how would the parser know that?
> OTOH, if you take something like
>
> %build
> <...>
> #%define testing 1
> %if %{?testing}
> cat << EOF > README
> This is just a test build
> EOF
> %endif
>
> ...you do NOT want the %define to take effect.
Hmm, yes, did not think about this.
> [...]
> Simple and stupid quick hack of a patch to do that attached, might not be
> entirely correct for every possible case but seems to do what intended for
> the cases I tested. This would, by the way of spec conventions, take care
> of the typical problem cases like
> #%define some thing
>
> If you *really* want that define to take place despite being commented,
> just write
> #%{define} some thing
>
> Thoughts?
Sounds reasonable to me.
> - Panu -
Cheers.
l8er
manfred
More information about the Rpm-maint
mailing list