On 24. 08. 21 18:47, Mattia Verga wrote:
> On Sun, 22 Aug 2021 at 06:06, Mattia Verga
<mattia.verga(a)protonmail.com> wrote:
>
> The extras macro expands to %package, %description, and %files; you
> have put it in between a %package and %description, which will surely
> confuse rpm somewhat.
>
Oh, I've missed that. Thanks.
Longer explanation: I was lazy to introduce the pyproject-srpm-macros
subpackage that is always installed. Hence none of the pyproject macros is
available in the buildroot when the SRPM is being created in Koji.
When the SRPM macro is created, %pyproject_extras_subpkg macro expands to
literal "%pyproject_extras_subpkg ...". And depending on where you put this
macro into the spec, it might tell you "Unknown tag: %pyproject_extras_subpkg
...".
The documentation/README says:
The macro should be placed after the base package's %description
to avoid
issues in building the SRPM.
It is a trick, because when the SRPM is created without the macros installed,
it will literally put the "%pyproject_extras_subpkg ..." line into the base
package's description.
I guess this is fragile and I should bite the bullet and create
pyproject-srpm-macros.
> You need to ensure that tox is installed as well, if it isn't
listed
> in upstream's requirements to get pulled in by
> %pyproject_buildrequires.
>
I'll try adding the missing BuildReqs (I suppose `%pyproject_buildrequires -t` should
be enough), then I'll have to have a look on how tox works...
Yes, documentation/README for the %tox macro says:
In case you want to run the tests as specified in tox configuration,
you must use %pyproject_buildrequires with -t or -e as explained above.
Using %tox without %pyproject_buildrequires -t/-e is not supported.
from a quick look to the tox config file, it seems that there are
many environments specified, some of them are related to code linting. In the Guidelines I
see these should be skipped, I'll need to find out how to do that.
You don't skip environments, you explicitly select them.
When running %pyproject_buildrequires -t, the default environment is
%{default_toxenv}, i.e. py310 on rawhide.
If you want different environment(s), you pass them to %pyproject_buildrequires
-e. E.g.:
%pyproject_buildrequires -e %{default_toxenv}-foo,%{default_toxenv}-bar
And %tox will run those.
If that is not enough and you want to run different environments in %check, you
can also pass -e directly to %tox:
# Install dependencies from pypy310-foo:
%pyproject_buildrequires -e %{default_toxenv}-foo
...
# But run tests from pypy310-bar:
%tox -e %{default_toxenv}-bar
However, graphql-server has one thing in tox.init hat we cannot support: it
calls pip install directly:
https://github.com/graphql-python/graphql-server/blob/1ccebee8c6102f2855b...
This will fail in rpmbuild and if you want to run %tox, you need to patch/sed
it out.
My answer there hopefully provides more info.
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok