On 04. 04. 23 19:24, Dan Čermák wrote:
Hi Miro,
On March 31, 2023 10:06:14 AM UTC, "Miro Hrončok" <mhroncok(a)redhat.com>
wrote:
> On 30. 03. 23 23:55, Miro Hrončok wrote:
>> Hello Python packagers.
>>
>> RPM 4.19 introduces this feature:
>>
>>
https://rpm-software-management.github.io/rpm/manual/dynamic_specs.html
>>
>> I decided to write this email to gather my thoughts. I believe that with this, we
can turn manual Python extras subpackages like this:
>>
>> %package -n python3-...
>> Summary: %{summary}
>>
>> %description -n python3-... %_description
>>
>> %pyproject_extras_subpkg -n python3-xxx extra1 extra2
>>
>> (See
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#Extras for
what that means.)
>>
>> Into something like this:
>>
>> %package -n python3-...
>> Summary: %{summary}
>>
>> %description -n python3-... %_description
>> ...
>>
>> %install
>> %pyproject_install
>> ...
>> %pyproject_generate_extras_subpkgs -n python3-xxx
>>
>>
>> The %pyproject_generate_extras_subpkgs macro would parse the installed .dist-info
directory to find out what extras are available and generate subpackages for all of them.
>
> One challenge: When an extra is removed upstream, the packager might not notice that
it needs to be provided/obsole>
That is indeed a problem. What if we made the macro require the list of subpackages (e.g.
as a comma separated string) as an argument? The if the packager wouldn't notice the
removal, they'd get a build error.
We already have that today without dynamic subpackages, because when you know
the list ahead, you can "generate" subpackages already.
$ rpm --eval '%pyproject_extras_subpkg -n python3-... extra1 extra2'
%package -n python3-...+extra1
Summary: Metapackage for python3-...: extra1 extras
Requires: python3-... = %{version}-%{release}
%description -n python3-...+extra1
This is a metapackage bringing in extra1 extras requires for python3-....
It makes sure the dependencies are installed.
%files -n python3-...+extra1 -f
.../BUILD/%{name}-%{version}-%{release}.x86_64-pyproject-ghost-distinfo
%package -n python3-...+extra2
Summary: Metapackage for python3-...: extra2 extras
Requires: python3-... = %{version}-%{release}
%description -n python3-...+extra2
This is a metapackage bringing in extra2 extras requires for python3-....
It makes sure the dependencies are installed.
%files -n python3-...+extra2 -f
.../%{name}-%{version}-%{release}.x86_64-pyproject-ghost-distinfo
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok