Hide Forgot
Description of problem: RPM wiki [1] as well as [2] Fedora packaging guidelines state that "It's possible to use %%-escaping to force lazy expansion of %global.". However, trying to use "%%global foo bar" on first line of my spec file throws an error "error: line 1: Unknown tag: %global foo bar". So I suspect that the statement is not true. If it is true, then please update the documentation to be more descriptive. Version-Release number of selected component (if applicable): $ rpm -q rpm rpm-4.9.0-9.fc15.x86_64 How reproducible: Always Steps to Reproduce: 1. Insert "%%global foo bar" on the first line of spec file. 2. $ rpmbuild -bi mypackage.spec 3. Actual results: error: line 1: Unknown tag: %global foo bar Expected results: The variable will be lazily evaluated when needed. Additional info: [1] http://rpm.org/wiki/PackagerDocs/Macros [2] http://fedoraproject.org/wiki/Packaging:Guidelines#.25global_preferred_over_.25define
The guideline explanation is a bit misleading or unclear at least. %global is always expanded once at the time of "declaration", no %-escaping changes that. What I suppose the guideline comment means is that you can use "%global foo %%{bar}" which will leave foo defined as literal "%{bar}", which will then have the effect of lazy expansion when you use %{foo}.
Thank you for explanation. That makes sense. Could you please manage to clarify the documentation (both places I liked above)?