[Rpm-ecosystem] Dynamic subpackages

Igor Gnatenko ignatenkobrain at fedoraproject.org
Sun Feb 9 09:47:24 UTC 2020


Hello,

As I promised on #rpm.org, I'd like to describe here how we would like to
use potential "dynamic subpackages" feature in Rust packaging.

First of all, rust crates are packages as sources, so there is simply
-devel subpackage containing source code.

That includes Cargo.toml which is the manifest describing what
(dev-)dependencies are, what "features" the crate has and so on.

Those "features" usually mean let's say http2 support, or support for
different compressions, or improved performance or anything what you can
come up with. Apart from triggering some special code paths, most of the
time they add new dependencies. These create dependency loops and huge
bloat of unnecessary dependencies installed on user's systems.

Some time ago I came up with patch for rpmfc which passes package name into
a dependency generators and we were able to split those features into their
own +feature -devel subpackages. This, however, added bunch of boilerplate
into a spec because they have to have the %package, %description, %files
for each feature. And this part can be easily generated from Cargo.toml
manifest.

So for example, if Cargo.toml has following:

[dependencies]
serde_json = { version = "1.0", optional = true }
[features]
json = ["serde_json"]

Then spec should have:

%package     -n %{name}+json-devel
Summary:        %{summary}
BuildArch:      noarch

%description -n %{name}+json-devel %{_description}

This package contains library source intended for building other packages
which use "json" feature of "%{crate}" crate.

%files       -n %{name}+json-devel
%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml

%package     -n %{name}+serde_json-devel
Summary:        %{summary}
BuildArch:      noarch

%description -n %{name}+serde_json-devel %{_description}

This package contains library source intended for building other packages
which use "serde_json" feature of "%{crate}" crate.

%files       -n %{name}+serde_json-devel
%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml

All the requires/provides and such would be automatically generated by our
dependency generators.

This currently is being generated by rust2rpm which generates spec file.
Would be nice if we would not have to do a pre-generation of these.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-ecosystem/attachments/20200209/469c1c72/attachment.html>


More information about the Rpm-ecosystem mailing list