Add support for --all-features
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
5d7a0b2444
commit
47597fcad7
2 changed files with 11 additions and 3 deletions
|
@ -220,6 +220,8 @@ def main():
|
|||
help="Do initial patching of Cargo.toml")
|
||||
parser.add_argument("-s", "--store-crate", action="store_true",
|
||||
help="Store crate in current directory")
|
||||
parser.add_argument("--all-features", action="store_true",
|
||||
help="Activate all available features")
|
||||
parser.add_argument("crate", help="crates.io name\n"
|
||||
"path/to/local.crate\n"
|
||||
"path/to/project/",
|
||||
|
@ -250,6 +252,7 @@ def main():
|
|||
kwargs = {}
|
||||
kwargs["crate"] = crate
|
||||
kwargs["target"] = args.target
|
||||
kwargs["all_features"] = args.all_features
|
||||
bins = [tgt for tgt in metadata.targets if tgt.kind == "bin"]
|
||||
libs = [tgt for tgt in metadata.targets if tgt.kind in ("lib", "rlib", "proc-macro")]
|
||||
is_bin = len(bins) > 0
|
||||
|
|
|
@ -44,7 +44,12 @@ Patch0: {{ patch_file }}
|
|||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging
|
||||
{% if not all_features %}
|
||||
{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
||||
{% else %}
|
||||
{% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
||||
{% set cargo_args = " -a" %}
|
||||
{% endif %}
|
||||
{% for req in buildrequires %}
|
||||
BuildRequires: {{ req }}
|
||||
{% endfor %}
|
||||
|
@ -158,14 +163,14 @@ which use {% if feature is not none %}"{{ feature }}" feature of {% endif %}"%{c
|
|||
%cargo_prep
|
||||
|
||||
%build
|
||||
%cargo_build
|
||||
%cargo_build{{ cargo_args }}
|
||||
|
||||
%install
|
||||
%cargo_install
|
||||
%cargo_install{{ cargo_args }}
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
%cargo_test
|
||||
%cargo_test{{ cargo_args }}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
|
Loading…
Reference in a new issue