Memoizing macro values

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

 



In Fedora, we have this:

/usr/lib/rpm/macros.d/macros.python:%python_sitelib %(RPM_BUILD_ROOT= %{__python} -Esc "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '%{_prefix}', 'base': '%{_prefix}'}))")
/usr/lib/rpm/macros.d/macros.python3:%python3_sitelib %(RPM_BUILD_ROOT= %{__python3} -Ic "import sysconfig; print(sysconfig.get_path('purelib', vars={'platbase': '%{_prefix}', 'base': '%{_prefix}'}))")

This is a %define-style macro, so the macro gets re-evaluated for every
expansion.  It can make spec file operations really, really slow.

It's possible to work around this in spec files like this:

%{?python3_sitearch: %global python3_sitearch %{python3_sitearch}}

But this is quite ugly, and I wonder if there is a nice way to do it
directly in the macros file instead.  I think I know how do it with Lua,
but maybe there is a better way?

Thanks,
Florian

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list



[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux