rust2rpm/CHANGELOG.md
2023-12-01 15:25:28 +01:00

24 KiB

Version 25.0.3

  • Improve heuristics for parsing command-line arguments.
  • Run tests against Python 3.11, 3.12, and 3.13.
  • Require cargo2rpm v0.1.14 for dependency resolution improvements.

Version 25.0.2

  • Ensure that "hidden" features in the rust2rpm configuration file are valid feature names during validation.
  • Update test fixtures for fixes / changes in cargo2rpm v0.1.13.

Version 25.0.1

This release fixes two small issues that were introduced in new features that were added in version 25.0.0:

  • Using the new "partial version" / version requirement support in conjunction with the --compat flag no longer crashes and now works as expected.
  • Invalid TOML syntax in rust2rpm.toml configuration files no longer causes a crash, and is handled gracefully instead.

Version 25.0.0

This is a major release with several feature additions and fixes for some use cases that were previously not well supported.

  • The minimum required Python version was bumped from 3.10 to 3.11.
  • A dependency on the jsonschema Python package was added.
  • An optional / recommended dependency on rust2rpm-helper was added.
  • The default configuration file format changed from INI-based to TOML.
  • Proper documentation for rust2rpm, rust2rpm.toml, and rust2rpm.conf was added in AsciiDoc format (suitable for converting to man pages).

Added:

  • The recommended way to specify package-specific rust2rpm settings is now with rust2rpm.toml. The INI-based rust2rpm.conf format is deprecated. The TOML format supports a superset of the settings that are supported by the INI-based format, so settings can easily be migrated to the new file format. Settings are validated against a schema definition with jsonschema.
  • The "version" CLI argument is now checked to be either a valid version based on SemVer, or a valid SemVer version requirement. If the argument is a requirement (or "partial version"), rust2rpm will query crates.io for all available versions of the specified crate and select the greatest version that is compatible with the given requirement.
  • A new spec template for "local projects" (which are neither actual "crates" nor "cargo workspace" projects) was added. This template requires much fewer manual modifications after running rust2rpm for projects like this.
  • The rust2rpm.toml configuration file format adds support for storing settings for enabling / disabling all (or specific kinds of) tests, skipping specific tests by name. Additionally, comments for why tests are disabled can also be stored in configuration.
  • Added support for automatically generating a vendor tarball, and for wiring up its use in generated spec files. Packages generated this way require cargo-rpm-macros >= 25 since only this version added support for building against vendored dependencies and other necessary additions and changes to the Rust / cargo RPM macros.

Changed:

  • The algorithm for stripping non-applicable target-specific dependencies was reimplemented in a separate project (rust2rpm-helper) in Rust, based on the same style-preserving TOML editing library that is used by cargo. This fixes several bugs and shortcomings compared to the basic Python implementation, which is kept for backwards compatibility and for situations where rust2rpm-helper is not in $PATH.
  • All spec file templates have been updated to avoid using the potentially broken / limited %version_no_tilde macro. The definition of this macro will likely be moved (or removed) from rust-packaging in the future.
  • The spec template for "cargo workspace" projects has been updated to match recent changes in the template for "crate" packages.
  • The minimum supported version of rust-packaging / cargo-rpm-macros was bumped to cargo-rpm-macros >= 24 for the "fedora" target. This version is available on all current branches of Fedora and on EPEL9.

Fixed:

  • The mechanisms for patching Cargo.toml were adapted to ensure that non-temporary files are not permanently changed (i.e. when running rust2rpm against unpacked / local sources).
  • Packaging crate versions with SemVer "build" metadata is now possible without patching Cargo.toml manually. This version suffix is now automatically stripped by rust2rpm-helper, and the original upstream version is set in the generated spec file and used where necessary.
  • When targeting a local / unpacked project, passing the -s / --store-crate command-line argument now fails gracefully instead of crashing due to an uncaught exception.
  • Heuristics for automatically determining the "version" of a "cargo workspace" project were improved to better match expectations.
  • Files under the "target/" directory are now excluded by the heuristics that determine the list of %doc files in unpacked project sources.

Removed:

N/A

