generator: update template for workspace projects

This commit is contained in:
Fabio Valentini 2023-10-06 17:04:38 +02:00
parent f35b5f4e88
commit 97ae81977d
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
8 changed files with 60 additions and 14 deletions

View file

@ -302,7 +302,6 @@ def spec_render_project(
doc_files: list[str],
tomlconf: TomlConf,
feature_flags: FeatureFlags,
relative_license_paths: bool,
rpmautospec: bool,
auto_changelog_entry: bool,
date: Optional[time.struct_time] = None,
@ -441,6 +440,7 @@ def spec_render_project(
def spec_render_workspace(
*,
metadata: Metadata,
upstream_version: str,
main_package: Package,
target: str,
rpm_name: str,
@ -523,6 +523,7 @@ def spec_render_workspace(
"rpm_doc_files": doc_files,
"rpm_binary_names": binaries,
"rpm_cdylib_package": is_cdylib,
"upstream_version": upstream_version,
# Parameters derived from rust2rpm.conf
"conf_buildrequires": tomlconf.requires_build or list(),
"conf_test_requires": tomlconf.requires_test or list(),

View file

@ -162,10 +162,10 @@ echo {{ "%r" | format(req) }}
{% for file in rpm_license_files %}
%license {{ file }}
{% endfor %}
%license LICENSE.dependencies
{% else %}
# FIXME: no license files detected
{% endif %}
%license LICENSE.dependencies
{% for file in rpm_doc_files %}
%doc {{ file }}
{% endfor %}

View file

@ -2,6 +2,9 @@
# Generated by rust2rpm {{ rust2rpm_version }}
%bcond_without check
{% if rpm_version != upstream_version %}
%global upstream_version {{ upstream_version }}
{% endif %}
Name: {{ rpm_name }}
Version: {{ rpm_version }}
Release: {{ rpm_release }}
@ -14,14 +17,20 @@ Summary: {{ rpm_summary }}
Group: {{ rpm_group }}
{% endif %}
License: {{ rpm_license|default("# FIXME") }}
SourceLicense: {{ rpm_license|default("# FIXME") }}
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
{% if rpm_license_comments is not none %}
{{ rpm_license_comments }}
{% endif %}
URL: # FIXME
Source: # FIXME
{% if rust2rpm_target != "fedora" %}
{% if conf_supported_arches %}
ExclusiveArch: {{ conf_supported_arches }}
{% elif rust2rpm_target != "fedora" %}
ExclusiveArch: %{rust_arches}
{% endif %}
@ -63,7 +72,11 @@ Requires: {{ req }}
%description %{_description}
%prep
%autosetup -n {{ rpm_name }}-%{version_no_tilde} -p1
{% if rpm_version != upstream_version %}
%autosetup -n {{ rpm_name }}-%{upstream_version} -p1
{% else %}
%autosetup -n {{ rpm_name }}-%{version} -p1
{% endif %}
%cargo_prep
{% if not include_build_requires %}
@ -84,6 +97,8 @@ echo {{ "%r" | format(req) }}
%build
%cargo_build{{ cargo_args }}
%{cargo_license_summary{{ cargo_args }}}
%{cargo_license{{ cargo_args }}} > LICENSE.dependencies
%install
{% if rpm_cdylib_package and rpm_binary_names|length >= 1 %}
@ -108,6 +123,7 @@ echo {{ "%r" | format(req) }}
{% else %}
# FIXME: no license files detected
{% endif %}
%license LICENSE.dependencies
{% for file in rpm_doc_files %}
%doc {{ file }}
{% endfor %}

View file

@ -6,7 +6,11 @@ Version: 0.16.1
Release: %autorelease
Summary: Fast static site generator with everything built-in
License: MIT
SourceLicense: MIT
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: # FIXME
Source: # FIXME
@ -18,7 +22,7 @@ A fast static site generator with everything built-in.}
%description %{_description}
%prep
%autosetup -n zola-%{version_no_tilde} -p1
%autosetup -n zola-%{version} -p1
%cargo_prep
%generate_buildrequires
@ -26,6 +30,8 @@ A fast static site generator with everything built-in.}
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
@ -38,6 +44,7 @@ A fast static site generator with everything built-in.}
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/zola

View file

@ -7,7 +7,11 @@ Release: %mkrel 1
Summary: Fast static site generator with everything built-in
Group: Development/Rust
License: MIT
SourceLicense: MIT
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: # FIXME
Source: # FIXME
@ -115,11 +119,13 @@ A fast static site generator with everything built-in.}
%description %{_description}
%prep
%autosetup -n zola-%{version_no_tilde} -p1
%autosetup -n zola-%{version} -p1
%cargo_prep
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
@ -132,6 +138,7 @@ A fast static site generator with everything built-in.}
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/zola

View file

@ -24,7 +24,11 @@ Release: 0
Summary: Fast static site generator with everything built-in
Group: Development/Libraries/Rust
License: MIT
SourceLicense: MIT
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: # FIXME
Source: # FIXME
@ -132,11 +136,13 @@ A fast static site generator with everything built-in.}
%description %{_description}
%prep
%autosetup -n zola-%{version_no_tilde} -p1
%autosetup -n zola-%{version} -p1
%cargo_prep
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
@ -149,6 +155,7 @@ A fast static site generator with everything built-in.}
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/zola

View file

@ -6,7 +6,11 @@ Version: 0.16.1
Release: 1%{?dist}
Summary: Fast static site generator with everything built-in
License: MIT
SourceLicense: MIT
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: # FIXME
Source: # FIXME
@ -114,11 +118,13 @@ A fast static site generator with everything built-in.}
%description %{_description}
%prep
%autosetup -n zola-%{version_no_tilde} -p1
%autosetup -n zola-%{version} -p1
%cargo_prep
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
@ -131,6 +137,7 @@ A fast static site generator with everything built-in.}
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/zola

View file

@ -99,7 +99,6 @@ def test_spec_file_render_project(filename: str, target: str):
doc_files=["DOC1", "DOC2"],
tomlconf=TomlConf(),
feature_flags=FeatureFlags(),
relative_license_paths=False,
rpmautospec=target == "fedora",
auto_changelog_entry=True,
date=FIXED_DATE,
@ -129,12 +128,14 @@ def test_spec_file_render_project(filename: str, target: str):
def test_spec_file_render_workspace(filename: str, target: str):
crate_name_version = filename.removesuffix(".json")
crate = crate_name_version.rsplit("-", 1)[0]
version = crate_name_version.rsplit("-", 1)[1]
real_path = resources.files("rust2rpm.tests.samples").joinpath(filename)
metadata = Metadata.from_json(real_path.read_text())
rendered = spec_render_workspace(
metadata=metadata,
upstream_version=version,
main_package=guess_main_package(metadata),
target=target,
rpm_name=crate,