Heads-up: %define vs %global in specs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




For the impatient:

Starting with today's rawhide, the these kind of constructs in specs no longer "work":
	%{?!foo: %define foo bar}
For the generally desired effect, the above simply becomes:
	%{?!foo: %global foo bar}

This is already recommended by the Fedora guidelines, but packages which haven't been updated to follow the guideline might need revising:
https://fedoraproject.org/wiki/Packaging/Guidelines#.25global_preferred_over_.25define

The longer version:

As explained in the guidelines, %define nested in %{ } block was never supposed to work, but due to a longstanding bug in rpm macro engine it has seemed to work in many cases... until you do something completely unrelated in the spec and it suddenly breaks in mysterious ways. Consider this example spec:

--- snip ---
%{!?foo: %define foo bar}
%define dofoo() true

Name:             macroscope
Version:          1.0
Release:          1
License:          Testing
Summary:          Testing macro behavior

%description
%{summary}

%prep
echo 1: %{foo}

%dofoo

echo 2: %{foo}

%files
%defattr(-,root,root)
--- snip ---

You'd probably expect %{foo} to expand to "bar" in both 1 and 2, but due to this funny little macro buglet, you'd get this rather non-obvious result:
1: bar
2: %{foo}

What you start getting now is:
1: %{foo}
2: %{foo}

...in other words, the %define inside %{} block goes out of scope when the block ends, and you probably wanted to use %global there instead.

	- Panu -

--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux