[Rpm-ecosystem] Dynamic subpackages

Florian Festi ffesti at redhat.com
Mon Feb 10 17:40:47 UTC 2020


Ok, to translate this to a more generalized feature:

Something needs to create those package declarations during build. For
rust this may be done after %prep but the right time is probably after
%install (or after %check). This way everything there is to be known
about the  build is on disk already and the script can look at whatever
it wants. They then would need to be parsed into package objects.

One way to achieve this could be just re-parsing the whole spec file and
have some part only expanded then. That way macros defined in there
could be used in other parts. This is probably much more convenient than
a solution that just parses the output on top of what was read earlier
which would take this part out of the order of the rest of the spec file.

This raises a few questions about consistency when the result of the
first pass and the second pass differ. But that might not be a problem.
The build scripts will be used anymore anyway. Package declarations are
not really used during building. So using the new version should not
break anything.

The concrete file lists would ofc be only created afterwards - same for
the automatic dependencies and the actual (binary) packages.


According the Neal openSuSE already does something very similar by
"doing on-demand rewriting of the spec file through macros and forcing
rpm to reprocess the spec file (%python_subpackages,
%rubygem_subpackages, etc.)"

I have not yet looked into this. But if someone has some pointers, feel
free to post them here.

Florian

-- 
Red Hat GmbH, http://www.de.redhat.com/, Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Laurie Krebs, Michael O'Neill,
Thomas Savage



More information about the Rpm-ecosystem mailing list