Or to place it more explicit make
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} [%{!?foo: %define foo ...}]
to
%{!?python_sitelib:%global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch:%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} [%{!?foo:%global foo ...}]
Otherwise using parametrized macros can mess things up (#237448). The nesting levels seems to get mixed up and the conditionalized definition above get swallowed away. The %global ensures that this bug doesn't happen.
It may also be cleaner to remove the space between the colon and the percent sign.
On Mon, Apr 23, 2007 at 12:11:35PM +0200, Axel Thimm wrote:
Or to place it more explicit make
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} [%{!?foo: %define foo ...}]
to
%{!?python_sitelib:%global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch:%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} [%{!?foo:%global foo ...}]
Otherwise using parametrized macros can mess things up (#237448). The nesting levels seems to get mixed up and the conditionalized definition above get swallowed away. The %global ensures that this bug doesn't happen.
OK, looks like the bug is indeed in using this construct with %define inside. rpm's lazy garbage collection pollutes the global macor namespace until a more involved nesting construct appears which properly cleans up.
So we really need to change %defines within a %{...} to %globals.
Let's vote on this today unless s/o thinks he needs to investigate further.
It may also be cleaner to remove the space between the colon and the percent sign.
We unanimously agreed to this, and we decided to take this even further to generally discourage use of %define in favour of %global. I created a proposal for the guidelines at
http://fedoraproject.org/wiki/PackagingDrafts/global_preferred_over_define
It also contains the Packaging/* pages that need editing, which I eye-ball-checked that they only contain trivial %defines.
On Tue, Apr 24, 2007 at 05:33:27PM +0200, Axel Thimm wrote:
On Mon, Apr 23, 2007 at 12:11:35PM +0200, Axel Thimm wrote:
Or to place it more explicit make
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} [%{!?foo: %define foo ...}]
to
%{!?python_sitelib:%global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitearch:%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} [%{!?foo:%global foo ...}]
Otherwise using parametrized macros can mess things up (#237448). The nesting levels seems to get mixed up and the conditionalized definition above get swallowed away. The %global ensures that this bug doesn't happen.
OK, looks like the bug is indeed in using this construct with %define inside. rpm's lazy garbage collection pollutes the global macor namespace until a more involved nesting construct appears which properly cleans up.
So we really need to change %defines within a %{...} to %globals.
Let's vote on this today unless s/o thinks he needs to investigate further.
It may also be cleaner to remove the space between the colon and the percent sign.
On Tue, 2007-04-24 at 21:46 +0200, Axel Thimm wrote:
We unanimously agreed to this, and we decided to take this even further to generally discourage use of %define in favour of %global. I created a proposal for the guidelines at
http://fedoraproject.org/wiki/PackagingDrafts/global_preferred_over_define
It also contains the Packaging/* pages that need editing, which I eye-ball-checked that they only contain trivial %defines.
Can rpmlint detect a %define that should be a %global ? (or could it be extended to perform such a test?)
It would be nice to be able to automatically detect such possibly problematic cases.
On Tue, 2007-04-24 at 21:46 +0200, Axel Thimm wrote:
We unanimously agreed to this, and we decided to take this even further to generally discourage use of %define in favour of %global. I created a proposal for the guidelines at
http://fedoraproject.org/wiki/PackagingDrafts/global_preferred_over_define
I agree with this in the case of large macro expansions or cases where nesting might occur. Incidentally, there's a very limited stack size on macro expansions (8192 bytes currently) that is an annoyance when you've got deeply nested macros. I'd love to see that limitation go away :-)
Jon.
packaging@lists.fedoraproject.org