rust2rpm/data
Alberto Planas 246ee489a0 Add bundled() provider for vendoring
This commit add basic support for crate vendoring in Rust. The user will
use something like `cargo vendor` to create a vendor directory (that can
later be deployed as a tgz) that contains all the dependencies.

This patch will analyze the output of `cargo manifest` to calculate the
closure of dependencies, and via the new parameter `--provides-vendor`,
print all the 'bundled(crate(NAME/FEATURE)) = 0.0.0' provided by the
binary.

The algorithm is not perfect, as today it will include all the features
resolved for the crate (not all the availables, tho), but basically is
something like:

1.- A dependency generator macro, cargo_bundled, will call
cargo-inspector like this:

  # In STDIN we will provide the name of the binary
  cargo-inspector --provides-vendor --path %{_builddir}

2.- cargo-inspector will search inside the 'path' tree a Cargo.toml that
generate the binary name send via STDIN.

3.- From this point, we go up to the tree to find the top-most
Cargo.toml, as this will be the directory where .cargo/config is living.
We make this directory our `cwd`.

4.- Using the metadata from `cargo manifest`, we generate the closure of
dependencies required by this binary. To simplify the problem, the
current code do not resolve the features, and accept the one resolved by
cargo as valid. Most of the time this will be OK, maybe will include
some extra features needed for other binaries.

5.- Print the 'bundled()' data.

This code will only be executed in the directory 'vendor' is present in
the top-most directory found on step 3.
2021-10-12 15:10:33 +02:00
..
cargo.attr inspector: Add support for multiple features 2019-12-16 08:02:47 +01:00
cargo_bundled.attr Add bundled() provider for vendoring 2021-10-12 15:10:33 +02:00
macros.cargo Parse features with + in their name 2021-02-01 13:56:37 +01:00
macros.rust
macros.rust-srpm Add riscv64 to %rust_arches 2020-08-13 21:24:06 +02:00