Allow setting the "all-features" setting in rust2rpm.conf
This new setting works the same way as the `--all-features` CLI flag when set to `true`. This makes it possible to set it to `true` permanently, without having to remember to use the CLI flag when running rust2rpm.
This commit is contained in:
parent
63acdf63c4
commit
4b93531d5f
2 changed files with 11 additions and 1 deletions
|
@ -15,6 +15,9 @@ default settings (`[DEFAULT]`) and target-specific settings (i.e. `[fedora]`).
|
|||
|
||||
These configuration options are available right now:
|
||||
|
||||
- `all-features`: enable all cargo features when generating `BuildRequires`,
|
||||
building the crate, and running cargo tests (defaults to `false`; setting this
|
||||
value to `true` is equivalent to supplying the `--all-features` CLI flag)
|
||||
- `unwanted-features`: features or optional dependencies for which no
|
||||
`+feature` subpackage should be generated (for example, dependencies on Rust
|
||||
compiler internals for crates that are also bundled with Rust itself)
|
||||
|
|
|
@ -412,7 +412,7 @@ def main():
|
|||
kwargs["generator_version"] = __version__
|
||||
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
|
||||
|
@ -519,6 +519,13 @@ def main():
|
|||
|
||||
kwargs["distconf"] = conf[args.target]
|
||||
|
||||
conf_all_features = conf[args.target].getboolean("all-features")
|
||||
kwargs["all_features"] = conf_all_features or args.all_features
|
||||
|
||||
if conf_all_features is False and args.all_features:
|
||||
print("WARNING: Conflicting settings for enabling all features: The setting is \"false\"")
|
||||
print(" in rust2rpm.conf but it was enabled with the \"--all-features\" CLI flag.")
|
||||
|
||||
spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs)
|
||||
if args.stdout:
|
||||
print(f"# {spec_file}")
|
||||
|
|
Loading…
Reference in a new issue