Bug 722933 - It's *NOT* possible to use %%-escaping to force lazy expansion of %global.
Summary: It's *NOT* possible to use %%-escaping to force lazy expansion of %global.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-18 14:18 UTC by Vít Ondruch
Modified: 2011-07-19 08:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-19 08:38:44 UTC
Type: ---


Attachments (Terms of Use)

Description Vít Ondruch 2011-07-18 14:18:36 UTC
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

Comment 1 Panu Matilainen 2011-07-19 08:38:44 UTC
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}.

Comment 2 Vít Ondruch 2011-07-19 08:52:47 UTC
Thank you for explanation. That makes sense. Could you please manage to clarify the documentation (both places I liked above)?


Note You need to log in before you can comment on or make changes to this bug.