conf: add a setting for overriding the name of the "bin" subpackage
This commit is contained in:
parent
712f596844
commit
4c36ef4380
5 changed files with 46 additions and 23 deletions
|
@ -41,6 +41,11 @@ This table contains settings that affect RPM metadata.
|
|||
is present, the "cargo build" and "cargo test" steps in the generated spec
|
||||
file are wrapped with "%ifarch" conditionals.
|
||||
|
||||
*bin-package-name*::
|
||||
This setting can be used to override the name of the subpackage that is
|
||||
generated if there are any "bin" (or "cdylib") targets. The default is to
|
||||
fall back to the name of the current crate ("%{crate}").
|
||||
|
||||
=== [tests] table
|
||||
|
||||
This table contains settings that control which tests are run. If any settings
|
||||
|
|
|
@ -33,6 +33,10 @@ TOML_SCHEMA = {
|
|||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
# override binary subpackage name
|
||||
"bin-package-name": {
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
},
|
||||
|
@ -351,6 +355,13 @@ class TomlConf:
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def package_bin_package_name(self) -> Optional[str]:
|
||||
if package := self._package:
|
||||
return package.get("bin-package-name")
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def _tests(self) -> Optional[dict[str, Any]]:
|
||||
return self._data.get("tests")
|
||||
|
|
|
@ -184,6 +184,11 @@ def spec_render_crate(
|
|||
is_lib = metadata.is_lib()
|
||||
is_cdylib = metadata.is_cdylib()
|
||||
|
||||
if tomlconf.package_bin_package_name is None:
|
||||
bin_name = "%{crate}"
|
||||
else:
|
||||
bin_name = tomlconf.package_bin_package_name
|
||||
|
||||
package = metadata.packages[0]
|
||||
description = package.get_description()
|
||||
summary = package.get_summary()
|
||||
|
@ -303,6 +308,7 @@ def spec_render_crate(
|
|||
"rpm_vendor_source": vendor_tarball,
|
||||
# Parameters that control generation of subpackages
|
||||
"rpm_binary_package": is_bin,
|
||||
"rpm_binary_package_name": bin_name,
|
||||
"rpm_cdylib_package": is_cdylib,
|
||||
"rpm_library_package": is_lib,
|
||||
"rpm_binary_names": binaries,
|
||||
|
|
|
@ -33,13 +33,14 @@
|
|||
|
||||
### Parameters that control generation of subpackages
|
||||
|
||||
| parameter name | type | value |
|
||||
| --------------------- | --------------------- | --------------------------------------------------------------------------- |
|
||||
| `rpm_binary_package` | `bool` | `True` if package ships any binaries, `False` for source-only packages |
|
||||
| `rpm_cdylib_package` | `bool` | `True` if package ships any shared libraries (`cdylib` targets) |
|
||||
| `rpm_library_package` | `bool` | `True` if package has a library component, `False` for binary-only packages |
|
||||
| `rpm_binary_names` | `list[str]` | list of the names of executables which are built from the crate |
|
||||
| `crate_features` | `list[Optional[str]]` | list of names of features for which sub-packages are generated |
|
||||
| parameter name | type | value |
|
||||
| ------------------------- | --------------------- | --------------------------------------------------------------------------- |
|
||||
| `rpm_binary_package` | `bool` | `True` if package ships any binaries, `False` for source-only packages |
|
||||
| `rpm_binary_package_name` | `str` | override name of the binary subpackage (default: `%{crate}`) |
|
||||
| `rpm_cdylib_package` | `bool` | `True` if package ships any shared libraries (`cdylib` targets) |
|
||||
| `rpm_library_package` | `bool` | `True` if package has a library component, `False` for binary-only packages |
|
||||
| `rpm_binary_names` | `list[str]` | list of the names of executables which are built from the crate |
|
||||
| `crate_features` | `list[Optional[str]]` | list of names of features for which sub-packages are generated |
|
||||
|
||||
### Parameters for crate metadata
|
||||
|
||||
|
@ -50,14 +51,14 @@
|
|||
| `crate_license` | `Optional[str]` | crate license (from `Cargo.toml` metadata) |
|
||||
| `upstream_version` | `str` | upstream crate version (from `crates.io`) |
|
||||
|
||||
### Parameters derived from rust2rpm configuration
|
||||
### Other parameters derived from rust2rpm configuration
|
||||
|
||||
| parameter name | type | value |
|
||||
| ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
|
||||
| `conf_lib_requires` | `dict[str, list[str]]` | map of feature names to lists of additional RPM `Requires` for library packages specified in `rust2rpm.conf` |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.toml` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.toml` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.toml` |
|
||||
| `conf_lib_requires` | `dict[str, list[str]]` | map of feature names to lists of additional RPM `Requires` for library packages specified in `rust2rpm.toml` |
|
||||
| `conf_supported_arches` | `list[str]` | list of supported architectures (results in `%ifarch` conditionals around `%cargo_build` and `%cargo_test` macros) |
|
||||
| `cargo_test_args` | `list[str]` | list of arguments that are passed to `%cargo_test` |
|
||||
|
||||
|
@ -129,13 +130,13 @@
|
|||
| `crate_license` | `Optional[str]` | crate license (from `Cargo.toml` metadata) |
|
||||
| `upstream_version` | `str` | upstream crate version (from `crates.io`) |
|
||||
|
||||
### Parameters derived from rust2rpm configuration
|
||||
### Other parameters derived from rust2rpm configuration
|
||||
|
||||
| parameter name | type | value |
|
||||
| ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.toml` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.toml` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.toml` |
|
||||
| `conf_supported_arches` | `list[str]` | list of supported architectures (results in `%ifarch` conditionals around `%cargo_build` and `%cargo_test` macros) |
|
||||
| `cargo_test_args` | `list[str]` | list of arguments that are passed to `%cargo_test` |
|
||||
|
||||
|
@ -186,13 +187,13 @@
|
|||
| `rpm_bcond_check` | `bool` | flag to switch default value of the `check` bcond |
|
||||
| `rpm_test_comments` | `list[str]` | comments that document why (specific) tests are disabled |
|
||||
|
||||
### Parameters derived from rust2rpm configuration
|
||||
### Other parameters derived from rust2rpm configuration
|
||||
|
||||
| parameter name | type | value |
|
||||
| -------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.toml` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.toml` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.toml` |
|
||||
| `cargo_test_args` | `list[str]` | list of arguments that are passed to `%cargo_test` |
|
||||
|
||||
### Parameters derived from command-line flags
|
||||
|
|
|
@ -114,7 +114,7 @@ BuildRequires: {{ req }}
|
|||
%description %{_description}
|
||||
|
||||
{% if rpm_binary_package or rpm_cdylib_package %}
|
||||
%package -n %{crate}
|
||||
%package -n {{ rpm_binary_package_name }}
|
||||
Summary: %{summary}
|
||||
{% if rpm_group is defined %}
|
||||
Group: # FIXME
|
||||
|
@ -126,9 +126,9 @@ License: # FIXME
|
|||
Requires: {{ req }}
|
||||
{% endfor %}
|
||||
|
||||
%description -n %{crate} %{_description}
|
||||
%description -n {{ rpm_binary_package_name }} %{_description}
|
||||
|
||||
%files -n %{crate}
|
||||
%files -n {{ rpm_binary_package_name }}
|
||||
{% if rpm_license_files|length > 0 %}
|
||||
{% for file in rpm_license_files %}
|
||||
%license {{ file }}
|
||||
|
|
Loading…
Reference in a new issue