[Fedora-packaging] Correction to guidelines on %define vs %global
Panu Matilainen
pmatilai at laiskiainen.org
Wed May 20 10:23:18 UTC 2009
Apologies for missing this when the recommendation of %global over %define
in Fedora guidelines was being discussed, but better late than never...
https://fedoraproject.org/wiki/Packaging/Guidelines#.25global_preferred_over_.25define
says "The two macro defining statements behave the same when they are a
the top level of rpm's nesting level" but this is not correct:
The body of a %global macro is expanded at definition time, whereas the
body of a %define is expanded only when used. For many uses it doesn't
make any difference but identical they are not, even on top level - for
example see the attached example spec:
$ rpmbuild -bp macroex.spec 2>/dev/null|grep ^case
case1: first - second
case2: second - %{xxx}
Another example of this difference (in case of parametrized macros):
https://bugzilla.redhat.com/show_bug.cgi?id=495658
- Panu -
-------------- next part --------------
%global xxx first
%global glob1 %{xxx}
%define def1 %{xxx}
%global glob2 %%{xxx}
%define def2 %%{xxx}
%global xxx second
Name: macroex
Version: 1
Release: 1
License: GPL
Group: Testing
Summary: global vs define
%description
%{summary}
%prep
echo case1: %{glob1} - %{def1}
echo case2: %{glob2} - %{def2}
More information about the packaging
mailing list