Bug 141535
Summary: | %{} macros are expanded in comments | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 3 | Reporter: | Rick Mohr <rfmohr> |
Component: | rpm | Assignee: | Jeff Johnson <jbj> |
Status: | CLOSED NOTABUG | QA Contact: | Mike McLean <mikem> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 3.0 | CC: | nobody+pnasrat |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2004-12-01 21:24:38 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Rick Mohr
2004-12-01 20:48:47 UTC
Yep, macro expansion is entirely context free, macros are expanded in comments, within quotes, on the false branch of %if tests, everywhere. Try escaping the % with anothe % to disable the expansion, like # %%{some_macro} Escaping % in a comment by adding another %% is a bad way to handle this. Often times I want to give an example %define within the comment. That means I would have to write it as %%define, and then turn around and add a disclaimer saying that my example will not work because you have to remove the first %. It sort of defeats the purpose of the documentation to start with. Ex - # To define your own macro here, so something like # %%define cfg_localstatedir /var/tmp # But be sure to ignore the first "%" above. I can't show # the real syntax because rpm's macro processor would mistakenly # process the %define in this comment. OH CR*P! My explanation # just triggered another error in rpmbuild! (NOTE: This will indeed cause rpmbuild to fail.) Even the /usr/lib/rpm/macros file that defines most of the macros used by rpmbuild allows this sort of documentation: <snip> # The configure macro does the following: # optionally change to a subdirectory (not implemented). # attempt to update config.guess and config.sub. # run configure with correct prefix, platform, and CFLAGS. # optionally restore current directory (not implemented). # The configure macro should be invoked as %configure (rather than %{configure}) # because the rest of the arguments will be expanded using %*. # # This is the version of %configure used through rpm-3.0.4. #%configure \ # %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \ # CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} # #------------------------------------------------------------------------------ # This is an improved version of %configure (from PLD team). %configure \ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \ ./configure --host=%{_host} --build=%{_build} \\\ --target=%{_target_platform} \\\ --program-prefix=%{?_program_prefix} \\\ --prefix=%{_prefix} \\\ --exec-prefix=%{_exec_prefix} \\\ --bindir=%{_bindir} \\\ --sbindir=%{_sbindir} \\\ --sysconfdir=%{_sysconfdir} \\\ --datadir=%{_datadir} \\\ --includedir=%{_includedir} \\\ --libdir=%{_libdir} \\\ --libexecdir=%{_libexecdir} \\\ --localstatedir=%{_localstatedir} \\\ --sharedstatedir=%{_sharedstatedir} \\\ --mandir=%{_mandir} \\\ --infodir=%{_infodir} </snip> See how nice it is to be able to adequately comment the definitions? If you can provide even one instance of where this might be useful in any sort of typical circumstance, I will happily concede :-) I haven't been able to find a good explanation for this behavior in the other three previous bugzilla postings on this matter. But other than that, the whole rpm concept has been great and I think that the spec files are quite powerfule and flexible. (And I am serious about that!) |