| |
@@ -144,7 +144,7 @@
|
| |
"",
|
| |
"cat >> .cargo/config << EOF",
|
| |
"[source.vendored-sources]",
|
| |
- f'directory = "vendor"',
|
| |
+ 'directory = "vendor"',
|
| |
"",
|
| |
"[source.crates-io]",
|
| |
'registry = "https://crates.io"',
|
| |
@@ -281,24 +281,24 @@
|
| |
awk = evaluater("%__awk")[0]
|
| |
|
| |
assert [line.rstrip() for line in evaluater("%cargo_install")[0].splitlines()] == [
|
| |
- f"(",
|
| |
- f"set -euo pipefail",
|
| |
- f"if {cargo_is_lib} ; then",
|
| |
+ "(",
|
| |
+ "set -euo pipefail",
|
| |
+ f"if {cargo_is_lib} && [ 1 -eq 1 ] ; then",
|
| |
f" CRATE_NAME=$({cargo_to_rpm} --path Cargo.toml name)",
|
| |
f" CRATE_VERSION=$({cargo_to_rpm} --path Cargo.toml version)",
|
| |
f" REG_DIR={buildroot}{cargo_registry}/$CRATE_NAME-$CRATE_VERSION",
|
| |
- f" /usr/bin/mkdir -p $REG_DIR",
|
| |
+ " /usr/bin/mkdir -p $REG_DIR",
|
| |
f" {awk} -i inplace -v INPLACE_SUFFIX=.deps '/^\\[((.+\\.)?((dev|build)-)?dependencies|features)/{{f=1;next}} /^\\[/{{f=0}}; !f' Cargo.toml",
|
| |
f" {cargo} package -l | grep -w -E -v 'Cargo.(lock|toml.orig)' | xargs -d '\\n' /usr/bin/cp --parents -a -t $REG_DIR",
|
| |
- f" /usr/bin/mv Cargo.toml{{.deps,}}",
|
| |
- f" /usr/bin/cp -a Cargo.toml $REG_DIR/Cargo.toml",
|
| |
- f" /usr/bin/rm -f $REG_DIR/Cargo.toml.deps",
|
| |
- f' echo \'{{"files":{{}},"package":""}}\' > $REG_DIR/.cargo-checksum.json',
|
| |
- f"fi",
|
| |
- f"if {cargo_is_bin} ; then",
|
| |
+ " /usr/bin/mv Cargo.toml{.deps,}",
|
| |
+ " /usr/bin/cp -a Cargo.toml $REG_DIR/Cargo.toml",
|
| |
+ " /usr/bin/rm -f $REG_DIR/Cargo.toml.deps",
|
| |
+ ' echo \'{"files":{},"package":""}\' > $REG_DIR/.cargo-checksum.json',
|
| |
+ "fi",
|
| |
+ f"if {cargo_is_bin} && [ 1 -eq 1 ] ; then",
|
| |
f" {cargo} install {cargo_common_opts} --profile rpm --no-track --path .",
|
| |
- f"fi",
|
| |
- f")",
|
| |
+ "fi",
|
| |
+ ")",
|
| |
]
|
| |
|
| |
|
| |
I'm trying to address https://pagure.io/fedora-rust/rust-packaging/issue/22.
This PR add two new macros to allow modifying the default behaviour of the
%cargo_install
macro:%cargo_install_lib 1
%cargo_install_bin 1
Setting the first macro to
0
prevents installation of crate sources to%{crate_instdir}
even if the crate provides a[lib]
interface. Setting the second macro to0
prevents installation of executables even of the crate defines any[[bin]]
targets explicitly or implicitly.This should address two use cases that are currently not correctly supported:
Support for setting both macros will be added to rust2rpm separately once this lands in cargo-rpm-macros.