Deprecated:

  • The rust2rpm.conf configuration file format is deprecated in favor of rust2rpm.toml.
  • The - / --stdout mode of rust2rpm will be removed in a future version.
  • The --suffix=SUFFIX argument for rust2rpm is deprecated in favor of the --compat flag.
  • The --all-features flag is deprecated in favor of defining this setting permanently in rust2rpm.toml.
  • The --show-license-map and --translate-license modes of rust2rpm and the underlying Python APIs will be removed in a future version.

Internals:

  • Almost all code in rust2rpm (and, by extension, cargo2rpm) is now covered by type annotations. After applying fixes for some edge cases, rust2rpm now passes static analysis with mypy.

Version 24.4.2

This release fixes a mismatch between the dependencies specified in setup.cfg and requirements.txt.

Version 24.4.1

This release fixes harmless test failures with cargo2rpm v0.1.8 and newer.

Version 24.4.0

This release contains some backwards compatible changes to rendered spec files for packages that ship binaries. Notably, the new %cargo_license and %cargo_license_summary macros are now injected automatically, based on current best practices for Rust packages in Fedora.

Additionally, there is a small fix for the automatic detection and injection of required feature flags for binaries. If the required features are already part of the default feature set, they are no longer added.

Version 24.3.3

This release is a hotfix for v24.3.2 to address an undefined variable issue in the changed logic for storing .crate files that was introduced in v24.3.2.

Version 24.3.2

This release contains only two small fixes:

  • Fixed a subtle bug in the logic for parsing rust2rpm.conf files. The "default" feature was always accepted as a feature name since v24.3.1, but reading the lib+default.requires setting failed and always returned an empty list instead of the actual value.
  • Store downloaded .crate files before attempting to parse Cargo.toml. Previously, storing the .crate file in the current directory was cancelled if Cargo.toml could not be parsed.

Version 24.3.1

This release contains only two small fixes:

  • Fixed a subtle bug in rust2rpm.conf file validation. The "default" feature was only accepted as a feature name if it was explicitly listed in the crate metadata, but the "default" feature is always implicitly defined and is always a valid feature name.
  • Added riscv64 to the list of target_arch values that are considered "supported" when auto-generating Cargo.toml patches to remove "foreign" dependencies.

Version 24.3.0

This version adds new settings to rust2rpm.conf:

  • summary: override the RPM package's Summary with a specific string if the heuristics for generating a summary from the crate's description produces nonsense
  • supported-arches: build library crates and run their tests only on architectures where they are supported

The second setting allows generating spec files for Rust crates that only have limited cross-platform compatibility that can still be included in repositories for all architectures. This provides a workaround for limitations of RPM (subpackages do not inherit ExcludeArch / ExclusiveArch tags) and Fedora build infrastructure (noarch packages are included in repositories for all architectures), and should make it possible to enable more features in more crates without introducing broken dependencies on architectures where some crates do not work.

Version 24.2.0

This version adds a new --compat CLI flag to rust2rpm. It automatically sets the package version suffix based on SemVer compatibility rules. rust2rpm knows which suffix compat packages need based on the version that is passed, so there is no need for the user to guess and pass it manually. The old --suffix [SUFFIX] CLI argument is now deprecated in favor of using --compat.

Version 24.1.0

Added:

  • Added an enabled-features setting to rust2rpm.conf files. This setting accepts a list of features which will be explicitly enabled, i.e. passed as flags to %cargo_* macros. This is useful when building binaries with additional non-default features, or when running tests requires enabling additional features.
  • Added warnings when the currently processed spec file uses version restrictions that are more strict than SemVer. Strong restrictions like these are almost always in place for reasons that don't apply to distribution packages (for example, MSRV compatibility policy).
  • Added "interactive" mode for generating spec files for projects that use a cargo workspace. This mode is required when the heuristics for determining the "main" crate (i.e. for determining the package name and version) fail.

Changed:

  • Feature flags for required features of binary targets are automatically added to %cargo_* macro calls in generated spec files. The detection of "binary" targets does not take required-features into account, so these features need to be explicitly enabled for the expected binaries to be built by cargo install (which skips targets with missing required-features).
  • Attempting to generate spec files for crates that have SemVer "build metadata" in their version string now prints an error and fails. This was previously accepted, but could result in broken packages.
  • Parsing of rust2rpm.conf files now fails if the file content is considered "invalid" (for example, because of unrecognized or inconsistent settings).

