conf/generator: support overriding generated RPM summary
This commit is contained in:
parent
267d9fbef9
commit
9de25b0a25
3 changed files with 15 additions and 3 deletions
|
@ -15,6 +15,11 @@ default settings (`[DEFAULT]`) and target-specific settings (i.e. `[fedora]`).
|
|||
|
||||
These configuration options are available right now:
|
||||
|
||||
- `summary`: override the generated summary for the RPM package for cases where
|
||||
generating a summary from the crate's description fails
|
||||
- `supported-arches`: conditionally build and run tests only on specific
|
||||
architectures (mostly useful for libraries with limited cross-platform
|
||||
support - applications need to use `ExcludeArch` or `ExclusiveArch` instead)
|
||||
- `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)
|
||||
|
|
|
@ -22,6 +22,7 @@ class Rust2RpmConf:
|
|||
def __init__(
|
||||
self,
|
||||
*,
|
||||
summary: Optional[str] = None,
|
||||
supported_arches: list[str] = None,
|
||||
all_features: bool = False,
|
||||
unwanted_features: list[str] = None,
|
||||
|
@ -31,6 +32,7 @@ class Rust2RpmConf:
|
|||
bin_requires: list[str] = None,
|
||||
lib_requires: dict[Optional[str], list[str]] = None,
|
||||
):
|
||||
self.summary = summary
|
||||
self.supported_arches: list[str] = supported_arches or list()
|
||||
self.all_features: bool = all_features
|
||||
self.unwanted_features: list[str] = unwanted_features or list()
|
||||
|
@ -47,7 +49,8 @@ class Rust2RpmConf:
|
|||
# order of items in the list is consistent:
|
||||
# lists are sorted when parsing rust2rpm.conf files
|
||||
return (
|
||||
self.supported_arches == other.supported_arches
|
||||
self.summary == other.summary
|
||||
and self.supported_arches == other.supported_arches
|
||||
and self.all_features == other.all_features
|
||||
and self.unwanted_features == other.unwanted_features
|
||||
and self.enabled_features == other.enabled_features
|
||||
|
@ -82,6 +85,7 @@ class Rust2RpmConf:
|
|||
# validate configuration file
|
||||
valid_targets = ["fedora", "mageia", "opensuse", "plain"]
|
||||
valid_keys = [
|
||||
"summary",
|
||||
"supported-arches",
|
||||
"all-features",
|
||||
"unwanted-features",
|
||||
|
@ -107,6 +111,9 @@ class Rust2RpmConf:
|
|||
# parse configuration and validate settings
|
||||
settings = dict()
|
||||
|
||||
if summary := merged.get("summary"):
|
||||
settings["summary"] = summary
|
||||
|
||||
if supported_arches := merged.get("supported-arches"):
|
||||
settings["supported_arches"] = to_list(supported_arches, False)
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ def spec_render_crate(
|
|||
# Parameters for RPM package metadata
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": Version.parse(package.version).to_rpm(),
|
||||
"rpm_summary": summary,
|
||||
"rpm_summary": distconf.summary or summary,
|
||||
"rpm_description": description,
|
||||
"rpm_license": rpm_license,
|
||||
"rpm_license_comments": rpm_license_comments,
|
||||
|
@ -318,7 +318,7 @@ def spec_render_workspace(
|
|||
# Parameters for RPM package metadata
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": rpm_version,
|
||||
"rpm_summary": rpm_summary,
|
||||
"rpm_summary": distconf.summary or rpm_summary,
|
||||
"rpm_description": rpm_description,
|
||||
"rpm_license": rpm_license_tag,
|
||||
"rpm_license_comments": rpm_license_comments,
|
||||
|
|
Loading…
Reference in a new issue