Description of problem: I am wondering if this a bug or expected rpmbuild behaviour: Version-Release number of selected component (if applicable): rpm-4.12.0.1-2.fc22 rpm-4.11.3-1.fc20 also on RHEL5 How reproducible: 100% Steps to Reproduce: 1. Define: %global lower() %(echo %1 | tr A-Z a-z) 2. %lower CamelCase 3. %(echo CamelCase | tr A-Z a-z) Actual results: 2. CamelCase 3. camelcase Expected results: 2. camelcase Additional info: Above is a testcase: I am actually trying to define something more complicated than %lower inside a packaging macro.
Yes, this is expected behavior. Body of %global is expanded at definition time. So expansion has following steps: %global lower() %(echo %1 | tr A-Z a-z) => %global %1 %lower CamelCase => CamelCase Use "%define" for lazy expansion: %define lower() %(echo %1 | tr A-Z a-z) %lower CamelCase => %(echo CamelCase | tr A-Z a-z) => camelcase
Okay maybe I gave a bad test-case but I was actually using %define in my original more complex example but it is not working: re-opening.
Nevermind sorry, you're right. This was caused by my using %global mymacro()\ %define lower %(echo %1 | tr A-Z a-z)\ : : (instead of %define mymacro() ...).