Fixed:

  • Tests no longer start to fail every January 1st. The current year is now correctly stripped from test fixtures.

Version 24.0.2

Changed:

  • Rendered spec files now include a "FIXME" in the %install section for crates that build shared libraries with a C ABI (i.e. crates with a cdylib binary target).

Fixed:

  • Crates that manually specify their crate type as "rlib" (which is equivalent to the default "lib" crate type) are now detected as libraries correctly. This fix requires bumping the dependency on cargo2rpm to >= 0.1.2.

Version 24.0.1

Fixed:

  • Additional Requires for feature subpackages specified in rust2rpm.conf settings are respected again (fixes regression from 24.0.0).

Version 24.0.0

This release contains large internal changes to support more use cases and Rust projects that use new syntax for feature dependencies in their Cargo.toml metadata. The functionality for translating between cargo and RPM metadata and the RPM macros and dependency generators were moved to separate projects.

Additionally, the versioning scheme of rust2rpm has changed to allow for minor or bugfix-only releases that do not change spec file rendering and which don't require bumping the version number in the "# Generated by rust2rpm XX" header.

Added:

  • Support for building non-crate projects that use cargo workspaces was added.
  • The default Rust compiler flags now support conditionally building Rust code with frame pointers (only enabled on Fedora 38+ on x86_64 and aarch64).
  • New syntax for cargo feature dependencies (dep:foo) is now supported when creating "remove foreign dependencies" patches.
  • Rust crates that exclusively build shared libraries (cdylib targets) are now (partially) supported by rust2rpm and no longer cause crashes.

Changed:

  • Large parts of the project were refactored, modernized, reorganized into smaller files, and updated with type annotations.
  • The deprecated requests.compat module is no longer used, as all methods used by rust2rpm have been part of the Python standard library for years.

Fixed:

  • Logic for determining the list of feature subpackages was fixed. The assumptions in the previous implementation were broken for crates that use Rust 1.60+ syntax for feature dependencies.
  • Logic for sorting binaries in %files lists was fixed to not cause crashes if there are two or more binaries.
  • Logic in the cfg-expression evaluation was fixed and no longer produces architecture-specific patches.
  • Logic for checking for the existence of a dist-git repo for the current package was fixed to account for URL formatting issues.
  • Files that are read when trying to detect the "host linux distribution" are now closed correctly.
  • Test fixtures were added for the year 2023.

Removed:

  • The cargo-inspector executable was removed. It is no longer used by Rust RPM macros.
  • Files for RPM macros and dependency generators were moved into a separate project (rust-packaging).

Version 23

Added:

  • New macros for collecting license information for all crates that are statically linked into a Rust binary (%cargo_license and %cargo_license_summary).
  • Add support for specifying "testrequires" in rust2rpm.conf. These work similar to "buildrequires", but the specified dependencies will be wrapped in an %if %{with check} conditional in the generated spec file. This can be used to specify BuildRequires that are only needed when running a crate's test suite, but which are not necessary to build the crate itself.

Changed:

  • The list of binaries in %files is now consistently sorted in generated spec files (this only affects crates that build more than one binary, of course).
  • Fall back to the latest pre-release if there are no stable releases (or if all previously published stable released have been yanked).
  • Dropped ExclusiveArch: %{rust_arches} when generating spec files for Fedora. RPM itself will start to depend on Rust components, so Rust will by definition need to be available on all architectures that are supported by Fedora.
  • Replaced i686 with the %{ix86} macro in %{rust_arches}.

Fixed:

  • Ensure that rust2rpm doesn't auto-generate architecture-dependent patches.
  • Ensure both automatically generated and manually written patches affect spec file generation (i.e. feature subpackages).
  • Fix evaluation of cfg-expressions that contain the new "wasm64" target.
  • Only remove target-specific dependencies from feature dependencies if they are optional.
  • The logic for replacing the current version of rust2rpm when comparing spec output in tests has been fixed for OpenSUSE spec templates.

Version 22

This release comes with lots of improvements, bug fixes, and new features, but also drops support for Python versions older than 3.10.

