templates: add FIXME to %install if any shared libraries are built

This commit is contained in:
Fabio Valentini 2023-02-16 21:48:13 +01:00
parent 9696550bb7
commit 4eb2d2bf5d
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
4 changed files with 21 additions and 9 deletions

View file

@ -209,9 +209,10 @@ def spec_render_crate(
"rpm_license_files": license_files, "rpm_license_files": license_files,
"rpm_doc_files": doc_files, "rpm_doc_files": doc_files,
# Parameters that control generation of subpackages # Parameters that control generation of subpackages
"rpm_binary_package": is_bin or is_cdylib, "rpm_binary_package": is_bin,
"rpm_binary_names": binaries if is_bin else [], "rpm_cdylib_package": is_cdylib,
"rpm_library_package": is_lib, "rpm_library_package": is_lib,
"rpm_binary_names": binaries,
"crate_features": features, "crate_features": features,
# Parameters for crate metadata # Parameters for crate metadata
"crate_name": package.name, "crate_name": package.name,
@ -272,6 +273,8 @@ def spec_render_workspace(
binaries = [*metadata.get_binaries()] binaries = [*metadata.get_binaries()]
binaries.sort() binaries.sort()
is_cdylib = metadata.is_cdylib()
main_package = guess_main_package(metadata) main_package = guess_main_package(metadata)
rpm_version = Version.parse(main_package.version).to_rpm() rpm_version = Version.parse(main_package.version).to_rpm()
rpm_description = main_package.get_description() rpm_description = main_package.get_description()
@ -341,6 +344,7 @@ def spec_render_workspace(
"rpm_license_files": license_files, "rpm_license_files": license_files,
"rpm_doc_files": doc_files, "rpm_doc_files": doc_files,
"rpm_binary_names": binaries, "rpm_binary_names": binaries,
"rpm_cdylib_package": is_cdylib,
# Parameters derived from rust2rpm.conf # Parameters derived from rust2rpm.conf
"conf_buildrequires": conf_buildrequires, "conf_buildrequires": conf_buildrequires,
"conf_test_requires": conf_test_requires, "conf_test_requires": conf_test_requires,

View file

@ -34,8 +34,9 @@
| parameter name | type | value | | parameter name | type | value |
| --------------------- | --------------------- | --------------------------------------------------------------------------- | | --------------------- | --------------------- | --------------------------------------------------------------------------- |
| `rpm_binary_package` | `bool` | `True` if package ships any binaries, `False` for source-only packages | | `rpm_binary_package` | `bool` | `True` if package ships any binaries, `False` for source-only packages |
| `rpm_binary_names` | `list[str]` | list of the names of executables which are built from the 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_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 | | `crate_features` | `list[Optional[str]]` | list of names of features for which sub-packages are generated |
### Parameters for crate metadata ### Parameters for crate metadata
@ -101,6 +102,7 @@
| `rpm_license_files` | `list[str]` | list of the license files which were detected in crate sources | | `rpm_license_files` | `list[str]` | list of the license files which were detected in crate sources |
| `rpm_doc_files` | `list[str]` | list of the documentation files which were detected in crate sources | | `rpm_doc_files` | `list[str]` | list of the documentation files which were detected in crate sources |
| `rpm_binary_names` | `list[str]` | list of the names of executables which are built from the project | | `rpm_binary_names` | `list[str]` | list of the names of executables which are built from the project |
| `rpm_cdylib_package` | `bool` | `True` if package ships any shared libraries (`cdylib` targets) |
### Parameters derived from rust2rpm.conf ### Parameters derived from rust2rpm.conf

View file

@ -1,7 +1,7 @@
{% include rust2rpm_target ~ "-header.spec.inc" ignore missing %} {% include rust2rpm_target ~ "-header.spec.inc" ignore missing %}
# Generated by rust2rpm {{ rust2rpm_version }} # Generated by rust2rpm {{ rust2rpm_version }}
%bcond_without check %bcond_without check
{% if not rpm_binary_package %} {% if not (rpm_binary_package or rpm_cdylib_package) %}
%global debug_package %{nil} %global debug_package %{nil}
{% endif %} {% endif %}
@ -82,7 +82,7 @@ BuildRequires: {{ req }}
%description %{_description} %description %{_description}
{% if rpm_binary_package %} {% if rpm_binary_package or rpm_cdylib_package %}
%package -n %{crate} %package -n %{crate}
Summary: %{summary} Summary: %{summary}
{% if rpm_group is defined %} {% if rpm_group is defined %}
@ -191,10 +191,13 @@ echo {{ "%r" | format(req) }}
%cargo_build{{ cargo_args }} %cargo_build{{ cargo_args }}
%install %install
{% if not (not rpm_library_package and rpm_binary_package and binaries|length == 0) %} {% if rpm_cdylib_package and (rpm_library_package or rpm_binary_package) %}
%cargo_install{{ cargo_args }} %cargo_install{{ cargo_args }}
# FIXME: install shared library
{% elif rpm_cdylib_package %}
# FIXME: install shared library
{% else %} {% else %}
# FIXME %cargo_install{{ cargo_args }}
{% endif %} {% endif %}
%if %{with check} %if %{with check}

View file

@ -86,10 +86,13 @@ echo {{ "%r" | format(req) }}
%cargo_build{{ cargo_args }} %cargo_build{{ cargo_args }}
%install %install
{% if binaries|length == 0 %} {% if rpm_cdylib_package and rpm_binary_names|length >= 1 %}
%cargo_install{{ cargo_args }} %cargo_install{{ cargo_args }}
# FIXME: install shared library
{% elif rpm_cdylib_package %}
# FIXME: install shared library
{% else %} {% else %}
# FIXME %cargo_install{{ cargo_args }}
{% endif %} {% endif %}
%if %{with check} %if %{with check}