[Rpm-maint] [rpm-software-management/rpm] `%{_builddir}` has different values in different contexts (Issue #3151)

Panu Matilainen notifications at github.com
Fri Jun 7 08:15:41 UTC 2024


> %global __local_generator_requires make -C %{_builddir}/%{buildsubdir}/%{_vpath_builddir} -s runruby TESTRUN_SCRIPT="--enable-gems %{SOURCE9}"

The real issue here is using %global. It forces the expansion of all those macros way before they are defined at all. Which *happens to work* in many cases because rpm lets unknown macros silently to fall through, and the macros get re-expanded at the time of use. Except that %_builddir is, because it's the top-level place (eg ~/rpmbuild/BUILD), we just override it later to preserve compatibility with most specs that do stuff with %_builddir.

"%global everywhere" is an anti-pattern really. I see so many cases where it gets used and then various bits and pieces in the body are %%'ed to avoid expansion at the time of defition, which is the only different between %global and %define outside parametric macros :facepalm: 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3151#issuecomment-2154328660
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3151/2154328660 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240607/0db0b32c/attachment-0001.html>


More information about the Rpm-maint mailing list