Added:

  • Add macros to allow overriding default Rust compiler flags without needing to manually invoke sed: %rustflags_opt_level, %rustflags_debuginfo, %rustflags_codegen_units (PR#182 / @zbyszek)
  • Add a new rust2rpm.conf setting that mirrors the "--all-features" CLI argument of rust2rpm (PR#191 / @decathorpe)
  • Add support for running rust2rpm without an explicit crate name argument, and use heuristics (value of the %crate macro in an existing spec file, or the name of the current directory) as fallback values (PR#197 / @zbyszek)
  • Add a parser and evaluation logic for "cfg"-expressions and automatically generate a Cargo.toml patch that removes "foreign" dependencies (PR#183 / @zbyszek)
  • Add CC-PDDC ("Creative Commons Public Domain Dedication and Certification") to the list of accepted licenses (PR#203 / @yizhengxie)
  • Added simple logger functionality and print messages to stderr to ensure the "--stdout" mode of rust2rpm continues to work (@decathorpe).

Changed:

  • Change the default name of the rust2rpm configuration file to "rust2rpm.conf", and migrate existing ".rust2rpm.conf" and "_rust2rpm.conf" files (PR#189 / @decathorpe)
  • Dropped unnecessary numbering of patches in spec files generated by rust2rpm (PR#196 / @gotmax23)
  • Dropped translation from SPDX license expressions to Fedora / Callaway notation when targeting Fedora or EPEL (PR#195 / @zbyszek)
  • Apply consistent formatting for %license and %doc files for binary packages and -devel packages (PR#197 / @zbyszek)
  • Skip pre-release versions when running rust2rpm without an explicit version argument (PR#197 / @zbyszek)
  • Change the warning messages that are printed after the "existence check" of rust2rpm succeeds to take compat packages into account (PR#199 / @decathorpe)
  • Split rust2rpm package into "core" functionality without third-party python dependencies, which can be used by cargo-inspector and RPM macros (PR#204 / @decathorpe)
  • Ported rust2rpm packaging to declarative configuration with setup.cfg and pyproject.toml (PR#207 / @decathorpe)
  • Enforced a consistent code formatting standard with black (@decathorpe).

Fixed:

  • Various fixes for the automatic detection of rpmautospec usage in existing spec files and the "--rpmautospec" and "--no-rpmautospec" CLI arguments (PR#190, PR#195 / @zbyszek, @andersblomdell)
  • Fix building with Rust 1.62+, which now fails when re-packaging sources from crates.io (PR#194 / @decathorpe)
  • Fixed the "existence check" when running rust2rpm by requesting the correct URL (PR#199 / @decathorpe)
  • Fixed tox settings for refactored tests and updated list of supported Python versions (PR#208 / @decathorpe)

Version 21

  • new %crate_instdir convenience macro with the path to the installation directory
  • license and documentation files are now installed just once under %crate_instdir and are marked with %license and %doc there
  • link flags are now passed using the RUSTFLAGS envvar and include package note linker script (when %_package_note_file is defined)
  • CFLAGS/CXXFLAGS are passed to the processes started by cargo
  • rpmautospec can be disabled with --no-rpmautospec
  • minor tweaks to existence checks, documentation file detection, license tags, version handling and spec file naming

Version 20

  • fix autodetection of rpmspec if it was already used in the existing spec file
  • fix parsing of ID_LIKE in os-release files
  • drop unused __cargo_skip_build logic
  • improve handling of the upper bound in dependencies with ~ in version
  • minor improvements to grammar and whitespace in generated output

Version 19

  • use rpmautospec by default for Fedora
  • check if a package already exists in Fedora (use --no-existence-check to opt-out)
  • replace hyphens by underscores in Version (issue #124)
  • suppress tracebacks for network errors and similar (issue #125)
  • add bundled() provider for vendoring to be used with 'cargo vendor' and a new --provides-vendor parameter
  • test with Python 3.10 and mark it as supported
  • licensing: add CDDL-1.1, LGPL-2.0-or-later

Version 18

  • Add simple %license and %doc file auto-detection
  • Add optional support for rpmautospec (%autorelease, %autochangelog)
  • Use changelog timestamp format with time and timezone only on OpenSUSE
  • Fix parsing of features with "+" in their name
  • Use Fedora 35 for Fedora license helper script
  • licensing: add Python-2.0

Version 17

  • revert the change to specify all BuildRequires directly, not in %generate_buildrequires

Version 16

  • new 'fedora-helper' tool for Fedora
  • specify all BuildRequires directly, not in %generate_buildrequires
  • introduce new unwanted-features setting in .rust2rpm.conf files to prevent subpackages for specific "unwanted" features from being generated
  • licensing: add LGPL-3.0-or-later, LGPL-2.1-or-later, EUPL-1.2
  • add riscv64 to %rust_arches

Version 14/15

  • Use '--no-track' for 'cargo install'
  • Support versions with multiple wildcards (e.g. '1..')
  • Ignore 'Cargo.toml.orig' which causes issues with build of many crates

Version 13

  • Generate %files entries with '%{version_no_tilde}'
  • Add support for using multiple features at a time in cargo-inspector
  • Implement support for "renamed" dependencies

Version 12

  • Set proper Version field for pre-release versions of crates

Version 11

  • When dynamic BuildRequires are turned on, propagate arguments to %cargo_*
  • Few improvements in algorithm of description splitting into a summary
  • Ignore Cargo.lock for installation (publish lockfile feature in Cargo 1.37+)
  • Replace semantic_version dependency by custom parser
  • Add MPL-2.0-or-later and 0BSD into a Fedora SPDX mapping
  • Pass --cap-lints=warn into the RUSTFLAGS to prevent FTBFS after dependency and/or compiler updates
  • Enable dynamic BuildRequires by default for Fedora target

Version 10

  • Translate '-or-later' and '+' license suffixes properly
  • Check /usr/lib/os-release in addition to /etc/os-release
  • Prettify summary and description automatically
  • Use %{expand:…} for %description to avoid escaping of newlines
  • Add '--suffix' option for "compat" packages
  • Implement option to skip building of crates (aka fast/bootstrap build)

Version 9

  • Always put upstream license in spec
  • Fix version in egg-info
  • Remove accidentally left Cargo.toml.deps
  • Fix packager detection fallback

Version 8

  • Pass '-Ccodegen-units=1' in RUSTFLAGS
  • Switch to '%{build_rustflags}'

Version 7

  • Generate %doc statements for readme from Cargo.toml
  • Split features into subpackages ('rust-$crate+$feature-devel')
  • Add support for dependencies with same name
  • Add support for user configuration ('.rust2rpm.conf', '_rust2rpm.conf')
  • Option to not generate default changelog entry ('--no-auto-changelog-entry')
  • Set 'CARGO_HOME' to the local '.cargo' (required by new Rust)
  • Improvements for crates with pre-release versions
  • Fix '%cargo_install' with crates which use whitespace in files
  • Do not put unneeded optional dependencies in BuildRequires ('-Z avoid-dev-deps')
  • Option to use all crate features when generating spec file
  • Use new-style changelog format (with TZ info) on Fedora
  • Option to use dynamic BuildRequires (requires RPM 4.15+)
  • Environment variables to control packager identity

Version 6

  • Improvements in RPM macros
  • Add support for handling local crates
  • Add option to copy crate into current working directory
  • Filter non-linux dependencies automatically
  • Translate SPDX licenses into Fedora ones (for Fedora and Mageia)

Version 5

  • Add cargo dependency for runtime (devel subpackages)
  • Use cp instead of install in macros in order to keep original permissions
  • Ignore yanked versions when no version is specified
  • Pass --no-fail-fast for cargo-test
  • Treat optional dependencies as "features" as well
  • Add support for "rlib" crate-type
  • Add support for Mageia and (open)SUSE in template

Version 4

  • Switch to /usr/share/cargo/registry for storing crates
  • Explicitly set rustdoc in macro so it won't collide with the one used by user
  • Add initial support for pre-release versions
  • Add support for versions with multiple wildcards (like 1..)

Version 3

  • Use rich dependencies to fulfil requirements
  • Automagically strip [dev-dependencies] when building without tests
  • Add support for wildcard in version
  • Generate initial changelog
  • Use rust-packaging for BuildRequires to break loop
  • Other cleanups and fixes

Version 2

  • Automatic generation of summary and description
  • Initial patching of metadata
  • Save generated spec/patch as files instead of printing to stdout
  • Support for proc-macro kind of library
  • %cargo_build and %cargo_test now accept any parameters
  • Automatically strip [dev-dependencies] when %check is disabled

Version 1

  • initial version with setuptools metadata