No description
Find a file
Fabio Valentini 0bf11c122d
main: bail if crate version has un-stripped "build metadata"
Versions like "0.4.60+curl-7.88.1" currently break package builds.

Stripping "build metadata" automatically and operating with
"crate version" != "rpm version" might be supported in the future,
but this will require changing the %{crate_instdir} macro, among
other things.

Coincidentally, setting the %{crate_version}" macro in cases of
"crate version" != "rpm version" would also render the lua
implementation of the %{version_no_tilde} macro obsolete.
2023-03-02 22:02:21 +01:00
rust2rpm main: bail if crate version has un-stripped "build metadata" 2023-03-02 22:02:21 +01:00
.gitignore conf: factor out rust2rpm.conf file parsing; add validation and tests 2023-03-02 19:35:58 +01:00
LICENSE update LICENSE with year and update contributors 2023-02-15 20:30:08 +01:00
MANIFEST.in Translate SPDX licenses to Fedora license tags, warn about "/" 2018-08-16 16:16:02 +02:00
NEWS Release 24.0.2 2023-02-16 22:10:10 +01:00
pyproject.toml Enforce consistent formatting with black 2022-07-24 18:47:09 +02:00
README.md rust2rpm: add support for "testrequires" setting in rust2rpm.conf 2022-10-26 11:58:13 +02:00
requirements.txt meta: require cargo2rpm >= 0.1.2 to fix edge case in "is-lib" checks 2023-02-16 21:39:51 +01:00
setup.cfg meta: require cargo2rpm >= 0.1.2 to fix edge case in "is-lib" checks 2023-02-16 21:39:51 +01:00
tox.ini generator: do not include %cargo_install for cdylib-only crates 2023-02-15 20:25:34 +01:00

rust2rpm

rust2rpm is a tool for automatically generating RPM spec files for Rust crates.

rust2rpm.conf

If it is present, a rust2rpm.conf configuration file is read by rust2rpm to override some aspects of the automatic spec file generation.

This file can be committed to dist-git to ensure that these settings will be applied for future updates of a crate package, as well.

The file follows a slightly modified ini syntax. It supports sections for default settings ([DEFAULT]) and target-specific settings (i.e. [fedora]).

These configuration options are available right now:

  • all-features: enable all cargo features when generating BuildRequires, building the crate, and running cargo tests (defaults to false; setting this value to true is equivalent to supplying the --all-features CLI flag)
  • unwanted-features: features or optional dependencies for which no +feature subpackage should be generated (for example, dependencies on Rust compiler internals for crates that are also bundled with Rust itself)
  • buildrequires: additional build dependencies that must be installed for the package to build correctly (i.e., pkgconfig(foo) for the foo-sys crate)
  • testrequires: additional build dependencies that must be installed for the package's tests to build and / or run correctly (treated like buildrequires, but wrapped in an %if %{with check} conditional in the generated spec)
  • lib.requires: additional build dependencies that must be installed for the crate to build correctly as a dependency of another crate (usually, this contains the same values as the buildrequires option)
  • lib+foo.requires: additional build dependencies that must be installed for the crate to build correctly as a dependency of another crate if it has enabled the optional foo feature
  • bin.requires: additional runtime dependencies of the binary application that is built from this crate
[DEFAULT]
unwanted-features =
  compiler_builtins
  rustc-dep-of-std
buildrequires =
  pkgconfig(foo) >= 1.2.3
lib.requires =
  pkgconfig(foo) >= 1.2.3

[fedora]
bin.requires =
  findutils
buildrequires =
lib.requires =
lib+default.requires =
  pkgconfig(bar) >= 2.0.0

Note that features and optional dependencies that are marked as unwanted-features must not be dependencies of other Cargo features that are not marked "unwanted" as well. Failing to consider transitive dependencies will lead to broken dependencies of generated rust-foo+bar-devel packages and / or errors when generating spec files with rust2rpm.

Testing

Invoking tox will automatically run the test suite on all python versions that should be supported.

Use python -m pytest -v or PYTHONPATH=. pytest -v in the source tree (possibly within a virtualenv) to run the tests manually.