diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index 747328e..55681c0 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -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 diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec index 4e9dbcf..23b8c59 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -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