On 27. 04. 21 8:41, Panu Matilainen wrote:
> On 4/27/21 12:47 AM, Miro Hrončok wrote:
>> We see a problem with this construct:
>>
>> Source0: %{pypi_source}
>>
>> It used to work:
>>
>> $ rpmspec -P python-asyncpg.spec | grep Source0
>> Source0:
>>
https://files.pythonhosted.org/packages/source/a/asyncpg/asyncpg-0.22.0.t...
>>
>>
>> $ rpm --define 'name foo' --define 'version 1.2.3' --eval
>> '%{pypi_source}'
>>
https://files.pythonhosted.org/packages/source/f/foo/foo-1.2.3.tar.gz
>>
>> $ rpm --showrc | grep pypi_source -A3
>> -13: pypi_source %{lua:
>> local src = rpm.expand('%1')
>> local ver = rpm.expand('%2')
>> local ext = rpm.expand('%3')
>>
>> Now we get:
>>
>> error: Bad source: /builddir/build/SOURCES/%{pypi_source}: No such
>> file or directory
>>
>> when building the package.
>>
>> In mock:
>>
>> <mock-chroot> sh-5.1# rpmspec -P python-asyncpg.spec | grep Source0
>> Source0: %{pypi_source}
>>
>> <mock-chroot> sh-5.1# rpm --define 'name foo' --define 'version
>> 1.2.3' --eval '%{pypi_source}'
>> %{pypi_source}
>>
>> <mock-chroot> sh-5.1# rpm --showrc | grep pypi_source -A3
>> (empty)
>>
>>
>> The file is /usr/lib/rpm/macros.d/macros.python-srpm. None of the Lua
>> macros there seem to be known to RPM, but other macros from that file
>> work fine.
>>
>> Is it possible that some Lua code there breaks all the other Lua
>> macros from that file? I see no error, just the macros are not
>> recognized, as if they don't exist.
>>
>
> Sounds strange. I'll look into it, but please file a bug.
https://bugzilla.redhat.com/show_bug.cgi?id=1953910
Thanks.
So the issue was that a %{ in a macro file comment prevents the
remainder of the macros in that file loading. I've reverted the change
for now to consider the right thing: