conf: allow setting debuginfo level for rustc
This commit is contained in:
parent
4f07259c3e
commit
0efb1761bb
7 changed files with 66 additions and 3 deletions
|
@ -58,8 +58,18 @@ This table contains settings that affect RPM metadata.
|
|||
to be installed to %{crate_instdir} even if a library target is auto-detected
|
||||
or the crate defines a [lib] target explicitly. The default value is "true".
|
||||
|
||||
*debuginfo-level*::
|
||||
This setting allows setting the level of debuginfo that is generated by rustc.
|
||||
Valid choices are the numbers 0, 1, and 2, corresponding to the debuginfo
|
||||
levels that are supported by rustc. The default is 2. Setting a lower level
|
||||
can be a workaround for builds running out of available memory.
|
||||
|
||||
*cargo-toml-patch-comments*::
|
||||
This setting allows persisting comments that are associated with manually created patches for Cargo.toml (i.e. by running "rust2rpm -p"). The setting accepts a list of strings. Elements of the array are treated as individual comments, and individual comments are formatted and line-wrapped to 80 characters.
|
||||
This setting allows persisting comments that are associated with manually
|
||||
created patches for Cargo.toml (i.e. by running "rust2rpm -p"). The setting
|
||||
accepts a list of strings. Elements of the array are treated as individual
|
||||
comments, and individual comments are formatted and line-wrapped to 80
|
||||
characters.
|
||||
|
||||
*extra-sources*::
|
||||
This setting can be used to specify additional Sources to be included in the
|
||||
|
@ -67,10 +77,12 @@ This table contains settings that affect RPM metadata.
|
|||
with three properties - "number", "file", and "comments". The integer "number"
|
||||
is used to set a predictable number of the Source file in the spec, the "file"
|
||||
is expected to be a string that contains an URL or a plain file name, and
|
||||
"comments" is an array of strings that are formatted in the same way as the "cargo-toml-patch-comments" setting.
|
||||
"comments" is an array of strings that are formatted in the same way as the
|
||||
"cargo-toml-patch-comments" setting.
|
||||
|
||||
*extra-patches*::
|
||||
This setting is similar to "extra-sources" but allows specifying additional Patch files instead of Source files.
|
||||
This setting is similar to "extra-sources" but allows specifying additional
|
||||
Patch files instead of Source files.
|
||||
|
||||
*extra-files*::
|
||||
This setting allows injecting additional files into the "%files" section of
|
||||
|
|
|
@ -46,6 +46,11 @@ TOML_SCHEMA = {
|
|||
"cargo-install-lib": {
|
||||
"type": "boolean",
|
||||
},
|
||||
# override default debuginfo level (2)
|
||||
"debuginfo-level": {
|
||||
"type": "integer",
|
||||
"enum": [0, 1, 2],
|
||||
},
|
||||
# comments for manual Cargo.toml patches (rust2rpm -p)
|
||||
"cargo-toml-patch-comments": {
|
||||
"type": "array",
|
||||
|
@ -583,6 +588,13 @@ class TomlConf:
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def package_debuginfo_level(self) -> Optional[int]:
|
||||
if package := self._package:
|
||||
return package.get("debuginfo-level")
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def package_cargo_toml_patch_comments(self) -> Optional[list[str]]:
|
||||
if package := self._package:
|
||||
|
|
|
@ -363,6 +363,8 @@ def spec_render_crate(
|
|||
"rust2rpm_target": target,
|
||||
"rust2rpm_legacy": legacy,
|
||||
"rust_packaging_dep": rust_packaging_dep,
|
||||
# Paramters that control compiler flags
|
||||
"build_rustflags_debuginfo": tomlconf.package_debuginfo_level,
|
||||
# Parameters for RPM package metadata
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": Version.parse(package.version).to_rpm(),
|
||||
|
@ -543,6 +545,8 @@ def spec_render_project(
|
|||
"rust2rpm_target": target,
|
||||
"rust2rpm_legacy": legacy,
|
||||
"rust_packaging_dep": rust_packaging_dep,
|
||||
# Paramters that control compiler flags
|
||||
"build_rustflags_debuginfo": tomlconf.package_debuginfo_level,
|
||||
# Parameters for RPM package metadata
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": Version.parse(package.version).to_rpm(),
|
||||
|
@ -727,6 +731,8 @@ def spec_render_workspace(
|
|||
"rust2rpm_target": target,
|
||||
"rust2rpm_legacy": legacy,
|
||||
"rust_packaging_dep": rust_packaging_dep,
|
||||
# Paramters that control compiler flags
|
||||
"build_rustflags_debuginfo": tomlconf.package_debuginfo_level,
|
||||
# Parameters for RPM package metadata
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": rpm_version,
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
| `rust2rpm_target` | `str` | target OS (fedora, mageia, opensuse, plain) |
|
||||
| `rust_packaging_dep` | `str` | dependency string for RPM Rust packaging tools |
|
||||
|
||||
### Paramters that control compiler flags
|
||||
|
||||
| parameter name | type | value |
|
||||
| --------------------------- | --------------- | -------------------------------------------------- |
|
||||
| `build_rustflags_debuginfo` | `Optional[int]` | controls the level of debuginfo generated by rustc |
|
||||
|
||||
### Parameters for RPM package metadata
|
||||
|
||||
| parameter name | type | value |
|
||||
|
@ -114,6 +120,12 @@
|
|||
| `rust2rpm_target` | `str` | target OS (fedora, mageia, opensuse, plain) |
|
||||
| `rust_packaging_dep` | `str` | dependency string for RPM Rust packaging tools |
|
||||
|
||||
### Paramters that control compiler flags
|
||||
|
||||
| parameter name | type | value |
|
||||
| --------------------------- | --------------- | -------------------------------------------------- |
|
||||
| `build_rustflags_debuginfo` | `Optional[int]` | controls the level of debuginfo generated by rustc |
|
||||
|
||||
### Parameters for RPM package metadata
|
||||
|
||||
| parameter name | type | value |
|
||||
|
@ -207,6 +219,12 @@
|
|||
| `rust2rpm_target` | `str` | target OS (fedora, mageia, opensuse, plain) |
|
||||
| `rust_packaging_dep` | `str` | dependency string for RPM Rust packaging tools |
|
||||
|
||||
### Paramters that control compiler flags
|
||||
|
||||
| parameter name | type | value |
|
||||
| --------------------------- | --------------- | -------------------------------------------------- |
|
||||
| `build_rustflags_debuginfo` | `Optional[int]` | controls the level of debuginfo generated by rustc |
|
||||
|
||||
### Parameters for RPM package metadata
|
||||
|
||||
| parameter name | type | value |
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
{% if not (rpm_binary_package or rpm_cdylib_package) or not cargo_install_bin %}
|
||||
%global debug_package %{nil}
|
||||
{% endif %}
|
||||
{% if build_rustflags_debuginfo %}
|
||||
|
||||
# build with reduced debuginfo to work around memory limits
|
||||
%global rustflags_debuginfo {{ build_rustflags_debuginfo }}
|
||||
{% endif %}
|
||||
|
||||
{% if not cargo_install_lib %}
|
||||
# prevent library files from being installed
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
{% endif %}
|
||||
%bcond_with check
|
||||
{% endif %}
|
||||
{% if build_rustflags_debuginfo %}
|
||||
|
||||
# build with reduced debuginfo to work around memory limits
|
||||
%global rustflags_debuginfo {{ build_rustflags_debuginfo }}
|
||||
{% endif %}
|
||||
|
||||
# prevent library files from being installed
|
||||
%global cargo_install_lib 0
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
{% endif %}
|
||||
%bcond_with check
|
||||
{% endif %}
|
||||
{% if build_rustflags_debuginfo %}
|
||||
|
||||
# build with reduced debuginfo to work around memory limits
|
||||
%global rustflags_debuginfo {{ build_rustflags_debuginfo }}
|
||||
{% endif %}
|
||||
{% if rpm_version != upstream_version %}
|
||||
|
||||
%global upstream_version {{ upstream_version }}
|
||||
|
|
Loading…
Reference in a new issue