template: include %cargo_license / %cargo_license_summary macros
The macros are now well-tested and can be used unconditionally for packages that ship statically linked binaries (executables or shared libraries).
This commit is contained in:
parent
a841ba0c1c
commit
7166b781bd
6 changed files with 39 additions and 4 deletions
|
@ -155,12 +155,15 @@ def spec_render_crate(
|
||||||
|
|
||||||
if package_uses_rust_1_60_feature_syntax(package.features):
|
if package_uses_rust_1_60_feature_syntax(package.features):
|
||||||
rust_packaging_dep = "cargo-rpm-macros >= 24"
|
rust_packaging_dep = "cargo-rpm-macros >= 24"
|
||||||
|
elif is_bin or is_cdylib:
|
||||||
|
rust_packaging_dep = "rust-packaging >= 23"
|
||||||
else:
|
else:
|
||||||
rust_packaging_dep = "rust-packaging >= 21"
|
rust_packaging_dep = "rust-packaging >= 21"
|
||||||
|
|
||||||
if feature_flags.all_features or distconf.all_features:
|
if feature_flags.all_features or distconf.all_features:
|
||||||
cargo_args = " -a"
|
cargo_args = " -a"
|
||||||
elif required_features := get_required_features_for_binaries(package):
|
elif required_features := get_required_features_for_binaries(package):
|
||||||
|
# FIXME: remove features that are already part of the default feature set
|
||||||
# merge, de-duplicate, and re-sort lists of enabled features
|
# merge, de-duplicate, and re-sort lists of enabled features
|
||||||
enabled_features = sorted(set.union(set(required_features), set(distconf.enabled_features)))
|
enabled_features = sorted(set.union(set(required_features), set(distconf.enabled_features)))
|
||||||
cargo_args = f" -f {','.join(enabled_features)}"
|
cargo_args = f" -f {','.join(enabled_features)}"
|
||||||
|
|
|
@ -100,6 +100,9 @@ Group: # FIXME
|
||||||
{% for req in conf_bin_requires %}
|
{% for req in conf_bin_requires %}
|
||||||
Requires: {{ req }}
|
Requires: {{ req }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
# FIXME: paste output of %cargo_license_summary here
|
||||||
|
License: # FIXME
|
||||||
|
# LICENSE.dependencies contains a full license breakdown
|
||||||
|
|
||||||
%description -n %{crate} %{_description}
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
|
@ -111,6 +114,7 @@ Requires: {{ req }}
|
||||||
{% else %}
|
{% else %}
|
||||||
# FIXME: no license files detected
|
# FIXME: no license files detected
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
%license LICENSE.dependencies
|
||||||
{% for file in rpm_doc_files %}
|
{% for file in rpm_doc_files %}
|
||||||
%doc {{ file }}
|
%doc {{ file }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -208,6 +212,10 @@ echo {{ "%r" | format(req) }}
|
||||||
{% if conf_supported_arches %}
|
{% if conf_supported_arches %}
|
||||||
%endif
|
%endif
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if rpm_binary_package or rpm_cdylib_package %}
|
||||||
|
%{cargo_license_summary{{ cargo_args }}}
|
||||||
|
%{cargo_license{{ cargo_args }}} > LICENSE.dependencies
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
{% if rpm_cdylib_package and (rpm_library_package or rpm_binary_package) %}
|
{% if rpm_cdylib_package and (rpm_library_package or rpm_binary_package) %}
|
||||||
|
|
|
@ -16,7 +16,7 @@ Patch: dotenvy-patch1.diff
|
||||||
# Manually created patch for downstream crate metadata changes
|
# Manually created patch for downstream crate metadata changes
|
||||||
Patch: dotenvy-patch2.diff
|
Patch: dotenvy-patch2.diff
|
||||||
|
|
||||||
BuildRequires: rust-packaging >= 21
|
BuildRequires: rust-packaging >= 23
|
||||||
|
|
||||||
%global _description %{expand:
|
%global _description %{expand:
|
||||||
A well-maintained fork of the dotenv crate.}
|
A well-maintained fork of the dotenv crate.}
|
||||||
|
@ -25,12 +25,16 @@ A well-maintained fork of the dotenv crate.}
|
||||||
|
|
||||||
%package -n %{crate}
|
%package -n %{crate}
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
|
# FIXME: paste output of %cargo_license_summary here
|
||||||
|
License: # FIXME
|
||||||
|
# LICENSE.dependencies contains a full license breakdown
|
||||||
|
|
||||||
%description -n %{crate} %{_description}
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
%files -n %{crate}
|
%files -n %{crate}
|
||||||
%license LIC1
|
%license LIC1
|
||||||
%license LIC2
|
%license LIC2
|
||||||
|
%license LICENSE.dependencies
|
||||||
%doc DOC1
|
%doc DOC1
|
||||||
%doc DOC2
|
%doc DOC2
|
||||||
%{_bindir}/dotenvy
|
%{_bindir}/dotenvy
|
||||||
|
@ -96,6 +100,8 @@ use the "cli" feature of the "%{crate}" crate.
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cargo_build -f cli
|
%cargo_build -f cli
|
||||||
|
%{cargo_license_summary -f cli}
|
||||||
|
%{cargo_license -f cli} > LICENSE.dependencies
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%cargo_install -f cli
|
%cargo_install -f cli
|
||||||
|
|
|
@ -19,7 +19,7 @@ Patch: dotenvy-patch2.diff
|
||||||
|
|
||||||
ExclusiveArch: %{rust_arches}
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
BuildRequires: rust-packaging >= 21
|
BuildRequires: rust-packaging >= 23
|
||||||
%if %{with check}
|
%if %{with check}
|
||||||
BuildRequires: (crate(dirs/default) >= 4.0.0 with crate(dirs/default) < 5.0.0~)
|
BuildRequires: (crate(dirs/default) >= 4.0.0 with crate(dirs/default) < 5.0.0~)
|
||||||
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
||||||
|
@ -33,12 +33,16 @@ A well-maintained fork of the dotenv crate.}
|
||||||
%package -n %{crate}
|
%package -n %{crate}
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
Group: # FIXME
|
Group: # FIXME
|
||||||
|
# FIXME: paste output of %cargo_license_summary here
|
||||||
|
License: # FIXME
|
||||||
|
# LICENSE.dependencies contains a full license breakdown
|
||||||
|
|
||||||
%description -n %{crate} %{_description}
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
%files -n %{crate}
|
%files -n %{crate}
|
||||||
%license LIC1
|
%license LIC1
|
||||||
%license LIC2
|
%license LIC2
|
||||||
|
%license LICENSE.dependencies
|
||||||
%doc DOC1
|
%doc DOC1
|
||||||
%doc DOC2
|
%doc DOC2
|
||||||
%{_bindir}/dotenvy
|
%{_bindir}/dotenvy
|
||||||
|
@ -105,6 +109,8 @@ use the "cli" feature of the "%{crate}" crate.
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cargo_build -f cli
|
%cargo_build -f cli
|
||||||
|
%{cargo_license_summary -f cli}
|
||||||
|
%{cargo_license -f cli} > LICENSE.dependencies
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%cargo_install -f cli
|
%cargo_install -f cli
|
||||||
|
|
|
@ -36,7 +36,7 @@ Patch: dotenvy-patch2.diff
|
||||||
|
|
||||||
ExclusiveArch: %{rust_arches}
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
BuildRequires: rust-packaging >= 21
|
BuildRequires: rust-packaging >= 23
|
||||||
%if %{with check}
|
%if %{with check}
|
||||||
BuildRequires: (crate(dirs/default) >= 4.0.0 with crate(dirs/default) < 5.0.0~)
|
BuildRequires: (crate(dirs/default) >= 4.0.0 with crate(dirs/default) < 5.0.0~)
|
||||||
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
||||||
|
@ -50,12 +50,16 @@ A well-maintained fork of the dotenv crate.}
|
||||||
%package -n %{crate}
|
%package -n %{crate}
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
Group: # FIXME
|
Group: # FIXME
|
||||||
|
# FIXME: paste output of %cargo_license_summary here
|
||||||
|
License: # FIXME
|
||||||
|
# LICENSE.dependencies contains a full license breakdown
|
||||||
|
|
||||||
%description -n %{crate} %{_description}
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
%files -n %{crate}
|
%files -n %{crate}
|
||||||
%license LIC1
|
%license LIC1
|
||||||
%license LIC2
|
%license LIC2
|
||||||
|
%license LICENSE.dependencies
|
||||||
%doc DOC1
|
%doc DOC1
|
||||||
%doc DOC2
|
%doc DOC2
|
||||||
%{_bindir}/dotenvy
|
%{_bindir}/dotenvy
|
||||||
|
@ -122,6 +126,8 @@ use the "cli" feature of the "%{crate}" crate.
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cargo_build -f cli
|
%cargo_build -f cli
|
||||||
|
%{cargo_license_summary -f cli}
|
||||||
|
%{cargo_license -f cli} > LICENSE.dependencies
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%cargo_install -f cli
|
%cargo_install -f cli
|
||||||
|
|
|
@ -18,7 +18,7 @@ Patch: dotenvy-patch2.diff
|
||||||
|
|
||||||
ExclusiveArch: %{rust_arches}
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
BuildRequires: rust-packaging >= 21
|
BuildRequires: rust-packaging >= 23
|
||||||
%if %{with check}
|
%if %{with check}
|
||||||
BuildRequires: (crate(dirs/default) >= 4.0.0 with crate(dirs/default) < 5.0.0~)
|
BuildRequires: (crate(dirs/default) >= 4.0.0 with crate(dirs/default) < 5.0.0~)
|
||||||
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
||||||
|
@ -31,12 +31,16 @@ A well-maintained fork of the dotenv crate.}
|
||||||
|
|
||||||
%package -n %{crate}
|
%package -n %{crate}
|
||||||
Summary: %{summary}
|
Summary: %{summary}
|
||||||
|
# FIXME: paste output of %cargo_license_summary here
|
||||||
|
License: # FIXME
|
||||||
|
# LICENSE.dependencies contains a full license breakdown
|
||||||
|
|
||||||
%description -n %{crate} %{_description}
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
%files -n %{crate}
|
%files -n %{crate}
|
||||||
%license LIC1
|
%license LIC1
|
||||||
%license LIC2
|
%license LIC2
|
||||||
|
%license LICENSE.dependencies
|
||||||
%doc DOC1
|
%doc DOC1
|
||||||
%doc DOC2
|
%doc DOC2
|
||||||
%{_bindir}/dotenvy
|
%{_bindir}/dotenvy
|
||||||
|
@ -112,6 +116,8 @@ use the "cli" feature of the "%{crate}" crate.
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cargo_build -f cli
|
%cargo_build -f cli
|
||||||
|
%{cargo_license_summary -f cli}
|
||||||
|
%{cargo_license -f cli} > LICENSE.dependencies
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%cargo_install -f cli
|
%cargo_install -f cli
|
||||||
|
|
Loading…
Reference in a new issue