ferdnyc left a comment (rpm-software-management/rpm#3661)
@pmatilai
> I don't know if it's still in the Fedora guidelines, but "always use
> %global" was bad advice that spread far and wide.
It basically is; there's a bit of hemming and hawing, someone added a
disclaimer about the differences between the two, but the section title says it
all. The current full text of [that guidelines
section](https://docs.fedoraproject.org/en-US/packaging-guidelines/#_global_preferred_over_define)
is:
----
## `%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 at
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.
Note that %define and %global differ in more ways than just scope: the body of
a %define’d macro is lazily expanded (i.e., when used), but the body of %global
is expanded at definition time. It’s possible to use %%-escaping to force lazy
expansion of %global.
----
If that's wrong, we should probably endeavor to get it right with the world.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3661#issuecomment-2729215518
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/3661/[email protected]>_______________________________________________
Rpm-maint mailing list
[email protected]
https://lists.rpm.org/mailman/listinfo/rpm-maint