This is an implementation of the idea described in issue #19.
%cargo_prep injects a profile named "rpm" into the cargo configuration, which inherits from the "release" profile, with overrides as necessary
%cargo_build, %cargo_install and %cargo_test macros are adjusted to use --profile rpm instead of --release
a symbolic link from target/release to target/rpm is created by %cargo_build for backwards compatibility
(for example, some packages install files from target/release/*, like bash completions that are dynamically generated during the build)
Also, this PR includes a change that ensures that any pre-existing .cargo directory is removed before a new .cargo/config is written. This works around crates that ship their own .cargo/config or .cargo/config.toml, which currently causes cargo to print warnings when both files exist (though it does use .cargo/config over .cargo/config.toml if the former exists).
I set up a COPR that has rust-packaging v25 snapshot with these patches applied, and they appear to work as intended:
https://copr.fedorainfracloud.org/coprs/decathorpe/rust-packaging-v25/monitor/
Reviewing the commits separately might be easier than reviewing the full diff.
This is an implementation of the idea described in issue #19.
%cargo_prepinjects a profile named "rpm" into the cargo configuration, which inherits from the "release" profile, with overrides as necessary%cargo_build,%cargo_installand%cargo_testmacros are adjusted to use--profile rpminstead of--releasetarget/releasetotarget/rpmis created by%cargo_buildfor backwards compatibility(for example, some packages install files from target/release/*, like bash completions that are dynamically generated during the build)
Also, this PR includes a change that ensures that any pre-existing
.cargodirectory is removed before a new.cargo/configis written. This works around crates that ship their own.cargo/configor.cargo/config.toml, which currently causes cargo to print warnings when both files exist (though it does use.cargo/configover.cargo/config.tomlif the former exists).I set up a COPR that has rust-packaging v25 snapshot with these patches applied, and they appear to work as intended:
https://copr.fedorainfracloud.org/coprs/decathorpe/rust-packaging-v25/monitor/
Reviewing the commits separately might be easier than reviewing the full diff.