No edit summary |
|||
Line 26: | Line 26: | ||
The reason this hasn't bitten us as often is that due to a minor bug in rpm the invalidated local macro definition is not garbage collected unless other events force rpm to. So the bug is seldomly triggered, but when it is, it is difficult to diagnose the issue. That's why we'd like to keep away from <code>%define</code>s and educate packagers to use <code>%global</code> by default to avoid creation of new latent bugs. | The reason this hasn't bitten us as often is that due to a minor bug in rpm the invalidated local macro definition is not garbage collected unless other events force rpm to. So the bug is seldomly triggered, but when it is, it is difficult to diagnose the issue. That's why we'd like to keep away from <code>%define</code>s and educate packagers to use <code>%global</code> by default to avoid creation of new latent bugs. | ||
[[Category:Packaging guidelines drafts]] |
Revision as of 21:54, 17 February 2009
%global preferred over %define
current usage of %define beneath Packaging
all uses are for either
%{!?foo:%define foo ...}
usage, or- global top level macor definitions.
So both can be simply s/%define/%global/g
.
Proposal for addition into the guidelines
%global preferred over %define
Use %global
instead of %define
, unless you really need only locally defined submacros within other macro definitions (a very rare case).
Rationale: The two macro defining statements behave the same when they are a the top level of rpm's nesting level.
But when they are used in nested macro expansions (like in %{!?foo: ... }
constructs, %define
theoretically only lasts until the end brace (local scope), while %global
definitions have global scope.
The reason this hasn't bitten us as often is that due to a minor bug in rpm the invalidated local macro definition is not garbage collected unless other events force rpm to. So the bug is seldomly triggered, but when it is, it is difficult to diagnose the issue. That's why we'd like to keep away from %define
s and educate packagers to use %global
by default to avoid creation of new latent bugs.