generator: workspace support + document all Jinja2 template parameters
This commit is contained in:
parent
58d33f6505
commit
f81e885df9
10 changed files with 736 additions and 250 deletions
|
@ -115,22 +115,33 @@ def main():
|
|||
|
||||
if not metadata.is_workspace():
|
||||
spec_contents = spec_render_crate(
|
||||
target=args.target,
|
||||
auto_changelog_entry=args.auto_changelog_entry,
|
||||
rpmautospec=args.rpmautospec,
|
||||
relative_license_paths=args.relative_license_paths,
|
||||
rpm_name=rpm_name,
|
||||
metadata=metadata,
|
||||
target=args.target,
|
||||
rpm_name=rpm_name,
|
||||
patch_file_automatic=patch_files[0],
|
||||
patch_file_manual=patch_files[1],
|
||||
packager=packager,
|
||||
doc_files=doc_files,
|
||||
license_files=license_files,
|
||||
doc_files=doc_files,
|
||||
distconf=conf[args.target],
|
||||
feature_flags=FeatureFlags(all_features=(conf_all_features or args.all_features)),
|
||||
relative_license_paths=args.relative_license_paths,
|
||||
rpmautospec=args.rpmautospec,
|
||||
auto_changelog_entry=args.auto_changelog_entry,
|
||||
packager=packager,
|
||||
)
|
||||
else:
|
||||
spec_contents = spec_render_workspace(**dict())
|
||||
spec_contents = spec_render_workspace(
|
||||
metadata=metadata,
|
||||
target=args.target,
|
||||
rpm_name=rpm_name,
|
||||
license_files=license_files,
|
||||
doc_files=doc_files,
|
||||
distconf=conf[args.target],
|
||||
feature_flags=FeatureFlags(all_features=(conf_all_features or args.all_features)),
|
||||
rpmautospec=args.rpmautospec,
|
||||
auto_changelog_entry=args.auto_changelog_entry,
|
||||
packager=packager,
|
||||
)
|
||||
|
||||
if args.stdout:
|
||||
print(f"# {spec_file}")
|
||||
|
|
|
@ -103,20 +103,20 @@ def template_args_plain(date: Optional[time.struct_time], packager: Optional[str
|
|||
|
||||
def spec_render_crate(
|
||||
*,
|
||||
target: str,
|
||||
auto_changelog_entry: bool,
|
||||
rpmautospec: bool,
|
||||
relative_license_paths: bool,
|
||||
rpm_name: str,
|
||||
metadata: Metadata,
|
||||
target: str,
|
||||
rpm_name: str,
|
||||
patch_file_automatic: Optional[str],
|
||||
patch_file_manual: Optional[str],
|
||||
packager: str,
|
||||
doc_files: list[str],
|
||||
license_files: list[str],
|
||||
doc_files: list[str],
|
||||
distconf,
|
||||
feature_flags: FeatureFlags,
|
||||
relative_license_paths: bool,
|
||||
rpmautospec: bool,
|
||||
auto_changelog_entry: bool,
|
||||
date: Optional[time.struct_time] = None,
|
||||
packager: str,
|
||||
):
|
||||
template = spec_file_template("crate.spec")
|
||||
|
||||
|
@ -183,11 +183,11 @@ def spec_render_crate(
|
|||
cargo_args = ""
|
||||
|
||||
if license_str := metadata.packages[0].license:
|
||||
license_tag, license_comments = translate_license(target, license_str)
|
||||
rpm_license, rpm_license_comments = translate_license(target, license_str)
|
||||
else:
|
||||
log.warn("No license information in crate metadata.")
|
||||
license_tag = None
|
||||
license_comments = "FIXME: No license information in crate metadata."
|
||||
rpm_license = None
|
||||
rpm_license_comments = "FIXME: No license information in crate metadata."
|
||||
|
||||
template_args_common = {
|
||||
# Parameters specific to rust2rpm
|
||||
|
@ -199,8 +199,8 @@ def spec_render_crate(
|
|||
"rpm_version": Version.parse(package.version).to_rpm(),
|
||||
"rpm_summary": summary,
|
||||
"rpm_description": description,
|
||||
"rpm_license": license_tag,
|
||||
"rpm_license_comments": license_comments,
|
||||
"rpm_license": rpm_license,
|
||||
"rpm_license_comments": rpm_license_comments,
|
||||
"rpm_patch_file_automatic": patch_file_automatic,
|
||||
"rpm_patch_file_manual": patch_file_manual,
|
||||
"rpm_buildrequires": rpm_buildrequires,
|
||||
|
@ -243,7 +243,6 @@ def spec_render_crate(
|
|||
raise ValueError(f"Unknown target {target!r} (this should never happen)")
|
||||
|
||||
spec_contents = template.render(
|
||||
metadata=metadata,
|
||||
**template_args_common,
|
||||
**template_args_target,
|
||||
)
|
||||
|
@ -256,72 +255,102 @@ def spec_render_crate(
|
|||
|
||||
def spec_render_workspace(
|
||||
*,
|
||||
version: str,
|
||||
target: str,
|
||||
auto_changelog_entry: bool,
|
||||
rpmautospec: bool,
|
||||
relative_license_paths: bool,
|
||||
dynamic_buildrequires: bool,
|
||||
rpm_name: str,
|
||||
project: str,
|
||||
metadata: Metadata,
|
||||
packager: str,
|
||||
doc_files: list[str],
|
||||
target: str,
|
||||
rpm_name: str,
|
||||
license_files: list[str],
|
||||
doc_files: list[str],
|
||||
distconf,
|
||||
all_features: bool,
|
||||
feature_flags: FeatureFlags,
|
||||
rpmautospec: bool,
|
||||
auto_changelog_entry: bool,
|
||||
date: Optional[time.struct_time] = None,
|
||||
packager: str,
|
||||
) -> str:
|
||||
template = spec_file_template("workspace.spec")
|
||||
|
||||
# sort binaries by name for consistent ordering
|
||||
# enforce consistent ordering of binaries
|
||||
binaries = [*metadata.get_binaries()]
|
||||
binaries.sort()
|
||||
|
||||
generator_version = __version__.split(".")[0]
|
||||
description = guess_main_package(metadata).get_description()
|
||||
summary = guess_main_package(metadata).get_summary()
|
||||
main_package = guess_main_package(metadata)
|
||||
rpm_version = Version.parse(main_package.version).to_rpm()
|
||||
rpm_description = main_package.get_description()
|
||||
rpm_summary = main_package.get_summary()
|
||||
|
||||
template_args_commmon = {
|
||||
"rust2rpm_version": generator_version,
|
||||
"target": target,
|
||||
"project": project,
|
||||
"include_devel": False,
|
||||
"auto_changelog_entry": auto_changelog_entry,
|
||||
"rpmautospec": rpmautospec,
|
||||
"relative_license_paths": relative_license_paths,
|
||||
"generate_buildrequires": dynamic_buildrequires,
|
||||
"doc_files": doc_files,
|
||||
"license_files": license_files,
|
||||
"distconf": distconf,
|
||||
"all_features": all_features,
|
||||
"features": [],
|
||||
# new below
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": Version.parse(version).to_rpm(),
|
||||
"rpm_summary": summary,
|
||||
"rpm_description": description,
|
||||
}
|
||||
generator_version = __version__.split(".")[0]
|
||||
|
||||
buildrequires = rpm.workspace_buildrequires(metadata, feature_flags, False)
|
||||
test_requires = set.difference(
|
||||
rpm.workspace_buildrequires(metadata, feature_flags, True),
|
||||
rpm.workspace_buildrequires(metadata, feature_flags, False),
|
||||
)
|
||||
|
||||
rpm_buildrequires = list(sorted(buildrequires))
|
||||
rpm_test_requires = list(sorted(test_requires))
|
||||
|
||||
conf_buildrequires = to_list(distconf.get("buildrequires"))
|
||||
conf_buildrequires.sort()
|
||||
|
||||
conf_test_requires = to_list(distconf.get("testrequires"))
|
||||
conf_test_requires.sort()
|
||||
|
||||
conf_bin_requires = to_list(distconf.get("bin.requires"))
|
||||
conf_bin_requires.sort()
|
||||
|
||||
if any(package_uses_rust_1_60_feature_syntax(package.features) for package in metadata.packages):
|
||||
rust_packaging_dep = "cargo-rpm-macros >= 24"
|
||||
else:
|
||||
rust_packaging_dep = "rust-packaging >= 21"
|
||||
|
||||
# TODO: allow passing through more feature flags than just "--all-features"
|
||||
if feature_flags.all_features:
|
||||
cargo_args = " -a"
|
||||
else:
|
||||
cargo_args = ""
|
||||
|
||||
license_strs = {package.license for package in metadata.packages}
|
||||
|
||||
if len(license_strs) == 1:
|
||||
license_tag, comments = translate_license(target, list(license_strs)[0])
|
||||
template_args_commmon["rpm_license"] = license_tag
|
||||
template_args_commmon["rpm_license_comments"] = comments
|
||||
|
||||
rpm_license_tag, rpm_license_comments = translate_license(target, list(license_strs)[0])
|
||||
else:
|
||||
is_composite = (
|
||||
lambda x: (" " in x and " WITH " not in x and "(" not in x and ")" not in x) or "(" in x or ")" in x
|
||||
)
|
||||
license_strs = [
|
||||
license_str if not is_composite(license_str) else f"({license_str})" for license_str in license_strs
|
||||
license_str if not is_composite(license_str) else f"({license_str})"
|
||||
for license_str in license_strs
|
||||
if license_str is not None
|
||||
]
|
||||
license_strs.sort()
|
||||
license_str = " AND ".join(license_strs)
|
||||
license_tag, comments = translate_license(target, license_str)
|
||||
template_args_commmon["rpm_license"] = license_tag
|
||||
template_args_commmon["rpm_license_comments"] = comments
|
||||
rpm_license_tag, rpm_license_comments = translate_license(target, license_str)
|
||||
|
||||
template_args_common = {
|
||||
# Parameters specific to rust2rpm
|
||||
"rust2rpm_version": generator_version,
|
||||
"rust2rpm_target": target,
|
||||
"rust_packaging_dep": rust_packaging_dep,
|
||||
# Parameters for RPM package metadata
|
||||
"rpm_name": rpm_name,
|
||||
"rpm_version": rpm_version,
|
||||
"rpm_summary": rpm_summary,
|
||||
"rpm_description": rpm_description,
|
||||
"rpm_license": rpm_license_tag,
|
||||
"rpm_license_comments": rpm_license_comments,
|
||||
"rpm_buildrequires": rpm_buildrequires,
|
||||
"rpm_test_requires": rpm_test_requires,
|
||||
"rpm_license_files": license_files,
|
||||
"rpm_doc_files": doc_files,
|
||||
"rpm_binary_names": binaries,
|
||||
# Parameters derived from rust2rpm.conf
|
||||
"conf_buildrequires": conf_buildrequires,
|
||||
"conf_test_requires": conf_test_requires,
|
||||
"conf_bin_requires": conf_bin_requires,
|
||||
# Parameters derived from command-line flags
|
||||
"cargo_args": cargo_args,
|
||||
"use_rpmautospec": rpmautospec,
|
||||
"make_changelog_entry": auto_changelog_entry,
|
||||
}
|
||||
|
||||
match target:
|
||||
case "fedora":
|
||||
|
@ -336,10 +365,7 @@ def spec_render_workspace(
|
|||
raise ValueError(f"Unknown target {target!r} (this should never happen)")
|
||||
|
||||
spec_contents = template.render(
|
||||
metadata=metadata,
|
||||
patch_file_manual=None,
|
||||
patch_file_automatic=None,
|
||||
**template_args_commmon,
|
||||
**template_args_common,
|
||||
**template_args_target,
|
||||
)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
| parameter name | type | value |
|
||||
| ---------------------------- | ------ | -------------------------------------------------------------------------------- |
|
||||
| `cargo_flags` | `str` | flags that are added to all `%cargo_foo` macro calls |
|
||||
| `cargo_args` | `str` | flags that are added to all `%cargo_foo` macro calls |
|
||||
| `use_relative_license_paths` | `bool` | toggle between relative and absolute paths as arguments for the `%license` macro |
|
||||
| `use_rpmautospec` | `bool` | toggle usage of RPMAutospec in generated spec files |
|
||||
| `make_changelog_entry` | `bool` | toggle creation of changelog entry in generated spec files |
|
||||
|
@ -78,4 +78,53 @@
|
|||
|
||||
## Template for non-crate projects (with cargo workspace)
|
||||
|
||||
### Parameters specific to rust2rpm
|
||||
|
||||
| parameter name | type | value |
|
||||
| -------------------- | ----- | ---------------------------------------------- |
|
||||
| `rust2rpm_version` | `str` | current major version of rust2rpm |
|
||||
| `rust2rpm_target` | `str` | target OS (fedora, mageia, opensuse, plain) |
|
||||
| `rust_packaging_dep` | `str` | dependency string for RPM Rust packaging tools |
|
||||
|
||||
### Parameters for RPM package metadata
|
||||
|
||||
| parameter name | type | value |
|
||||
| -------------------------- | ---------------------- | ------------------------------------------------------------------------------------ |
|
||||
| `rpm_name` | `str` | RPM source package Name (`rust-{crate}{suffix}`) |
|
||||
| `rpm_version` | `str` | RPM package Version (translated to RPM format from SemVer) |
|
||||
| `rpm_summary` | `Optional[str]` | RPM package summary (derived from `package.description` value from `Cargo.toml`) |
|
||||
| `rpm_description` | `Optional[str]` | RPM package description (derived from `package.description` value from `Cargo.toml`) |
|
||||
| `rpm_license` | `Optional[str]` | RPM License tag (derived from `package.license` value from `Cargo.toml`) |
|
||||
| `rpm_license_comments` | `Optional[str]` | additional information returned by license string translation |
|
||||
| `rpm_buildrequires` | `list[str]` | list of RPM `BuildRequires` |
|
||||
| `rpm_test_requires` | `list[str]` | list of RPM `BuildRequires` that are gated by an `%if %{with check}` conditional |
|
||||
| `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_binary_names` | `list[str]` | list of the names of executables which are built from the project |
|
||||
|
||||
### Parameters derived from rust2rpm.conf
|
||||
|
||||
| parameter name | type | value |
|
||||
| -------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` |
|
||||
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` that are gated by an `%if %{with check}` conditional |
|
||||
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
|
||||
|
||||
### Parameters derived from command-line flags
|
||||
|
||||
| parameter name | type | value |
|
||||
| ---------------------------- | ------ | -------------------------------------------------------------------------------- |
|
||||
| `cargo_args` | `str` | flags that are added to all `%cargo_foo` macro calls |
|
||||
| `use_rpmautospec` | `bool` | toggle usage of RPMAutospec in generated spec files |
|
||||
| `make_changelog_entry` | `bool` | toggle creation of changelog entry in generated spec files |
|
||||
|
||||
### Target-specific parameters
|
||||
|
||||
| parameter name | type | value |
|
||||
| ------------------------ | ------ | --------------------------------------------------------------- |
|
||||
| `rpm_release` | `str` | RPM package Release (exact value depends on the target OS) |
|
||||
| `include_build_requires` | `bool` | toggle between dynamically generated and static `BuildRequires` |
|
||||
| `rpm_group` | `str` | RPM Group tag (not defined on for all target OS) |
|
||||
| `rpm_changelog_date` | `str` | date for automatically generated `%changelog` entry |
|
||||
| `rpm_changelog_packager` | `str` | packager for automatically generated `%changelog` entry |
|
||||
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
{% include target ~ "-header.spec.inc" ignore missing %}
|
||||
{% include rust2rpm_target ~ "-header.spec.inc" ignore missing %}
|
||||
# Generated by rust2rpm {{ rust2rpm_version }}
|
||||
%bcond_without check
|
||||
{% set only_main = False %}
|
||||
{% if not include_main %}
|
||||
%global debug_package %{nil}
|
||||
{% elif not include_devel %}
|
||||
{% set only_main = True %}
|
||||
{% endif %}
|
||||
|
||||
%global crate {{ crate_name }}
|
||||
{% if metadata.name != crate %}
|
||||
%global real_crate {{ crate }}
|
||||
{% endif %}
|
||||
|
||||
Name: {{ rpm_name }}
|
||||
Version: {{ rpm_version }}
|
||||
|
@ -21,199 +10,71 @@ Summary: # FIXME
|
|||
{% else %}
|
||||
Summary: {{ rpm_summary }}
|
||||
{% endif %}
|
||||
{% if rust_group is defined %}
|
||||
Group: {{ rust_group }}
|
||||
{% if rpm_group is defined %}
|
||||
Group: {{ rpm_group }}
|
||||
{% endif %}
|
||||
|
||||
{% if crate_license != rpm_license %}
|
||||
# Upstream license specification: {{ metadata.license|default("(missing)") }}
|
||||
{% endif %}
|
||||
License: {{ license|default("# FIXME") }}
|
||||
{% if license_comments is not none %}
|
||||
{{ license_comments }}
|
||||
{% endif %}
|
||||
URL: https://crates.io/crates/{{ crate }}
|
||||
Source: %{crates_source}
|
||||
{% if patch_file_automatic is not none %}
|
||||
# Automatically generated patch to strip foreign dependencies
|
||||
Patch: {{ patch_file_automatic }}
|
||||
{% endif %}
|
||||
{% if patch_file_manual is not none %}
|
||||
{% if target == "opensuse" %}
|
||||
# PATCH-FIX-OPENSUSE {{ patch_file_manual }} — Manually created patch for downstream crate metadata changes
|
||||
{% else %}
|
||||
# Manually created patch for downstream crate metadata changes
|
||||
{% endif %}
|
||||
Patch: {{ patch_file_manual }}
|
||||
License: {{ rpm_license|default("# FIXME") }}
|
||||
{% if rpm_license_comments is not none %}
|
||||
{{ rpm_license_comments }}
|
||||
{% endif %}
|
||||
URL: # FIXME
|
||||
Source: # FIXME
|
||||
|
||||
{% if target != "fedora" %}
|
||||
{% if rust2rpm_target != "fedora" %}
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
{% endif %}
|
||||
BuildRequires: rust-packaging >= 21
|
||||
{% if all_features %}
|
||||
{% set cargo_args = " -a" %}
|
||||
{% endif %}
|
||||
{% if not generate_buildrequires %}
|
||||
{% if not all_features %}
|
||||
{% set buildrequires = normalize_deps(metadata.requires("default", resolve=True))|sort %}
|
||||
{% else %}
|
||||
{% set buildrequires = normalize_deps(metadata.all_dependencies)|sort %}
|
||||
{% endif %}
|
||||
{% set testrequires = normalize_deps(metadata.dev_dependencies)|sort %}
|
||||
{% set has_buildrequires = (buildrequires + testrequires)|length > 0 %}
|
||||
{% if has_buildrequires and not only_main %}
|
||||
{% endif %}
|
||||
{% for req in buildrequires %}
|
||||
BuildRequires: {{ rust_packaging_dep }}
|
||||
{% if include_build_requires %}
|
||||
{% for req in rpm_buildrequires %}
|
||||
BuildRequires: {{ req }}
|
||||
{% endfor %}
|
||||
{% if testrequires|length > 0 %}
|
||||
{% if rpm_test_requires|length > 0 %}
|
||||
%if %{with check}
|
||||
{% for req in testrequires %}
|
||||
{% for req in rpm_test_requires %}
|
||||
BuildRequires: {{ req }}
|
||||
{% endfor %}
|
||||
%endif
|
||||
{% endif %}
|
||||
{% for req in to_list(distconf.get("buildrequires"))|sort %}
|
||||
{% for req in conf_buildrequires %}
|
||||
BuildRequires: {{ req }}
|
||||
{% endfor %}
|
||||
{% if distconf.get("testrequires") %}
|
||||
{% if conf_test_requires %}
|
||||
%if %{with check}
|
||||
{% for req in to_list(distconf.get("testrequires"))|sort %}
|
||||
{% for req in conf_test_requires %}
|
||||
BuildRequires: {{ req }}
|
||||
{% endfor %}
|
||||
%endif
|
||||
{% endif %}
|
||||
{% if has_buildrequires and not only_main %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% for req in conf_bin_requires %}
|
||||
Requires: {{ req }}
|
||||
{% endfor %}
|
||||
|
||||
%global _description %{expand:
|
||||
{% if metadata.description is none %}
|
||||
{% if rpm_description is none %}
|
||||
%{summary}.
|
||||
{%- else %}
|
||||
{{ metadata.description|wordwrap }}
|
||||
{{ rpm_description }}
|
||||
{%- endif %}
|
||||
}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
{% if include_main %}
|
||||
{% if not only_main %}
|
||||
{% endif %}
|
||||
%package -n %{crate}
|
||||
Summary: %{summary}
|
||||
{% if rust_group is defined %}
|
||||
Group: # FIXME
|
||||
{% endif %}
|
||||
{% for req in to_list(distconf.get("bin.requires"))|sort %}
|
||||
Requires: {{ req }}
|
||||
{% endfor %}
|
||||
|
||||
%description -n %{crate} %{_description}
|
||||
|
||||
%files -n %{crate}
|
||||
{% if license_files|length > 0 %}
|
||||
{% for file in license_files %}
|
||||
%license {{ file }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
# FIXME: no license files detected
|
||||
{% endif %}
|
||||
{% for file in doc_files %}
|
||||
%doc {{ file }}
|
||||
{% endfor %}
|
||||
{% for bin in bins %}
|
||||
%{_bindir}/{{ bin.name }}
|
||||
{% endfor %}
|
||||
{% if not only_main %}
|
||||
{% endif %}
|
||||
|
||||
{% endif -%}
|
||||
|
||||
{% if include_devel %}
|
||||
{% do features.remove(None) %}
|
||||
{% do features.remove("default") %}
|
||||
{% set features = features|sort %}
|
||||
{% do features.insert(0, None) %}
|
||||
{% do features.insert(1, "default") %}
|
||||
{% for unwanted in to_list(distconf.get("unwanted-features")) %}
|
||||
{% do features.remove(unwanted) %}
|
||||
{% endfor %}
|
||||
{% for feature in features %}
|
||||
{% if feature is none %}
|
||||
{% set pkg = " devel" %}
|
||||
{% set conf_prefix = "lib" %}
|
||||
{% else %}
|
||||
{% set pkg = "-n %%{name}+%s-devel"|format(feature) %}
|
||||
{% set conf_prefix = "lib+%s"|format(feature) %}
|
||||
{% endif %}
|
||||
%package {{ pkg }}
|
||||
Summary: %{summary}
|
||||
{% if rust_group is defined %}
|
||||
Group: {{ rust_group }}
|
||||
{% endif %}
|
||||
BuildArch: noarch
|
||||
{% if include_provides %}
|
||||
Provides: {{ metadata.provides(feature) }}
|
||||
{% endif %}
|
||||
{% if include_requires %}
|
||||
Requires: cargo
|
||||
{% for req in normalize_deps(metadata.requires(feature))|map("string")|sort %}
|
||||
Requires: {{ req }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% for req in to_list(distconf.get("%s.requires"|format(conf_prefix)))|sort %}
|
||||
Requires: {{ req }}
|
||||
{% endfor %}
|
||||
|
||||
%description {{ pkg }} %{_description}
|
||||
|
||||
This package contains library source intended for building other packages which
|
||||
use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "%{crate}" crate.
|
||||
|
||||
%files {{ pkg }}
|
||||
{% if feature is none %}
|
||||
{% if license_files|length > 0 %}
|
||||
{% for file in license_files %}
|
||||
{% if relative_license_paths %}
|
||||
%license {{ file }}
|
||||
{% else %}
|
||||
%license %{crate_instdir}/{{ file }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
# FIXME: no license files detected
|
||||
{% endif %}
|
||||
{% for file in doc_files %}
|
||||
%doc %{crate_instdir}/{{ file }}
|
||||
{% endfor %}
|
||||
%{crate_instdir}/
|
||||
{% else %}
|
||||
%ghost %{crate_instdir}/Cargo.toml
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
%prep
|
||||
{% if metadata.name != crate %}
|
||||
%autosetup -n %{real_crate}-%{version_no_tilde} -p1
|
||||
{% else %}
|
||||
%autosetup -n %{crate}-%{version_no_tilde} -p1
|
||||
{% endif %}
|
||||
%autosetup -n {{ rpm_name }}-%{version_no_tilde} -p1
|
||||
%cargo_prep
|
||||
|
||||
{% if generate_buildrequires %}
|
||||
{% if not include_build_requires %}
|
||||
%generate_buildrequires
|
||||
%cargo_generate_buildrequires{{ cargo_args }}
|
||||
{% for req in to_list(distconf.get("buildrequires"))|sort %}
|
||||
{% for req in conf_buildrequires %}
|
||||
echo {{ "%r" | format(req) }}
|
||||
{% endfor %}
|
||||
{% if distconf.get("testrequires") %}
|
||||
{% if conf_test_requires %}
|
||||
%if %{with check}
|
||||
{% for req in to_list(distconf.get("testrequires"))|sort %}
|
||||
{% for req in conf_test_requires %}
|
||||
echo {{ "%r" | format(req) }}
|
||||
{% endfor %}
|
||||
%endif
|
||||
|
@ -232,12 +93,27 @@ echo {{ "%r" | format(req) }}
|
|||
%cargo_test{{ cargo_args }}
|
||||
%endif
|
||||
|
||||
%files
|
||||
{% if rpm_license_files|length > 0 %}
|
||||
{% for file in rpm_license_files %}
|
||||
%license {{ file }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
# FIXME: no license files detected
|
||||
{% endif %}
|
||||
{% for file in rpm_doc_files %}
|
||||
%doc {{ file }}
|
||||
{% endfor %}
|
||||
{% for bin in rpm_binary_names %}
|
||||
%{_bindir}/{{ bin }}
|
||||
{% endfor %}
|
||||
|
||||
%changelog
|
||||
{% if rpmautospec %}
|
||||
{% if use_rpmautospec %}
|
||||
%autochangelog
|
||||
{%- else %}
|
||||
{%- if auto_changelog_entry -%}
|
||||
{%- if make_changelog_entry -%}
|
||||
|
||||
{% include target ~ "-changelog.spec.inc" %}
|
||||
{% include rust2rpm_target ~ "-changelog.spec.inc" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
46
rust2rpm/tests/samples/zola-0.16.1.fedora.spec
Normal file
46
rust2rpm/tests/samples/zola-0.16.1.fedora.spec
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Generated by rust2rpm NNN
|
||||
%bcond_without check
|
||||
|
||||
Name: zola
|
||||
Version: 0.16.1
|
||||
Release: %autorelease
|
||||
Summary: Fast static site generator with everything built-in
|
||||
|
||||
License: MIT
|
||||
URL: # FIXME
|
||||
Source: # FIXME
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
|
||||
%global _description %{expand:
|
||||
A fast static site generator with everything built-in.}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
%prep
|
||||
%autosetup -n zola-%{version_no_tilde} -p1
|
||||
%cargo_prep
|
||||
|
||||
%generate_buildrequires
|
||||
%cargo_generate_buildrequires
|
||||
|
||||
%build
|
||||
%cargo_build
|
||||
|
||||
%install
|
||||
%cargo_install
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
%cargo_test
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LIC1
|
||||
%license LIC2
|
||||
%doc DOC1
|
||||
%doc DOC2
|
||||
%{_bindir}/zola
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
1
rust2rpm/tests/samples/zola-0.16.1.json
Normal file
1
rust2rpm/tests/samples/zola-0.16.1.json
Normal file
File diff suppressed because one or more lines are too long
141
rust2rpm/tests/samples/zola-0.16.1.mageia.spec
Normal file
141
rust2rpm/tests/samples/zola-0.16.1.mageia.spec
Normal file
|
@ -0,0 +1,141 @@
|
|||
# Generated by rust2rpm NNN
|
||||
%bcond_without check
|
||||
|
||||
Name: zola
|
||||
Version: 0.16.1
|
||||
Release: %mkrel 1
|
||||
Summary: Fast static site generator with everything built-in
|
||||
Group: Development/Rust
|
||||
|
||||
License: MIT
|
||||
URL: # FIXME
|
||||
Source: # FIXME
|
||||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: (crate(ahash/default) >= 0.8.0 with crate(ahash/default) < 0.9.0~)
|
||||
BuildRequires: (crate(ammonia/default) >= 3.0.0 with crate(ammonia/default) < 4.0.0~)
|
||||
BuildRequires: (crate(anyhow/default) >= 1.0.56 with crate(anyhow/default) < 2.0.0~)
|
||||
BuildRequires: (crate(atty/default) >= 0.2.11 with crate(atty/default) < 0.3.0~)
|
||||
BuildRequires: (crate(base64/default) >= 0.13.0 with crate(base64/default) < 0.14.0~)
|
||||
BuildRequires: (crate(clap/default) >= 3.0.0 with crate(clap/default) < 4.0.0~)
|
||||
BuildRequires: (crate(clap/derive) >= 3.0.0 with crate(clap/derive) < 4.0.0~)
|
||||
BuildRequires: (crate(clap_complete/default) >= 3.0.0 with crate(clap_complete/default) < 4.0.0~)
|
||||
BuildRequires: (crate(csv/default) >= 1.0.0 with crate(csv/default) < 2.0.0~)
|
||||
BuildRequires: (crate(ctrlc/default) >= 3.0.0 with crate(ctrlc/default) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/da) >= 3.0.0 with crate(elasticlunr-rs/da) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/de) >= 3.0.0 with crate(elasticlunr-rs/de) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/default) >= 3.0.0 with crate(elasticlunr-rs/default) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/du) >= 3.0.0 with crate(elasticlunr-rs/du) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/es) >= 3.0.0 with crate(elasticlunr-rs/es) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/fi) >= 3.0.0 with crate(elasticlunr-rs/fi) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/fr) >= 3.0.0 with crate(elasticlunr-rs/fr) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/it) >= 3.0.0 with crate(elasticlunr-rs/it) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/no) >= 3.0.0 with crate(elasticlunr-rs/no) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/pt) >= 3.0.0 with crate(elasticlunr-rs/pt) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/ro) >= 3.0.0 with crate(elasticlunr-rs/ro) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/ru) >= 3.0.0 with crate(elasticlunr-rs/ru) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/sv) >= 3.0.0 with crate(elasticlunr-rs/sv) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/tr) >= 3.0.0 with crate(elasticlunr-rs/tr) < 4.0.0~)
|
||||
BuildRequires: (crate(filetime/default) >= 0.2.0 with crate(filetime/default) < 0.3.0~)
|
||||
BuildRequires: (crate(gh-emoji/default) >= 1.0.0 with crate(gh-emoji/default) < 2.0.0~)
|
||||
BuildRequires: (crate(glob/default) >= 0.3.0 with crate(glob/default) < 0.4.0~)
|
||||
BuildRequires: (crate(globset/default) >= 0.4.0 with crate(globset/default) < 0.5.0~)
|
||||
BuildRequires: (crate(hyper) >= 0.14.1 with crate(hyper) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/http1) >= 0.14.1 with crate(hyper/http1) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/http2) >= 0.14.1 with crate(hyper/http2) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/runtime) >= 0.14.1 with crate(hyper/runtime) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/server) >= 0.14.1 with crate(hyper/server) < 0.15.0~)
|
||||
BuildRequires: (crate(image/default) >= 0.24.0 with crate(image/default) < 0.25.0~)
|
||||
BuildRequires: (crate(kamadak-exif/default) >= 0.5.4 with crate(kamadak-exif/default) < 0.6.0~)
|
||||
BuildRequires: (crate(lexical-sort/default) >= 0.3.0 with crate(lexical-sort/default) < 0.4.0~)
|
||||
BuildRequires: (crate(mime/default) >= 0.3.16 with crate(mime/default) < 0.4.0~)
|
||||
BuildRequires: (crate(mime_guess/default) >= 2.0.0 with crate(mime_guess/default) < 3.0.0~)
|
||||
BuildRequires: (crate(minify-html/default) >= 0.9.0 with crate(minify-html/default) < 0.10.0~)
|
||||
BuildRequires: (crate(nom-bibtex/default) >= 0.3.0 with crate(nom-bibtex/default) < 0.4.0~)
|
||||
BuildRequires: (crate(notify/default) >= 4.0.0 with crate(notify/default) < 5.0.0~)
|
||||
BuildRequires: (crate(num-format/default) >= 0.4.0 with crate(num-format/default) < 0.5.0~)
|
||||
BuildRequires: (crate(once_cell/default) >= 1.0.0 with crate(once_cell/default) < 2.0.0~)
|
||||
BuildRequires: (crate(open/default) >= 3.0.0 with crate(open/default) < 4.0.0~)
|
||||
BuildRequires: (crate(pathdiff/default) >= 0.2.0 with crate(pathdiff/default) < 0.3.0~)
|
||||
BuildRequires: (crate(percent-encoding/default) >= 2.0.0 with crate(percent-encoding/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pest/default) >= 2.0.0 with crate(pest/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pest_derive/default) >= 2.0.0 with crate(pest_derive/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pulldown-cmark) >= 0.9.0 with crate(pulldown-cmark) < 0.10.0~)
|
||||
BuildRequires: (crate(pulldown-cmark/simd) >= 0.9.0 with crate(pulldown-cmark/simd) < 0.10.0~)
|
||||
BuildRequires: (crate(quickxml_to_serde/default) >= 0.5.0 with crate(quickxml_to_serde/default) < 0.6.0~)
|
||||
BuildRequires: (crate(rayon/default) >= 1.0.0 with crate(rayon/default) < 2.0.0~)
|
||||
BuildRequires: (crate(regex/default) >= 1.0.0 with crate(regex/default) < 2.0.0~)
|
||||
BuildRequires: (crate(relative-path/default) >= 1.0.0 with crate(relative-path/default) < 2.0.0~)
|
||||
BuildRequires: (crate(reqwest) >= 0.11.0 with crate(reqwest) < 0.12.0~)
|
||||
BuildRequires: (crate(reqwest/blocking) >= 0.11.0 with crate(reqwest/blocking) < 0.12.0~)
|
||||
BuildRequires: (crate(reqwest/rustls-tls) >= 0.11.0 with crate(reqwest/rustls-tls) < 0.12.0~)
|
||||
BuildRequires: (crate(sass-rs/default) >= 0.2.0 with crate(sass-rs/default) < 0.3.0~)
|
||||
BuildRequires: (crate(serde/default) >= 1.0.0 with crate(serde/default) < 2.0.0~)
|
||||
BuildRequires: (crate(serde/derive) >= 1.0.0 with crate(serde/derive) < 2.0.0~)
|
||||
BuildRequires: (crate(serde_json/default) >= 1.0.0 with crate(serde_json/default) < 2.0.0~)
|
||||
BuildRequires: (crate(serde_yaml/default) >= 0.9.0 with crate(serde_yaml/default) < 0.10.0~)
|
||||
BuildRequires: (crate(sha2/default) >= 0.10.0 with crate(sha2/default) < 0.11.0~)
|
||||
BuildRequires: (crate(slug/default) >= 0.1.0 with crate(slug/default) < 0.2.0~)
|
||||
BuildRequires: (crate(svg_metadata/default) >= 0.4.0 with crate(svg_metadata/default) < 0.5.0~)
|
||||
BuildRequires: (crate(syntect/default) >= 5.0.0 with crate(syntect/default) < 6.0.0~)
|
||||
BuildRequires: (crate(tera/default) >= 1.0.0 with crate(tera/default) < 2.0.0~)
|
||||
BuildRequires: (crate(tera/preserve_order) >= 1.0.0 with crate(tera/preserve_order) < 2.0.0~)
|
||||
BuildRequires: (crate(termcolor/default) >= 1.0.4 with crate(termcolor/default) < 2.0.0~)
|
||||
BuildRequires: (crate(time/default) >= 0.3.0 with crate(time/default) < 0.4.0~)
|
||||
BuildRequires: (crate(time/formatting) >= 0.3.0 with crate(time/formatting) < 0.4.0~)
|
||||
BuildRequires: (crate(time/local-offset) >= 0.3.0 with crate(time/local-offset) < 0.4.0~)
|
||||
BuildRequires: (crate(time/macros) >= 0.3.0 with crate(time/macros) < 0.4.0~)
|
||||
BuildRequires: (crate(tokio) >= 1.0.1 with crate(tokio) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/fs) >= 1.0.1 with crate(tokio/fs) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/rt) >= 1.0.1 with crate(tokio/rt) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/time) >= 1.0.1 with crate(tokio/time) < 2.0.0~)
|
||||
BuildRequires: (crate(toml/default) >= 0.5.0 with crate(toml/default) < 0.6.0~)
|
||||
BuildRequires: (crate(unic-langid/default) >= 0.9.0 with crate(unic-langid/default) < 0.10.0~)
|
||||
BuildRequires: (crate(unicode-segmentation/default) >= 1.2.0 with crate(unicode-segmentation/default) < 2.0.0~)
|
||||
BuildRequires: (crate(url/default) >= 2.0.0 with crate(url/default) < 3.0.0~)
|
||||
BuildRequires: (crate(walkdir/default) >= 2.0.0 with crate(walkdir/default) < 3.0.0~)
|
||||
BuildRequires: (crate(webp/default) >= 0.2.0 with crate(webp/default) < 0.3.0~)
|
||||
BuildRequires: (crate(winres/default) >= 0.1.0 with crate(winres/default) < 0.2.0~)
|
||||
BuildRequires: (crate(ws/default) >= 0.9.0 with crate(ws/default) < 0.10.0~)
|
||||
%if %{with check}
|
||||
BuildRequires: (crate(insta/default) >= 1.12.0 with crate(insta/default) < 2.0.0~)
|
||||
BuildRequires: (crate(mockito/default) >= 0.31.0 with crate(mockito/default) < 0.32.0~)
|
||||
BuildRequires: (crate(path-slash/default) >= 0.2.0 with crate(path-slash/default) < 0.3.0~)
|
||||
BuildRequires: (crate(same-file/default) >= 1.0.0 with crate(same-file/default) < 2.0.0~)
|
||||
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
|
||||
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
||||
BuildRequires: (crate(test-case/default) >= 2.0.0 with crate(test-case/default) < 3.0.0~)
|
||||
%endif
|
||||
|
||||
%global _description %{expand:
|
||||
A fast static site generator with everything built-in.}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
%prep
|
||||
%autosetup -n zola-%{version_no_tilde} -p1
|
||||
%cargo_prep
|
||||
|
||||
%build
|
||||
%cargo_build
|
||||
|
||||
%install
|
||||
%cargo_install
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
%cargo_test
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LIC1
|
||||
%license LIC2
|
||||
%doc DOC1
|
||||
%doc DOC2
|
||||
%{_bindir}/zola
|
||||
|
||||
%changelog
|
||||
* Thu Jan 01 1970 Jane Jane <jane@jane.org> - 0.16.1-1
|
||||
- Initial package
|
159
rust2rpm/tests/samples/zola-0.16.1.opensuse.spec
Normal file
159
rust2rpm/tests/samples/zola-0.16.1.opensuse.spec
Normal file
|
@ -0,0 +1,159 @@
|
|||
#
|
||||
# spec file for package zola
|
||||
#
|
||||
# Copyright (c) 2023 Jane Jane <jane@jane.org>.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
# Generated by rust2rpm NNN
|
||||
%bcond_without check
|
||||
|
||||
Name: zola
|
||||
Version: 0.16.1
|
||||
Release: 0
|
||||
Summary: Fast static site generator with everything built-in
|
||||
Group: Development/Libraries/Rust
|
||||
|
||||
License: MIT
|
||||
URL: # FIXME
|
||||
Source: # FIXME
|
||||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: (crate(ahash/default) >= 0.8.0 with crate(ahash/default) < 0.9.0~)
|
||||
BuildRequires: (crate(ammonia/default) >= 3.0.0 with crate(ammonia/default) < 4.0.0~)
|
||||
BuildRequires: (crate(anyhow/default) >= 1.0.56 with crate(anyhow/default) < 2.0.0~)
|
||||
BuildRequires: (crate(atty/default) >= 0.2.11 with crate(atty/default) < 0.3.0~)
|
||||
BuildRequires: (crate(base64/default) >= 0.13.0 with crate(base64/default) < 0.14.0~)
|
||||
BuildRequires: (crate(clap/default) >= 3.0.0 with crate(clap/default) < 4.0.0~)
|
||||
BuildRequires: (crate(clap/derive) >= 3.0.0 with crate(clap/derive) < 4.0.0~)
|
||||
BuildRequires: (crate(clap_complete/default) >= 3.0.0 with crate(clap_complete/default) < 4.0.0~)
|
||||
BuildRequires: (crate(csv/default) >= 1.0.0 with crate(csv/default) < 2.0.0~)
|
||||
BuildRequires: (crate(ctrlc/default) >= 3.0.0 with crate(ctrlc/default) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/da) >= 3.0.0 with crate(elasticlunr-rs/da) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/de) >= 3.0.0 with crate(elasticlunr-rs/de) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/default) >= 3.0.0 with crate(elasticlunr-rs/default) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/du) >= 3.0.0 with crate(elasticlunr-rs/du) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/es) >= 3.0.0 with crate(elasticlunr-rs/es) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/fi) >= 3.0.0 with crate(elasticlunr-rs/fi) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/fr) >= 3.0.0 with crate(elasticlunr-rs/fr) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/it) >= 3.0.0 with crate(elasticlunr-rs/it) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/no) >= 3.0.0 with crate(elasticlunr-rs/no) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/pt) >= 3.0.0 with crate(elasticlunr-rs/pt) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/ro) >= 3.0.0 with crate(elasticlunr-rs/ro) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/ru) >= 3.0.0 with crate(elasticlunr-rs/ru) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/sv) >= 3.0.0 with crate(elasticlunr-rs/sv) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/tr) >= 3.0.0 with crate(elasticlunr-rs/tr) < 4.0.0~)
|
||||
BuildRequires: (crate(filetime/default) >= 0.2.0 with crate(filetime/default) < 0.3.0~)
|
||||
BuildRequires: (crate(gh-emoji/default) >= 1.0.0 with crate(gh-emoji/default) < 2.0.0~)
|
||||
BuildRequires: (crate(glob/default) >= 0.3.0 with crate(glob/default) < 0.4.0~)
|
||||
BuildRequires: (crate(globset/default) >= 0.4.0 with crate(globset/default) < 0.5.0~)
|
||||
BuildRequires: (crate(hyper) >= 0.14.1 with crate(hyper) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/http1) >= 0.14.1 with crate(hyper/http1) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/http2) >= 0.14.1 with crate(hyper/http2) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/runtime) >= 0.14.1 with crate(hyper/runtime) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/server) >= 0.14.1 with crate(hyper/server) < 0.15.0~)
|
||||
BuildRequires: (crate(image/default) >= 0.24.0 with crate(image/default) < 0.25.0~)
|
||||
BuildRequires: (crate(kamadak-exif/default) >= 0.5.4 with crate(kamadak-exif/default) < 0.6.0~)
|
||||
BuildRequires: (crate(lexical-sort/default) >= 0.3.0 with crate(lexical-sort/default) < 0.4.0~)
|
||||
BuildRequires: (crate(mime/default) >= 0.3.16 with crate(mime/default) < 0.4.0~)
|
||||
BuildRequires: (crate(mime_guess/default) >= 2.0.0 with crate(mime_guess/default) < 3.0.0~)
|
||||
BuildRequires: (crate(minify-html/default) >= 0.9.0 with crate(minify-html/default) < 0.10.0~)
|
||||
BuildRequires: (crate(nom-bibtex/default) >= 0.3.0 with crate(nom-bibtex/default) < 0.4.0~)
|
||||
BuildRequires: (crate(notify/default) >= 4.0.0 with crate(notify/default) < 5.0.0~)
|
||||
BuildRequires: (crate(num-format/default) >= 0.4.0 with crate(num-format/default) < 0.5.0~)
|
||||
BuildRequires: (crate(once_cell/default) >= 1.0.0 with crate(once_cell/default) < 2.0.0~)
|
||||
BuildRequires: (crate(open/default) >= 3.0.0 with crate(open/default) < 4.0.0~)
|
||||
BuildRequires: (crate(pathdiff/default) >= 0.2.0 with crate(pathdiff/default) < 0.3.0~)
|
||||
BuildRequires: (crate(percent-encoding/default) >= 2.0.0 with crate(percent-encoding/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pest/default) >= 2.0.0 with crate(pest/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pest_derive/default) >= 2.0.0 with crate(pest_derive/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pulldown-cmark) >= 0.9.0 with crate(pulldown-cmark) < 0.10.0~)
|
||||
BuildRequires: (crate(pulldown-cmark/simd) >= 0.9.0 with crate(pulldown-cmark/simd) < 0.10.0~)
|
||||
BuildRequires: (crate(quickxml_to_serde/default) >= 0.5.0 with crate(quickxml_to_serde/default) < 0.6.0~)
|
||||
BuildRequires: (crate(rayon/default) >= 1.0.0 with crate(rayon/default) < 2.0.0~)
|
||||
BuildRequires: (crate(regex/default) >= 1.0.0 with crate(regex/default) < 2.0.0~)
|
||||
BuildRequires: (crate(relative-path/default) >= 1.0.0 with crate(relative-path/default) < 2.0.0~)
|
||||
BuildRequires: (crate(reqwest) >= 0.11.0 with crate(reqwest) < 0.12.0~)
|
||||
BuildRequires: (crate(reqwest/blocking) >= 0.11.0 with crate(reqwest/blocking) < 0.12.0~)
|
||||
BuildRequires: (crate(reqwest/rustls-tls) >= 0.11.0 with crate(reqwest/rustls-tls) < 0.12.0~)
|
||||
BuildRequires: (crate(sass-rs/default) >= 0.2.0 with crate(sass-rs/default) < 0.3.0~)
|
||||
BuildRequires: (crate(serde/default) >= 1.0.0 with crate(serde/default) < 2.0.0~)
|
||||
BuildRequires: (crate(serde/derive) >= 1.0.0 with crate(serde/derive) < 2.0.0~)
|
||||
BuildRequires: (crate(serde_json/default) >= 1.0.0 with crate(serde_json/default) < 2.0.0~)
|
||||
BuildRequires: (crate(serde_yaml/default) >= 0.9.0 with crate(serde_yaml/default) < 0.10.0~)
|
||||
BuildRequires: (crate(sha2/default) >= 0.10.0 with crate(sha2/default) < 0.11.0~)
|
||||
BuildRequires: (crate(slug/default) >= 0.1.0 with crate(slug/default) < 0.2.0~)
|
||||
BuildRequires: (crate(svg_metadata/default) >= 0.4.0 with crate(svg_metadata/default) < 0.5.0~)
|
||||
BuildRequires: (crate(syntect/default) >= 5.0.0 with crate(syntect/default) < 6.0.0~)
|
||||
BuildRequires: (crate(tera/default) >= 1.0.0 with crate(tera/default) < 2.0.0~)
|
||||
BuildRequires: (crate(tera/preserve_order) >= 1.0.0 with crate(tera/preserve_order) < 2.0.0~)
|
||||
BuildRequires: (crate(termcolor/default) >= 1.0.4 with crate(termcolor/default) < 2.0.0~)
|
||||
BuildRequires: (crate(time/default) >= 0.3.0 with crate(time/default) < 0.4.0~)
|
||||
BuildRequires: (crate(time/formatting) >= 0.3.0 with crate(time/formatting) < 0.4.0~)
|
||||
BuildRequires: (crate(time/local-offset) >= 0.3.0 with crate(time/local-offset) < 0.4.0~)
|
||||
BuildRequires: (crate(time/macros) >= 0.3.0 with crate(time/macros) < 0.4.0~)
|
||||
BuildRequires: (crate(tokio) >= 1.0.1 with crate(tokio) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/fs) >= 1.0.1 with crate(tokio/fs) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/rt) >= 1.0.1 with crate(tokio/rt) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/time) >= 1.0.1 with crate(tokio/time) < 2.0.0~)
|
||||
BuildRequires: (crate(toml/default) >= 0.5.0 with crate(toml/default) < 0.6.0~)
|
||||
BuildRequires: (crate(unic-langid/default) >= 0.9.0 with crate(unic-langid/default) < 0.10.0~)
|
||||
BuildRequires: (crate(unicode-segmentation/default) >= 1.2.0 with crate(unicode-segmentation/default) < 2.0.0~)
|
||||
BuildRequires: (crate(url/default) >= 2.0.0 with crate(url/default) < 3.0.0~)
|
||||
BuildRequires: (crate(walkdir/default) >= 2.0.0 with crate(walkdir/default) < 3.0.0~)
|
||||
BuildRequires: (crate(webp/default) >= 0.2.0 with crate(webp/default) < 0.3.0~)
|
||||
BuildRequires: (crate(winres/default) >= 0.1.0 with crate(winres/default) < 0.2.0~)
|
||||
BuildRequires: (crate(ws/default) >= 0.9.0 with crate(ws/default) < 0.10.0~)
|
||||
%if %{with check}
|
||||
BuildRequires: (crate(insta/default) >= 1.12.0 with crate(insta/default) < 2.0.0~)
|
||||
BuildRequires: (crate(mockito/default) >= 0.31.0 with crate(mockito/default) < 0.32.0~)
|
||||
BuildRequires: (crate(path-slash/default) >= 0.2.0 with crate(path-slash/default) < 0.3.0~)
|
||||
BuildRequires: (crate(same-file/default) >= 1.0.0 with crate(same-file/default) < 2.0.0~)
|
||||
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
|
||||
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
||||
BuildRequires: (crate(test-case/default) >= 2.0.0 with crate(test-case/default) < 3.0.0~)
|
||||
%endif
|
||||
|
||||
%global _description %{expand:
|
||||
A fast static site generator with everything built-in.}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
%prep
|
||||
%autosetup -n zola-%{version_no_tilde} -p1
|
||||
%cargo_prep
|
||||
|
||||
%build
|
||||
%cargo_build
|
||||
|
||||
%install
|
||||
%cargo_install
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
%cargo_test
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LIC1
|
||||
%license LIC2
|
||||
%doc DOC1
|
||||
%doc DOC2
|
||||
%{_bindir}/zola
|
||||
|
||||
%changelog
|
||||
* Thu Jan 01 03:25:45 GMT 1970 Jane Jane <jane@jane.org>
|
||||
- Version 0.16.1
|
||||
- Initial package
|
140
rust2rpm/tests/samples/zola-0.16.1.plain.spec
Normal file
140
rust2rpm/tests/samples/zola-0.16.1.plain.spec
Normal file
|
@ -0,0 +1,140 @@
|
|||
# Generated by rust2rpm NNN
|
||||
%bcond_without check
|
||||
|
||||
Name: zola
|
||||
Version: 0.16.1
|
||||
Release: 1%{?dist}
|
||||
Summary: Fast static site generator with everything built-in
|
||||
|
||||
License: MIT
|
||||
URL: # FIXME
|
||||
Source: # FIXME
|
||||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
|
||||
BuildRequires: rust-packaging >= 21
|
||||
BuildRequires: (crate(ahash/default) >= 0.8.0 with crate(ahash/default) < 0.9.0~)
|
||||
BuildRequires: (crate(ammonia/default) >= 3.0.0 with crate(ammonia/default) < 4.0.0~)
|
||||
BuildRequires: (crate(anyhow/default) >= 1.0.56 with crate(anyhow/default) < 2.0.0~)
|
||||
BuildRequires: (crate(atty/default) >= 0.2.11 with crate(atty/default) < 0.3.0~)
|
||||
BuildRequires: (crate(base64/default) >= 0.13.0 with crate(base64/default) < 0.14.0~)
|
||||
BuildRequires: (crate(clap/default) >= 3.0.0 with crate(clap/default) < 4.0.0~)
|
||||
BuildRequires: (crate(clap/derive) >= 3.0.0 with crate(clap/derive) < 4.0.0~)
|
||||
BuildRequires: (crate(clap_complete/default) >= 3.0.0 with crate(clap_complete/default) < 4.0.0~)
|
||||
BuildRequires: (crate(csv/default) >= 1.0.0 with crate(csv/default) < 2.0.0~)
|
||||
BuildRequires: (crate(ctrlc/default) >= 3.0.0 with crate(ctrlc/default) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/da) >= 3.0.0 with crate(elasticlunr-rs/da) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/de) >= 3.0.0 with crate(elasticlunr-rs/de) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/default) >= 3.0.0 with crate(elasticlunr-rs/default) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/du) >= 3.0.0 with crate(elasticlunr-rs/du) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/es) >= 3.0.0 with crate(elasticlunr-rs/es) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/fi) >= 3.0.0 with crate(elasticlunr-rs/fi) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/fr) >= 3.0.0 with crate(elasticlunr-rs/fr) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/it) >= 3.0.0 with crate(elasticlunr-rs/it) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/no) >= 3.0.0 with crate(elasticlunr-rs/no) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/pt) >= 3.0.0 with crate(elasticlunr-rs/pt) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/ro) >= 3.0.0 with crate(elasticlunr-rs/ro) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/ru) >= 3.0.0 with crate(elasticlunr-rs/ru) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/sv) >= 3.0.0 with crate(elasticlunr-rs/sv) < 4.0.0~)
|
||||
BuildRequires: (crate(elasticlunr-rs/tr) >= 3.0.0 with crate(elasticlunr-rs/tr) < 4.0.0~)
|
||||
BuildRequires: (crate(filetime/default) >= 0.2.0 with crate(filetime/default) < 0.3.0~)
|
||||
BuildRequires: (crate(gh-emoji/default) >= 1.0.0 with crate(gh-emoji/default) < 2.0.0~)
|
||||
BuildRequires: (crate(glob/default) >= 0.3.0 with crate(glob/default) < 0.4.0~)
|
||||
BuildRequires: (crate(globset/default) >= 0.4.0 with crate(globset/default) < 0.5.0~)
|
||||
BuildRequires: (crate(hyper) >= 0.14.1 with crate(hyper) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/http1) >= 0.14.1 with crate(hyper/http1) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/http2) >= 0.14.1 with crate(hyper/http2) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/runtime) >= 0.14.1 with crate(hyper/runtime) < 0.15.0~)
|
||||
BuildRequires: (crate(hyper/server) >= 0.14.1 with crate(hyper/server) < 0.15.0~)
|
||||
BuildRequires: (crate(image/default) >= 0.24.0 with crate(image/default) < 0.25.0~)
|
||||
BuildRequires: (crate(kamadak-exif/default) >= 0.5.4 with crate(kamadak-exif/default) < 0.6.0~)
|
||||
BuildRequires: (crate(lexical-sort/default) >= 0.3.0 with crate(lexical-sort/default) < 0.4.0~)
|
||||
BuildRequires: (crate(mime/default) >= 0.3.16 with crate(mime/default) < 0.4.0~)
|
||||
BuildRequires: (crate(mime_guess/default) >= 2.0.0 with crate(mime_guess/default) < 3.0.0~)
|
||||
BuildRequires: (crate(minify-html/default) >= 0.9.0 with crate(minify-html/default) < 0.10.0~)
|
||||
BuildRequires: (crate(nom-bibtex/default) >= 0.3.0 with crate(nom-bibtex/default) < 0.4.0~)
|
||||
BuildRequires: (crate(notify/default) >= 4.0.0 with crate(notify/default) < 5.0.0~)
|
||||
BuildRequires: (crate(num-format/default) >= 0.4.0 with crate(num-format/default) < 0.5.0~)
|
||||
BuildRequires: (crate(once_cell/default) >= 1.0.0 with crate(once_cell/default) < 2.0.0~)
|
||||
BuildRequires: (crate(open/default) >= 3.0.0 with crate(open/default) < 4.0.0~)
|
||||
BuildRequires: (crate(pathdiff/default) >= 0.2.0 with crate(pathdiff/default) < 0.3.0~)
|
||||
BuildRequires: (crate(percent-encoding/default) >= 2.0.0 with crate(percent-encoding/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pest/default) >= 2.0.0 with crate(pest/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pest_derive/default) >= 2.0.0 with crate(pest_derive/default) < 3.0.0~)
|
||||
BuildRequires: (crate(pulldown-cmark) >= 0.9.0 with crate(pulldown-cmark) < 0.10.0~)
|
||||
BuildRequires: (crate(pulldown-cmark/simd) >= 0.9.0 with crate(pulldown-cmark/simd) < 0.10.0~)
|
||||
BuildRequires: (crate(quickxml_to_serde/default) >= 0.5.0 with crate(quickxml_to_serde/default) < 0.6.0~)
|
||||
BuildRequires: (crate(rayon/default) >= 1.0.0 with crate(rayon/default) < 2.0.0~)
|
||||
BuildRequires: (crate(regex/default) >= 1.0.0 with crate(regex/default) < 2.0.0~)
|
||||
BuildRequires: (crate(relative-path/default) >= 1.0.0 with crate(relative-path/default) < 2.0.0~)
|
||||
BuildRequires: (crate(reqwest) >= 0.11.0 with crate(reqwest) < 0.12.0~)
|
||||
BuildRequires: (crate(reqwest/blocking) >= 0.11.0 with crate(reqwest/blocking) < 0.12.0~)
|
||||
BuildRequires: (crate(reqwest/rustls-tls) >= 0.11.0 with crate(reqwest/rustls-tls) < 0.12.0~)
|
||||
BuildRequires: (crate(sass-rs/default) >= 0.2.0 with crate(sass-rs/default) < 0.3.0~)
|
||||
BuildRequires: (crate(serde/default) >= 1.0.0 with crate(serde/default) < 2.0.0~)
|
||||
BuildRequires: (crate(serde/derive) >= 1.0.0 with crate(serde/derive) < 2.0.0~)
|
||||
BuildRequires: (crate(serde_json/default) >= 1.0.0 with crate(serde_json/default) < 2.0.0~)
|
||||
BuildRequires: (crate(serde_yaml/default) >= 0.9.0 with crate(serde_yaml/default) < 0.10.0~)
|
||||
BuildRequires: (crate(sha2/default) >= 0.10.0 with crate(sha2/default) < 0.11.0~)
|
||||
BuildRequires: (crate(slug/default) >= 0.1.0 with crate(slug/default) < 0.2.0~)
|
||||
BuildRequires: (crate(svg_metadata/default) >= 0.4.0 with crate(svg_metadata/default) < 0.5.0~)
|
||||
BuildRequires: (crate(syntect/default) >= 5.0.0 with crate(syntect/default) < 6.0.0~)
|
||||
BuildRequires: (crate(tera/default) >= 1.0.0 with crate(tera/default) < 2.0.0~)
|
||||
BuildRequires: (crate(tera/preserve_order) >= 1.0.0 with crate(tera/preserve_order) < 2.0.0~)
|
||||
BuildRequires: (crate(termcolor/default) >= 1.0.4 with crate(termcolor/default) < 2.0.0~)
|
||||
BuildRequires: (crate(time/default) >= 0.3.0 with crate(time/default) < 0.4.0~)
|
||||
BuildRequires: (crate(time/formatting) >= 0.3.0 with crate(time/formatting) < 0.4.0~)
|
||||
BuildRequires: (crate(time/local-offset) >= 0.3.0 with crate(time/local-offset) < 0.4.0~)
|
||||
BuildRequires: (crate(time/macros) >= 0.3.0 with crate(time/macros) < 0.4.0~)
|
||||
BuildRequires: (crate(tokio) >= 1.0.1 with crate(tokio) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/fs) >= 1.0.1 with crate(tokio/fs) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/rt) >= 1.0.1 with crate(tokio/rt) < 2.0.0~)
|
||||
BuildRequires: (crate(tokio/time) >= 1.0.1 with crate(tokio/time) < 2.0.0~)
|
||||
BuildRequires: (crate(toml/default) >= 0.5.0 with crate(toml/default) < 0.6.0~)
|
||||
BuildRequires: (crate(unic-langid/default) >= 0.9.0 with crate(unic-langid/default) < 0.10.0~)
|
||||
BuildRequires: (crate(unicode-segmentation/default) >= 1.2.0 with crate(unicode-segmentation/default) < 2.0.0~)
|
||||
BuildRequires: (crate(url/default) >= 2.0.0 with crate(url/default) < 3.0.0~)
|
||||
BuildRequires: (crate(walkdir/default) >= 2.0.0 with crate(walkdir/default) < 3.0.0~)
|
||||
BuildRequires: (crate(webp/default) >= 0.2.0 with crate(webp/default) < 0.3.0~)
|
||||
BuildRequires: (crate(winres/default) >= 0.1.0 with crate(winres/default) < 0.2.0~)
|
||||
BuildRequires: (crate(ws/default) >= 0.9.0 with crate(ws/default) < 0.10.0~)
|
||||
%if %{with check}
|
||||
BuildRequires: (crate(insta/default) >= 1.12.0 with crate(insta/default) < 2.0.0~)
|
||||
BuildRequires: (crate(mockito/default) >= 0.31.0 with crate(mockito/default) < 0.32.0~)
|
||||
BuildRequires: (crate(path-slash/default) >= 0.2.0 with crate(path-slash/default) < 0.3.0~)
|
||||
BuildRequires: (crate(same-file/default) >= 1.0.0 with crate(same-file/default) < 2.0.0~)
|
||||
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
|
||||
BuildRequires: (crate(tempfile/default) >= 3.3.0 with crate(tempfile/default) < 4.0.0~)
|
||||
BuildRequires: (crate(test-case/default) >= 2.0.0 with crate(test-case/default) < 3.0.0~)
|
||||
%endif
|
||||
|
||||
%global _description %{expand:
|
||||
A fast static site generator with everything built-in.}
|
||||
|
||||
%description %{_description}
|
||||
|
||||
%prep
|
||||
%autosetup -n zola-%{version_no_tilde} -p1
|
||||
%cargo_prep
|
||||
|
||||
%build
|
||||
%cargo_build
|
||||
|
||||
%install
|
||||
%cargo_install
|
||||
|
||||
%if %{with check}
|
||||
%check
|
||||
%cargo_test
|
||||
%endif
|
||||
|
||||
%files
|
||||
%license LIC1
|
||||
%license LIC2
|
||||
%doc DOC1
|
||||
%doc DOC2
|
||||
%{_bindir}/zola
|
||||
|
||||
%changelog
|
||||
* Thu Jan 01 1970 Jane Jane <jane@jane.org> - 0.16.1-1
|
||||
- Initial package
|
|
@ -8,7 +8,7 @@ from cargo2rpm.metadata import Metadata, FeatureFlags
|
|||
import pytest
|
||||
|
||||
from rust2rpm.cli import get_parser
|
||||
from rust2rpm.generator import to_list, spec_render_crate
|
||||
from rust2rpm.generator import to_list, spec_render_crate, spec_render_workspace
|
||||
from rust2rpm.patching import drop_foreign_dependencies
|
||||
from rust2rpm.utils import package_name_suffixed
|
||||
|
||||
|
@ -33,7 +33,7 @@ FIXED_DATE = time.gmtime(12345)
|
|||
|
||||
@pytest.mark.parametrize("filename", ["cxx-build-1.0.71.json", "nix-0.24.1.json", "tokio-1.19.2.json"])
|
||||
@pytest.mark.parametrize("target", ["plain", "fedora", "mageia", "opensuse"])
|
||||
def test_spec_file_render(filename: str, target: str, tmp_path: Path):
|
||||
def test_spec_file_render_crate(filename: str, target: str, tmp_path: Path):
|
||||
crate_name_version = filename.removesuffix(".json")
|
||||
crate = crate_name_version.rsplit("-", 1)[0]
|
||||
|
||||
|
@ -45,30 +45,67 @@ def test_spec_file_render(filename: str, target: str, tmp_path: Path):
|
|||
|
||||
rendered = spec_render_crate(
|
||||
target=target,
|
||||
auto_changelog_entry=True,
|
||||
rpmautospec=target == "fedora",
|
||||
relative_license_paths=False,
|
||||
rpm_name=rpm_name,
|
||||
metadata=metadata,
|
||||
rpm_name=rpm_name,
|
||||
patch_file_automatic=f"{crate}-patch1.diff",
|
||||
patch_file_manual=f"{crate}-patch2.diff",
|
||||
packager="Jane Jane <jane@jane.org>",
|
||||
doc_files=["DOC1", "DOC2"],
|
||||
license_files=["LIC1", "LIC2"],
|
||||
doc_files=["DOC1", "DOC2"],
|
||||
distconf={},
|
||||
feature_flags=FeatureFlags(),
|
||||
relative_license_paths=False,
|
||||
rpmautospec=target == "fedora",
|
||||
auto_changelog_entry=True,
|
||||
date=FIXED_DATE,
|
||||
packager="Jane Jane <jane@jane.org>",
|
||||
)
|
||||
|
||||
rendered = re.sub("(# Generated by rust2rpm) .*", r"\1 NNN", rendered)
|
||||
|
||||
fixture_path = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec")
|
||||
|
||||
if os.getenv("UPDATE_FIXTURES") == "1":
|
||||
# helper mode to create test data
|
||||
path = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec")
|
||||
path.write_text(rendered)
|
||||
fixture_path.write_text(rendered)
|
||||
|
||||
else:
|
||||
expected = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec").read_text()
|
||||
expected = fixture_path.read_text()
|
||||
assert rendered == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("filename", ["zola-0.16.1.json"])
|
||||
@pytest.mark.parametrize("target", ["plain", "fedora", "mageia", "opensuse"])
|
||||
def test_spec_file_render_workspace(filename: str, target: str, tmp_path: Path):
|
||||
crate_name_version = filename.removesuffix(".json")
|
||||
crate = crate_name_version.rsplit("-", 1)[0]
|
||||
|
||||
real_path = resources.files("rust2rpm.tests.samples").joinpath(filename)
|
||||
metadata = Metadata.from_json(real_path.read_text())
|
||||
|
||||
rendered = spec_render_workspace(
|
||||
metadata=metadata,
|
||||
target=target,
|
||||
rpm_name=crate,
|
||||
license_files=["LIC1", "LIC2"],
|
||||
doc_files=["DOC1", "DOC2"],
|
||||
distconf={},
|
||||
feature_flags=FeatureFlags(),
|
||||
rpmautospec=target == "fedora",
|
||||
auto_changelog_entry=True,
|
||||
date=FIXED_DATE,
|
||||
packager="Jane Jane <jane@jane.org>",
|
||||
)
|
||||
|
||||
rendered = re.sub("(# Generated by rust2rpm) .*", r"\1 NNN", rendered)
|
||||
|
||||
fixture_path = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec")
|
||||
|
||||
if os.getenv("UPDATE_FIXTURES") == "1":
|
||||
# helper mode to create test data
|
||||
fixture_path.write_text(rendered)
|
||||
|
||||
else:
|
||||
expected = fixture_path.read_text()
|
||||
assert rendered == expected
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue