On 4/27/21 11:37 AM, Panu Matilainen wrote:
On 4/27/21 10:28 AM, Miro Hrončok wrote:
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.tar.gz

$ 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: https://github.com/rpm-software-management/rpm/issues/1659

As a follow-up: the *actual* issue was that an unclosed %{ (ditto for %( and %[) in macro file comment would silently affect the parsing of the following lines. That bug was always there, but it's effect became much more dramatic in rpm 4.17 as we now permit empty lines in macro definitions. That caused the stray %{ cause the the remainder of the macro file, rather than just up to next empty line, to be ignored.

        - Panu -
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to