templates: rename "md" to "metadata"
We also use "md" as short for "markdown", and this abbrevation can be confusing. It's also weird to use 'md' as the parameter name in an exported entry point.
This commit is contained in:
parent
274fa18712
commit
a09caca7e3
6 changed files with 24 additions and 21 deletions
|
@ -606,7 +606,10 @@ def main():
|
|||
print("WARNING: Conflicting settings for enabling all features: The setting is \"false\"")
|
||||
print(" in rust2rpm.conf but it was enabled with the \"--all-features\" CLI flag.")
|
||||
|
||||
spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs)
|
||||
spec_contents = template.render(
|
||||
metadata=metadata,
|
||||
patch_file=patch_file,
|
||||
**kwargs)
|
||||
if args.stdout:
|
||||
print(f"# {spec_file}")
|
||||
print(spec_contents)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
* {{ date }} {{ packager|default("rust2rpm <nobody@fedoraproject.org>") }} - {{ md.version }}-1
|
||||
* {{ date }} {{ packager|default("rust2rpm <nobody@fedoraproject.org>") }} - {{ metadata.version }}-1
|
||||
- Initial package
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
* {{ date }} {{ packager|default("rust2rpm <nobody@mageia.org>") }} - {{ md.version }}-1
|
||||
* {{ date }} {{ packager|default("rust2rpm <nobody@mageia.org>") }} - {{ metadata.version }}-1
|
||||
- Initial package
|
||||
|
|
|
@ -8,25 +8,25 @@
|
|||
{% set only_main = True %}
|
||||
{% endif %}
|
||||
|
||||
%global crate {{ md.name }}
|
||||
{% if md.name != crate %}
|
||||
%global crate {{ metadata.name }}
|
||||
{% if metadata.name != crate %}
|
||||
%global real_crate {{ crate }}
|
||||
{% endif %}
|
||||
|
||||
Name: {{ pkg_name }}
|
||||
Version: {{ md.version }}
|
||||
Version: {{ metadata.version }}
|
||||
Release: {{ pkg_release }}
|
||||
{% if md.description is none %}
|
||||
{% if metadata.description is none %}
|
||||
Summary: # FIXME
|
||||
{% else %}
|
||||
Summary: {{ md.summary }}
|
||||
Summary: {{ metadata.summary }}
|
||||
{% endif %}
|
||||
{% if rust_group is defined %}
|
||||
Group: {{ rust_group }}
|
||||
{% endif %}
|
||||
|
||||
{% if md.license != license %}
|
||||
# Upstream license specification: {{ md.license|default("(missing)") }}
|
||||
{% if metadata.license != license %}
|
||||
# Upstream license specification: {{ metadata.license|default("(missing)") }}
|
||||
{% endif %}
|
||||
License: {{ license|default("# FIXME") }}
|
||||
{% if license_comments is not none %}
|
||||
|
@ -51,11 +51,11 @@ BuildRequires: rust-packaging >= 21
|
|||
{% endif %}
|
||||
{% if not generate_buildrequires %}
|
||||
{% if not all_features %}
|
||||
{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
||||
{% set buildrequires = normalize_deps(metadata.requires("default", resolve=True))|sort %}
|
||||
{% else %}
|
||||
{% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
||||
{% set buildrequires = normalize_deps(metadata.all_dependencies)|sort %}
|
||||
{% endif %}
|
||||
{% set testrequires = normalize_deps(md.dev_dependencies)|sort %}
|
||||
{% set testrequires = normalize_deps(metadata.dev_dependencies)|sort %}
|
||||
{% set has_buildrequires = (buildrequires + testrequires)|length > 0 %}
|
||||
{% if has_buildrequires and not only_main %}
|
||||
{% endif %}
|
||||
|
@ -77,10 +77,10 @@ BuildRequires: {{ req }}
|
|||
{% endif %}
|
||||
|
||||
%global _description %{expand:
|
||||
{% if md.description is none %}
|
||||
{% if metadata.description is none %}
|
||||
%{summary}.
|
||||
{%- else %}
|
||||
{{ md.description|wordwrap }}
|
||||
{{ metadata.description|wordwrap }}
|
||||
{%- endif %}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ Requires: {{ req }}
|
|||
{% endif -%}
|
||||
|
||||
{% if include_devel %}
|
||||
{% set features = md.dependencies.keys()|list %}
|
||||
{% set features = metadata.dependencies.keys()|list %}
|
||||
{% do features.remove(None) %}
|
||||
{% do features.remove("default") %}
|
||||
{% set features = features|sort %}
|
||||
|
@ -144,11 +144,11 @@ Group: {{ rust_group }}
|
|||
{% endif %}
|
||||
BuildArch: noarch
|
||||
{% if include_provides %}
|
||||
Provides: {{ md.provides(feature) }}
|
||||
Provides: {{ metadata.provides(feature) }}
|
||||
{% endif %}
|
||||
{% if include_requires %}
|
||||
Requires: cargo
|
||||
{% for req in normalize_deps(md.requires(feature))|map("string")|sort %}
|
||||
{% for req in normalize_deps(metadata.requires(feature))|map("string")|sort %}
|
||||
Requires: {{ req }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
@ -186,7 +186,7 @@ use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "%
|
|||
{% endif -%}
|
||||
|
||||
%prep
|
||||
{% if md.name != crate %}
|
||||
{% if metadata.name != crate %}
|
||||
%autosetup -n %{real_crate}-%{version_no_tilde} -p1
|
||||
{% else %}
|
||||
%autosetup -n %{crate}-%{version_no_tilde} -p1
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
* {{ date }} {{ packager|default("rust2rpm <opensuse-packaging@opensuse.org>") }}
|
||||
- Version {{ md.version }}
|
||||
- Version {{ metadata.version }}
|
||||
- Initial package
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# spec file for package rust-{{ md.name }}
|
||||
# spec file for package rust-{{ metadata.name }}
|
||||
#
|
||||
# Copyright (c) {{ spec_copyright_year }} {{ packager|default("SUSE LINUX GmbH, Nuernberg, Germany") }}.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue