diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index f989986..bc6d240 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -117,6 +117,7 @@ def main(): spec_contents = spec_render_workspace( metadata=metadata, main_package=main_package, + upstream_version=version, target=args.target, rpm_name=rpm_name, license_files=license_files, diff --git a/rust2rpm/generator.py b/rust2rpm/generator.py index 6e34db2..95b60b7 100644 --- a/rust2rpm/generator.py +++ b/rust2rpm/generator.py @@ -512,6 +512,7 @@ def spec_render_workspace( *, metadata: Metadata, main_package: Package, + upstream_version: str, target: str, rpm_name: str, license_files: list[str], @@ -532,9 +533,7 @@ def spec_render_workspace( is_cdylib = metadata.is_cdylib() - 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() diff --git a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.fedora.spec b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.fedora.spec index 0203686..8d06ab9 100644 --- a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.fedora.spec +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.fedora.spec @@ -2,7 +2,7 @@ %bcond_without check Name: system76-keyboard-configurator -Version: 0.1.0 +Version: 1.3.9 Release: %autorelease Summary: # FIXME diff --git a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.mageia.spec b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.mageia.spec index 56de809..eaabbc7 100644 --- a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.mageia.spec +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.mageia.spec @@ -2,7 +2,7 @@ %bcond_without check Name: system76-keyboard-configurator -Version: 0.1.0 +Version: 1.3.9 Release: %mkrel 1 Summary: # FIXME Group: Development/Rust @@ -88,5 +88,5 @@ BuildRequires: (crate(zbus/default) >= 1.9.1 with crate(zbus/default) < 2.0.0~) %{_bindir}/system76-keyboard-configurator %changelog -* Thu Jan 01 1970 Jane Jane - 0.1.0-1 +* Thu Jan 01 1970 Jane Jane - 1.3.9-1 - Initial package diff --git a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.opensuse.spec b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.opensuse.spec index 5a71f9e..f115d40 100644 --- a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.opensuse.spec +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.opensuse.spec @@ -19,7 +19,7 @@ %bcond_without check Name: system76-keyboard-configurator -Version: 0.1.0 +Version: 1.3.9 Release: 0 Summary: # FIXME Group: Development/Libraries/Rust @@ -106,5 +106,5 @@ BuildRequires: (crate(zbus/default) >= 1.9.1 with crate(zbus/default) < 2.0.0~) %changelog * Thu Jan 01 03:25:45 GMT 1970 Jane Jane -- Version 0.1.0 +- Version 1.3.9 - Initial package diff --git a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.plain.spec b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.plain.spec index 7fd156f..6220482 100644 --- a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.plain.spec +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.plain.spec @@ -2,7 +2,7 @@ %bcond_without check Name: system76-keyboard-configurator -Version: 0.1.0 +Version: 1.3.9 Release: 1%{?dist} Summary: # FIXME @@ -87,5 +87,5 @@ BuildRequires: (crate(zbus/default) >= 1.9.1 with crate(zbus/default) < 2.0.0~) %{_bindir}/system76-keyboard-configurator %changelog -* Thu Jan 01 1970 Jane Jane - 0.1.0-1 +* Thu Jan 01 1970 Jane Jane - 1.3.9-1 - Initial package diff --git a/rust2rpm/tests/test_generator.py b/rust2rpm/tests/test_generator.py index d7f13f5..19ff236 100644 --- a/rust2rpm/tests/test_generator.py +++ b/rust2rpm/tests/test_generator.py @@ -156,6 +156,7 @@ def test_spec_file_render_project(filename: str, vendor_tarball: Optional[str], def test_spec_file_render_workspace(filename: str, vendor_tarball: Optional[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()) @@ -163,6 +164,7 @@ def test_spec_file_render_workspace(filename: str, vendor_tarball: Optional[str] rendered = spec_render_workspace( metadata=metadata, main_package=guess_main_package(metadata), + upstream_version=version, target=target, rpm_name=crate, license_files=["LIC1", "LIC2"],