wire up support for non-crate non-workspace projects and minor fixes

This commit is contained in:
Fabio Valentini 2023-10-06 17:50:30 +02:00
parent 97ae81977d
commit d1bb5c3cfc
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
9 changed files with 431 additions and 14 deletions

View file

@ -11,7 +11,7 @@ from rust2rpm.conf import load_config
from rust2rpm.crate import process_project
from rust2rpm.cratesio import NoVersionsError
from rust2rpm.distgit import get_package_info
from rust2rpm.generator import spec_render_crate, spec_render_workspace
from rust2rpm.generator import spec_render_crate, spec_render_project, spec_render_workspace
from rust2rpm.licensing import dump_sdpx_to_fedora_map, translate_license
from rust2rpm.metadata import guess_main_package, warn_if_package_uses_restrictive_dependencies
from rust2rpm.utils import (
@ -47,7 +47,7 @@ def main():
parser.error("crate/path argument missing and autodetection failed")
try:
project, version, diffs, metadata, doc_files, license_files = process_project(
project, version, diffs, metadata, doc_files, license_files, is_local = process_project(
args.crate, args.version, args.patch, args.patch_foreign, args.store_crate
)
except NoVersionsError:
@ -57,6 +57,11 @@ def main():
if metadata.is_workspace():
base_name = project
rpm_name = project
elif is_local:
base_name = metadata.packages[0].name
rpm_name = base_name
else:
base_name = metadata.packages[0].name
@ -99,7 +104,8 @@ def main():
else:
tomlconf = load_config(set(), args.target)
if not metadata.is_workspace():
# package for an actual Rust crate
if not metadata.is_workspace() and not is_local:
package = metadata.packages[0]
if build_meta := Version.parse(package.version).build:
@ -126,6 +132,34 @@ def main():
packager=packager,
)
# package for non-crate, non-workspace project
elif not metadata.is_workspace() and is_local:
package = metadata.packages[0]
if build_meta := Version.parse(package.version).build:
log.error(f"Crate version {package.version!r} contains build metadata: '+{build_meta}'")
log.error(f"This is not supported by rust2rpm; remove the '+{build_meta}' suffix.")
sys.exit(1)
warn_if_package_uses_restrictive_dependencies(package)
spec_contents = spec_render_project(
metadata=metadata,
upstream_version=version,
target=args.target,
rpm_name=rpm_name,
patch_file_automatic=patch_files[0],
patch_file_manual=patch_files[1],
license_files=license_files,
doc_files=doc_files,
tomlconf=tomlconf,
feature_flags=FeatureFlags(all_features=args.all_features),
rpmautospec=args.rpmautospec,
auto_changelog_entry=args.auto_changelog_entry,
packager=packager,
)
# package for a workspace project
else:
try:
main_package = guess_main_package(metadata, hint=project, interactive=args.interactive)

View file

@ -191,8 +191,8 @@ def process_project_local(
with toml_temp_copy(toml_path) as temp_toml:
diffs = make_patches(name, package.version, patch, patch_foreign, temp_toml, features)
# ensure metadata is up-to-date with changes from patches
metadata = Metadata.from_cargo(toml_path)
# ensure metadata is up-to-date with changes from patches
metadata = Metadata.from_cargo(temp_toml)
return name, version, diffs, metadata, doc_files, license_files
@ -233,14 +233,14 @@ def process_project(
patch: bool,
patch_foreign: bool,
store_crate: bool,
) -> tuple[str, str, tuple[Optional[list[str]], Optional[list[str]]], Metadata, list[str], list[str]]:
) -> tuple[str, str, tuple[Optional[list[str]], Optional[list[str]]], Metadata, list[str], list[str], bool]:
if project_is_path(project) and not project.endswith(".crate"):
# project points into unpacked sources:
if store_crate:
raise ValueError("The '--store-crate' / '-s' flag cannot be used for unpacked sources.")
# process unpacked sources
return process_project_local(project, patch, patch_foreign)
return (*process_project_local(project, patch, patch_foreign), True)
if project_is_path(project) and project.endswith(".crate"):
# project points at a local .crate file
@ -287,4 +287,4 @@ def process_project(
# ensure metadata is up-to-date with changes from patches
metadata = Metadata.from_cargo(toml_path)
return name, version, diffs, metadata, doc_files, license_files
return name, version, diffs, metadata, doc_files, license_files, False

View file

@ -385,7 +385,7 @@ def spec_render_project(
"rpm_version": Version.parse(package.version).to_rpm(),
"rpm_summary": tomlconf.package_summary or summary,
"rpm_description": tomlconf.package_description or description,
"rpm_url": package.homepage or package.repository or "# FIXME",
"rpm_url": package.repository or package.homepage or "# FIXME",
"rpm_license": rpm_license,
"rpm_license_comments": rpm_license_comments,
"rpm_patch_file_automatic": patch_file_automatic,
@ -440,7 +440,6 @@ def spec_render_project(
def spec_render_workspace(
*,
metadata: Metadata,
upstream_version: str,
main_package: Package,
target: str,
rpm_name: str,
@ -461,7 +460,9 @@ def spec_render_workspace(
is_cdylib = metadata.is_cdylib()
rpm_version = Version.parse(main_package.version).to_rpm()
upstream_version = main_package.version
rpm_version = Version.parse(upstream_version).to_rpm()
rpm_description = main_package.get_description()
rpm_summary = main_package.get_summary()

View file

@ -0,0 +1,62 @@
# Generated by rust2rpm NNN
%bcond_without check
# prevent library files from being installed
%global __cargo_is_lib() 0
%global crate stgit
Name: stgit
Version: 2.3.3
Release: %autorelease
Summary: Stack-based patch management for Git
SourceLicense: GPL-2.0-only
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: https://github.com/stacked-git/stgit
Source: # FIXME
# Automatically generated patch to strip dependencies and normalize metadata
Patch: stgit-patch1.diff
# Manually created patch for downstream crate metadata changes
Patch: stgit-patch2.diff
BuildRequires: cargo-rpm-macros >= 24
%global _description %{expand:
Stack-based patch management for Git.}
%description %{_description}
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/stg
%changelog
%autochangelog

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,102 @@
# Generated by rust2rpm NNN
%bcond_without check
# prevent library files from being installed
%global __cargo_is_lib() 0
%global crate stgit
Name: stgit
Version: 2.3.3
Release: %mkrel 1
Summary: Stack-based patch management for Git
Group: Development/Rust
# Upstream license specification: GPL-2.0-only
SourceLicense: GPLv2
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: https://github.com/stacked-git/stgit
Source: # FIXME
# Automatically generated patch to strip dependencies and normalize metadata
Patch: stgit-patch1.diff
# Manually created patch for downstream crate metadata changes
Patch: stgit-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: cargo-rpm-macros >= 24
BuildRequires: (crate(anstyle/default) >= 1.0.0 with crate(anstyle/default) < 2.0.0~)
BuildRequires: (crate(anstyle/std) >= 1.0.0 with crate(anstyle/std) < 2.0.0~)
BuildRequires: (crate(anyhow/default) >= 1.0.0 with crate(anyhow/default) < 2.0.0~)
BuildRequires: (crate(bstr) >= 1.6.0 with crate(bstr) < 2.0.0~)
BuildRequires: (crate(bstr/std) >= 1.6.0 with crate(bstr/std) < 2.0.0~)
BuildRequires: (crate(bzip2-rs/default) >= 0.1.0 with crate(bzip2-rs/default) < 0.2.0~)
BuildRequires: (crate(clap) >= 4.4.0 with crate(clap) < 4.5.0~)
BuildRequires: (crate(clap/color) >= 4.4.0 with crate(clap/color) < 4.5.0~)
BuildRequires: (crate(clap/help) >= 4.4.0 with crate(clap/help) < 4.5.0~)
BuildRequires: (crate(clap/std) >= 4.4.0 with crate(clap/std) < 4.5.0~)
BuildRequires: (crate(clap/string) >= 4.4.0 with crate(clap/string) < 4.5.0~)
BuildRequires: (crate(clap/suggestions) >= 4.4.0 with crate(clap/suggestions) < 4.5.0~)
BuildRequires: (crate(clap/usage) >= 4.4.0 with crate(clap/usage) < 4.5.0~)
BuildRequires: (crate(clap/wrap_help) >= 4.4.0 with crate(clap/wrap_help) < 4.5.0~)
BuildRequires: (crate(ctrlc/default) >= 3.4.0 with crate(ctrlc/default) < 4.0.0~)
BuildRequires: (crate(curl/default) >= 0.4.0 with crate(curl/default) < 0.5.0~)
BuildRequires: (crate(encoding_rs/default) >= 0.8.0 with crate(encoding_rs/default) < 0.9.0~)
BuildRequires: (crate(flate2/default) >= 1.0.0 with crate(flate2/default) < 2.0.0~)
BuildRequires: (crate(gix) >= 0.54.0 with crate(gix) < 0.55.0~)
BuildRequires: (crate(gix/revision) >= 0.54.0 with crate(gix/revision) < 0.55.0~)
BuildRequires: (crate(indexmap/default) >= 2.0.0 with crate(indexmap/default) < 3.0.0~)
BuildRequires: (crate(is-terminal/default) >= 0.4.0 with crate(is-terminal/default) < 0.5.0~)
BuildRequires: (crate(nom) >= 7.0.0 with crate(nom) < 8.0.0~)
BuildRequires: (crate(nom/std) >= 7.0.0 with crate(nom/std) < 8.0.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(strsim/default) >= 0.10.0 with crate(strsim/default) < 0.11.0~)
BuildRequires: (crate(tar/default) >= 0.4.0 with crate(tar/default) < 0.5.0~)
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
BuildRequires: (crate(termcolor/default) >= 1.1.0 with crate(termcolor/default) < 2.0.0~)
BuildRequires: (crate(thiserror/default) >= 1.0.0 with crate(thiserror/default) < 1.1.0~)
BuildRequires: (crate(time) >= 0.3.23 with crate(time) < 0.4.0~)
BuildRequires: (crate(time/formatting) >= 0.3.23 with crate(time/formatting) < 0.4.0~)
BuildRequires: (crate(time/local-offset) >= 0.3.23 with crate(time/local-offset) < 0.4.0~)
BuildRequires: (crate(time/macros) >= 0.3.23 with crate(time/macros) < 0.4.0~)
BuildRequires: (crate(time/parsing) >= 0.3.23 with crate(time/parsing) < 0.4.0~)
BuildRequires: rust >= 1.67.1
%global _description %{expand:
Stack-based patch management for Git.}
%description %{_description}
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/stg
%changelog
* Thu Jan 01 1970 Jane Jane <jane@jane.org> - 2.3.3-1
- Initial package

View file

@ -0,0 +1,119 @@
#
# spec file for package stgit
#
# Copyright (c) XXXX 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
# prevent library files from being installed
%global __cargo_is_lib() 0
%global crate stgit
Name: stgit
Version: 2.3.3
Release: 0
Summary: Stack-based patch management for Git
Group: Development/Libraries/Rust
SourceLicense: GPL-2.0-only
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: https://github.com/stacked-git/stgit
Source: # FIXME
# Automatically generated patch to strip dependencies and normalize metadata
Patch: stgit-patch1.diff
# PATCH-FIX-OPENSUSE stgit-patch2.diff — Manually created patch for downstream crate metadata changes
Patch: stgit-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: cargo-rpm-macros >= 24
BuildRequires: (crate(anstyle/default) >= 1.0.0 with crate(anstyle/default) < 2.0.0~)
BuildRequires: (crate(anstyle/std) >= 1.0.0 with crate(anstyle/std) < 2.0.0~)
BuildRequires: (crate(anyhow/default) >= 1.0.0 with crate(anyhow/default) < 2.0.0~)
BuildRequires: (crate(bstr) >= 1.6.0 with crate(bstr) < 2.0.0~)
BuildRequires: (crate(bstr/std) >= 1.6.0 with crate(bstr/std) < 2.0.0~)
BuildRequires: (crate(bzip2-rs/default) >= 0.1.0 with crate(bzip2-rs/default) < 0.2.0~)
BuildRequires: (crate(clap) >= 4.4.0 with crate(clap) < 4.5.0~)
BuildRequires: (crate(clap/color) >= 4.4.0 with crate(clap/color) < 4.5.0~)
BuildRequires: (crate(clap/help) >= 4.4.0 with crate(clap/help) < 4.5.0~)
BuildRequires: (crate(clap/std) >= 4.4.0 with crate(clap/std) < 4.5.0~)
BuildRequires: (crate(clap/string) >= 4.4.0 with crate(clap/string) < 4.5.0~)
BuildRequires: (crate(clap/suggestions) >= 4.4.0 with crate(clap/suggestions) < 4.5.0~)
BuildRequires: (crate(clap/usage) >= 4.4.0 with crate(clap/usage) < 4.5.0~)
BuildRequires: (crate(clap/wrap_help) >= 4.4.0 with crate(clap/wrap_help) < 4.5.0~)
BuildRequires: (crate(ctrlc/default) >= 3.4.0 with crate(ctrlc/default) < 4.0.0~)
BuildRequires: (crate(curl/default) >= 0.4.0 with crate(curl/default) < 0.5.0~)
BuildRequires: (crate(encoding_rs/default) >= 0.8.0 with crate(encoding_rs/default) < 0.9.0~)
BuildRequires: (crate(flate2/default) >= 1.0.0 with crate(flate2/default) < 2.0.0~)
BuildRequires: (crate(gix) >= 0.54.0 with crate(gix) < 0.55.0~)
BuildRequires: (crate(gix/revision) >= 0.54.0 with crate(gix/revision) < 0.55.0~)
BuildRequires: (crate(indexmap/default) >= 2.0.0 with crate(indexmap/default) < 3.0.0~)
BuildRequires: (crate(is-terminal/default) >= 0.4.0 with crate(is-terminal/default) < 0.5.0~)
BuildRequires: (crate(nom) >= 7.0.0 with crate(nom) < 8.0.0~)
BuildRequires: (crate(nom/std) >= 7.0.0 with crate(nom/std) < 8.0.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(strsim/default) >= 0.10.0 with crate(strsim/default) < 0.11.0~)
BuildRequires: (crate(tar/default) >= 0.4.0 with crate(tar/default) < 0.5.0~)
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
BuildRequires: (crate(termcolor/default) >= 1.1.0 with crate(termcolor/default) < 2.0.0~)
BuildRequires: (crate(thiserror/default) >= 1.0.0 with crate(thiserror/default) < 1.1.0~)
BuildRequires: (crate(time) >= 0.3.23 with crate(time) < 0.4.0~)
BuildRequires: (crate(time/formatting) >= 0.3.23 with crate(time/formatting) < 0.4.0~)
BuildRequires: (crate(time/local-offset) >= 0.3.23 with crate(time/local-offset) < 0.4.0~)
BuildRequires: (crate(time/macros) >= 0.3.23 with crate(time/macros) < 0.4.0~)
BuildRequires: (crate(time/parsing) >= 0.3.23 with crate(time/parsing) < 0.4.0~)
BuildRequires: rust >= 1.67.1
%global _description %{expand:
Stack-based patch management for Git.}
%description %{_description}
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/stg
%changelog
* Thu Jan 01 03:25:45 GMT 1970 Jane Jane <jane@jane.org>
- Version 2.3.3
- Initial package

View file

@ -0,0 +1,100 @@
# Generated by rust2rpm NNN
%bcond_without check
# prevent library files from being installed
%global __cargo_is_lib() 0
%global crate stgit
Name: stgit
Version: 2.3.3
Release: 1%{?dist}
Summary: Stack-based patch management for Git
SourceLicense: GPL-2.0-only
# FIXME: paste output of %%cargo_license_summary here
License: # FIXME
# LICENSE.dependencies contains a full license breakdown
URL: https://github.com/stacked-git/stgit
Source: # FIXME
# Automatically generated patch to strip dependencies and normalize metadata
Patch: stgit-patch1.diff
# Manually created patch for downstream crate metadata changes
Patch: stgit-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: cargo-rpm-macros >= 24
BuildRequires: (crate(anstyle/default) >= 1.0.0 with crate(anstyle/default) < 2.0.0~)
BuildRequires: (crate(anstyle/std) >= 1.0.0 with crate(anstyle/std) < 2.0.0~)
BuildRequires: (crate(anyhow/default) >= 1.0.0 with crate(anyhow/default) < 2.0.0~)
BuildRequires: (crate(bstr) >= 1.6.0 with crate(bstr) < 2.0.0~)
BuildRequires: (crate(bstr/std) >= 1.6.0 with crate(bstr/std) < 2.0.0~)
BuildRequires: (crate(bzip2-rs/default) >= 0.1.0 with crate(bzip2-rs/default) < 0.2.0~)
BuildRequires: (crate(clap) >= 4.4.0 with crate(clap) < 4.5.0~)
BuildRequires: (crate(clap/color) >= 4.4.0 with crate(clap/color) < 4.5.0~)
BuildRequires: (crate(clap/help) >= 4.4.0 with crate(clap/help) < 4.5.0~)
BuildRequires: (crate(clap/std) >= 4.4.0 with crate(clap/std) < 4.5.0~)
BuildRequires: (crate(clap/string) >= 4.4.0 with crate(clap/string) < 4.5.0~)
BuildRequires: (crate(clap/suggestions) >= 4.4.0 with crate(clap/suggestions) < 4.5.0~)
BuildRequires: (crate(clap/usage) >= 4.4.0 with crate(clap/usage) < 4.5.0~)
BuildRequires: (crate(clap/wrap_help) >= 4.4.0 with crate(clap/wrap_help) < 4.5.0~)
BuildRequires: (crate(ctrlc/default) >= 3.4.0 with crate(ctrlc/default) < 4.0.0~)
BuildRequires: (crate(curl/default) >= 0.4.0 with crate(curl/default) < 0.5.0~)
BuildRequires: (crate(encoding_rs/default) >= 0.8.0 with crate(encoding_rs/default) < 0.9.0~)
BuildRequires: (crate(flate2/default) >= 1.0.0 with crate(flate2/default) < 2.0.0~)
BuildRequires: (crate(gix) >= 0.54.0 with crate(gix) < 0.55.0~)
BuildRequires: (crate(gix/revision) >= 0.54.0 with crate(gix/revision) < 0.55.0~)
BuildRequires: (crate(indexmap/default) >= 2.0.0 with crate(indexmap/default) < 3.0.0~)
BuildRequires: (crate(is-terminal/default) >= 0.4.0 with crate(is-terminal/default) < 0.5.0~)
BuildRequires: (crate(nom) >= 7.0.0 with crate(nom) < 8.0.0~)
BuildRequires: (crate(nom/std) >= 7.0.0 with crate(nom/std) < 8.0.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(strsim/default) >= 0.10.0 with crate(strsim/default) < 0.11.0~)
BuildRequires: (crate(tar/default) >= 0.4.0 with crate(tar/default) < 0.5.0~)
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
BuildRequires: (crate(termcolor/default) >= 1.1.0 with crate(termcolor/default) < 2.0.0~)
BuildRequires: (crate(thiserror/default) >= 1.0.0 with crate(thiserror/default) < 1.1.0~)
BuildRequires: (crate(time) >= 0.3.23 with crate(time) < 0.4.0~)
BuildRequires: (crate(time/formatting) >= 0.3.23 with crate(time/formatting) < 0.4.0~)
BuildRequires: (crate(time/local-offset) >= 0.3.23 with crate(time/local-offset) < 0.4.0~)
BuildRequires: (crate(time/macros) >= 0.3.23 with crate(time/macros) < 0.4.0~)
BuildRequires: (crate(time/parsing) >= 0.3.23 with crate(time/parsing) < 0.4.0~)
BuildRequires: rust >= 1.67.1
%global _description %{expand:
Stack-based patch management for Git.}
%description %{_description}
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%files
%license LIC1
%license LIC2
%license LICENSE.dependencies
%doc DOC1
%doc DOC2
%{_bindir}/stg
%changelog
* Thu Jan 01 1970 Jane Jane <jane@jane.org> - 2.3.3-1
- Initial package

View file

@ -78,7 +78,7 @@ def test_spec_file_render_crate(filename: str, target: str):
assert rendered == expected
@pytest.mark.parametrize("filename", ["rust2rpm-helper-0.1.3.json"])
@pytest.mark.parametrize("filename", ["rust2rpm-helper-0.1.3.json", "stgit-2.3.3.json"])
@pytest.mark.parametrize("target", ["plain", "fedora", "mageia", "opensuse"])
def test_spec_file_render_project(filename: str, target: str):
crate_name_version = filename.removesuffix(".json")
@ -128,14 +128,12 @@ 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,