cli: remove deprecated --all-features flag
This commit is contained in:
parent
c59cbefbaa
commit
8e2bd0a029
5 changed files with 23 additions and 64 deletions
|
@ -148,11 +148,6 @@ need to be explicitly specified.
|
|||
|
||||
=== Deprecated options
|
||||
|
||||
*--all-features*::
|
||||
Generate a spec file where the _-a_ / _--all-features_ flag will be passed to
|
||||
all calls of cargo. It is recommended to set this permanently in a
|
||||
package-specific _rust2rpm.toml(5)_ configuration file instead.
|
||||
|
||||
*--show-license-map*::
|
||||
Print the mapping between SPDX license identifiers and Fedora / Callaway
|
||||
identifiers that's used internally for "translating" crate licenses from
|
||||
|
|
|
@ -2,7 +2,6 @@ import os
|
|||
import pathlib
|
||||
import sys
|
||||
|
||||
from cargo2rpm.metadata import FeatureFlags
|
||||
from cargo2rpm.semver import Version
|
||||
|
||||
from rust2rpm import log
|
||||
|
@ -139,7 +138,6 @@ def main():
|
|||
doc_files=doc_files,
|
||||
vendor_tarball=vendor_tarball,
|
||||
tomlconf=tomlconf,
|
||||
feature_flags=FeatureFlags(all_features=args.all_features),
|
||||
rpmautospec=args.rpmautospec,
|
||||
auto_changelog_entry=args.auto_changelog_entry,
|
||||
packager=packager,
|
||||
|
@ -167,7 +165,6 @@ def main():
|
|||
doc_files=doc_files,
|
||||
vendor_tarball=vendor_tarball,
|
||||
tomlconf=tomlconf,
|
||||
feature_flags=FeatureFlags(all_features=args.all_features),
|
||||
rpmautospec=args.rpmautospec,
|
||||
auto_changelog_entry=args.auto_changelog_entry,
|
||||
packager=packager,
|
||||
|
@ -201,7 +198,6 @@ def main():
|
|||
doc_files=doc_files,
|
||||
vendor_tarball=vendor_tarball,
|
||||
tomlconf=tomlconf,
|
||||
feature_flags=FeatureFlags(all_features=args.all_features),
|
||||
relative_license_paths=args.relative_license_paths,
|
||||
rpmautospec=args.rpmautospec,
|
||||
auto_changelog_entry=args.auto_changelog_entry,
|
||||
|
|
|
@ -84,11 +84,6 @@ def get_parser() -> argparse.ArgumentParser:
|
|||
action="store_true",
|
||||
help="Put all license files in main license directory",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--all-features",
|
||||
action="store_true",
|
||||
help="Activate all available features",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--compat",
|
||||
action="store_true",
|
||||
|
|
|
@ -186,7 +186,6 @@ def spec_render_crate(
|
|||
doc_files: list[str],
|
||||
vendor_tarball: Optional[str],
|
||||
tomlconf: TomlConf,
|
||||
feature_flags: FeatureFlags,
|
||||
relative_license_paths: bool,
|
||||
rpmautospec: bool,
|
||||
auto_changelog_entry: bool,
|
||||
|
@ -239,21 +238,15 @@ def spec_render_crate(
|
|||
|
||||
generator_version = __version__.split(".")[0]
|
||||
|
||||
merged_feature_flags = FeatureFlags(
|
||||
all_features=feature_flags.all_features or tomlconf.features_enable_all is True,
|
||||
no_default_features=feature_flags.no_default_features and not tomlconf.features_enable_all,
|
||||
features=list(
|
||||
sorted(
|
||||
set.union(
|
||||
set(feature_flags.features), set(tomlconf.features_enable) if tomlconf.features_enable else set()
|
||||
)
|
||||
)
|
||||
),
|
||||
feature_flags = FeatureFlags(
|
||||
all_features=tomlconf.features_enable_all is True,
|
||||
no_default_features=False,
|
||||
features=list(sorted(set(tomlconf.features_enable) if tomlconf.features_enable else set())),
|
||||
)
|
||||
|
||||
try:
|
||||
buildrequires_with_dev = rpm.buildrequires(package, merged_feature_flags, True)
|
||||
buildrequires_without_dev = rpm.buildrequires(package, merged_feature_flags, False)
|
||||
buildrequires_with_dev = rpm.buildrequires(package, feature_flags, True)
|
||||
buildrequires_without_dev = rpm.buildrequires(package, feature_flags, False)
|
||||
|
||||
buildrequires = buildrequires_without_dev
|
||||
test_requires = set.difference(buildrequires_with_dev, buildrequires_without_dev)
|
||||
|
@ -287,7 +280,7 @@ def spec_render_crate(
|
|||
min_rust_packaging_dep(package, target, is_bin, is_cdylib, vendor_tarball, cargo_install_lib, cargo_install_bin)
|
||||
]
|
||||
|
||||
if feature_flags.all_features or tomlconf.features_enable_all:
|
||||
if feature_flags.all_features:
|
||||
cargo_args = " -a"
|
||||
elif required_features := get_required_features_for_binaries(package):
|
||||
# remove required features that are already part of the enabled feature set
|
||||
|
@ -430,7 +423,6 @@ def spec_render_project(
|
|||
doc_files: list[str],
|
||||
vendor_tarball: Optional[str],
|
||||
tomlconf: TomlConf,
|
||||
feature_flags: FeatureFlags,
|
||||
rpmautospec: bool,
|
||||
auto_changelog_entry: bool,
|
||||
date: Optional[time.struct_time] = None,
|
||||
|
@ -459,21 +451,15 @@ def spec_render_project(
|
|||
|
||||
generator_version = __version__.split(".")[0]
|
||||
|
||||
merged_feature_flags = FeatureFlags(
|
||||
all_features=feature_flags.all_features or tomlconf.features_enable_all is True,
|
||||
no_default_features=feature_flags.no_default_features and not tomlconf.features_enable_all,
|
||||
features=list(
|
||||
sorted(
|
||||
set.union(
|
||||
set(feature_flags.features), set(tomlconf.features_enable) if tomlconf.features_enable else set()
|
||||
)
|
||||
)
|
||||
),
|
||||
feature_flags = FeatureFlags(
|
||||
all_features=tomlconf.features_enable_all is True,
|
||||
no_default_features=False,
|
||||
features=list(sorted(set(tomlconf.features_enable) if tomlconf.features_enable else set())),
|
||||
)
|
||||
|
||||
buildrequires = rpm.buildrequires(package, merged_feature_flags, False)
|
||||
buildrequires = rpm.buildrequires(package, feature_flags, False)
|
||||
test_requires = set.difference(
|
||||
rpm.buildrequires(package, merged_feature_flags, True), rpm.buildrequires(package, merged_feature_flags, False)
|
||||
rpm.buildrequires(package, feature_flags, True), rpm.buildrequires(package, feature_flags, False)
|
||||
)
|
||||
|
||||
rpm_buildrequires = list(sorted(buildrequires))
|
||||
|
@ -483,7 +469,7 @@ def spec_render_project(
|
|||
min_rust_packaging_dep(package, target, is_bin, is_cdylib, vendor_tarball, False, True)
|
||||
]
|
||||
|
||||
if feature_flags.all_features or tomlconf.features_enable_all:
|
||||
if feature_flags.all_features:
|
||||
cargo_args = " -a"
|
||||
elif required_features := get_required_features_for_binaries(package):
|
||||
# remove required features that are already part of the enabled feature set
|
||||
|
@ -617,7 +603,6 @@ def spec_render_workspace(
|
|||
doc_files: list[str],
|
||||
vendor_tarball: Optional[str],
|
||||
tomlconf: TomlConf,
|
||||
feature_flags: FeatureFlags,
|
||||
rpmautospec: bool,
|
||||
auto_changelog_entry: bool,
|
||||
date: Optional[time.struct_time] = None,
|
||||
|
@ -650,22 +635,16 @@ def spec_render_workspace(
|
|||
|
||||
generator_version = __version__.split(".")[0]
|
||||
|
||||
merged_feature_flags = FeatureFlags(
|
||||
all_features=feature_flags.all_features or tomlconf.features_enable_all is True,
|
||||
no_default_features=feature_flags.no_default_features and not tomlconf.features_enable_all,
|
||||
features=list(
|
||||
sorted(
|
||||
set.union(
|
||||
set(feature_flags.features), set(tomlconf.features_enable) if tomlconf.features_enable else set()
|
||||
)
|
||||
)
|
||||
),
|
||||
feature_flags = FeatureFlags(
|
||||
all_features=tomlconf.features_enable_all is True,
|
||||
no_default_features=False,
|
||||
features=list(sorted(set(tomlconf.features_enable) if tomlconf.features_enable else set())),
|
||||
)
|
||||
|
||||
buildrequires = rpm.workspace_buildrequires(metadata, merged_feature_flags, False)
|
||||
buildrequires = rpm.workspace_buildrequires(metadata, feature_flags, False)
|
||||
test_requires = set.difference(
|
||||
rpm.workspace_buildrequires(metadata, merged_feature_flags, True),
|
||||
rpm.workspace_buildrequires(metadata, merged_feature_flags, False),
|
||||
rpm.workspace_buildrequires(metadata, feature_flags, True),
|
||||
rpm.workspace_buildrequires(metadata, feature_flags, False),
|
||||
)
|
||||
|
||||
rpm_buildrequires = list(sorted(buildrequires))
|
||||
|
@ -685,7 +664,7 @@ def spec_render_workspace(
|
|||
)
|
||||
]
|
||||
|
||||
if feature_flags.all_features or tomlconf.features_enable_all:
|
||||
if feature_flags.all_features:
|
||||
cargo_args = " -a"
|
||||
elif features_enable := tomlconf.features_enable:
|
||||
# list of features is already sorted when parsing the configuration file
|
||||
|
|
|
@ -5,10 +5,9 @@ import re
|
|||
import time
|
||||
from typing import Optional, cast
|
||||
|
||||
from cargo2rpm.metadata import Metadata, FeatureFlags
|
||||
from cargo2rpm.metadata import Metadata
|
||||
import pytest
|
||||
|
||||
from rust2rpm.cli import get_parser
|
||||
from rust2rpm.conf import TomlConf
|
||||
from rust2rpm.generator import spec_render_crate, spec_render_project, spec_render_workspace
|
||||
from rust2rpm.metadata import guess_main_package
|
||||
|
@ -43,9 +42,7 @@ def test_spec_file_render_crate(filename: str, conf: Optional[str], target: str)
|
|||
crate = crate_name_version.rsplit("-", 1)[0]
|
||||
version = crate_name_version.rsplit("-", 1)[1]
|
||||
|
||||
args = get_parser().parse_args(["foobar", f"--target={target}", "-a" if target == "fedora" else "--no-rpmautospec"])
|
||||
rpm_name = package_name_suffixed(crate, None)
|
||||
|
||||
real_path = resources.files("rust2rpm.tests.samples").joinpath(filename)
|
||||
metadata = Metadata.from_json(real_path.read_text())
|
||||
|
||||
|
@ -67,7 +64,6 @@ def test_spec_file_render_crate(filename: str, conf: Optional[str], target: str)
|
|||
doc_files=["DOC1", "DOC2"],
|
||||
vendor_tarball=None,
|
||||
tomlconf=tomlconf,
|
||||
feature_flags=FeatureFlags(),
|
||||
relative_license_paths=False,
|
||||
rpmautospec=target == "fedora",
|
||||
auto_changelog_entry=True,
|
||||
|
@ -121,7 +117,6 @@ def test_spec_file_render_project(filename: str, vendor_tarball: Optional[str],
|
|||
doc_files=["DOC1", "DOC2"],
|
||||
vendor_tarball=vendor_tarball,
|
||||
tomlconf=TomlConf(),
|
||||
feature_flags=FeatureFlags(),
|
||||
rpmautospec=target == "fedora",
|
||||
auto_changelog_entry=True,
|
||||
date=FIXED_DATE,
|
||||
|
@ -172,7 +167,6 @@ def test_spec_file_render_workspace(filename: str, vendor_tarball: Optional[str]
|
|||
doc_files=["DOC1", "DOC2"],
|
||||
vendor_tarball=vendor_tarball,
|
||||
tomlconf=TomlConf(),
|
||||
feature_flags=FeatureFlags(),
|
||||
rpmautospec=target == "fedora",
|
||||
auto_changelog_entry=True,
|
||||
date=FIXED_DATE,
|
||||
|
|
Loading…
Reference in a new issue