From 0c274e9de7be6248bd6109a2af92a08adfd6c1f2 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sun, 8 Oct 2023 14:32:58 +0200 Subject: [PATCH] add support for automatically generating and using a vendor tarball --- rust2rpm/__main__.py | 7 +- rust2rpm/cli.py | 6 + rust2rpm/crate.py | 46 ++++++-- rust2rpm/generator.py | 44 +++++-- rust2rpm/templates/crate.spec | 21 +++- rust2rpm/templates/project.spec | 21 +++- rust2rpm/templates/workspace.spec | 19 ++- .../tests/samples/stgit-2.3.3.fedora.spec | 12 +- .../tests/samples/stgit-2.3.3.mageia.spec | 47 +------- .../tests/samples/stgit-2.3.3.opensuse.spec | 47 +------- rust2rpm/tests/samples/stgit-2.3.3.plain.spec | 47 +------- ...76-keyboard-configurator-1.3.9.fedora.spec | 55 +++++++++ .../system76-keyboard-configurator-1.3.9.json | 1 + ...76-keyboard-configurator-1.3.9.mageia.spec | 92 +++++++++++++++ ...-keyboard-configurator-1.3.9.opensuse.spec | 110 ++++++++++++++++++ ...m76-keyboard-configurator-1.3.9.plain.spec | 91 +++++++++++++++ .../tests/samples/zola-0.16.1.fedora.spec | 12 +- .../tests/samples/zola-0.16.1.mageia.spec | 103 +--------------- .../tests/samples/zola-0.16.1.opensuse.spec | 103 +--------------- rust2rpm/tests/samples/zola-0.16.1.plain.spec | 103 +--------------- rust2rpm/tests/test_generator.py | 24 +++- rust2rpm/vendor.py | 26 +++++ 22 files changed, 569 insertions(+), 468 deletions(-) create mode 100644 rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.fedora.spec create mode 100644 rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.json create mode 100644 rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.mageia.spec create mode 100644 rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.opensuse.spec create mode 100644 rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.plain.spec create mode 100644 rust2rpm/vendor.py diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index e8bf34c..54f10e1 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -47,8 +47,8 @@ def main(): parser.error("crate/path argument missing and autodetection failed") try: - project, version, diffs, metadata, doc_files, license_files, is_local = process_project( - args.crate, args.version, args.patch, args.patch_foreign, args.store_crate + project, version, diffs, metadata, doc_files, license_files, is_local, vendor_tarball = process_project( + args.crate, args.version, args.patch, args.patch_foreign, args.store_crate, args.vendor ) except NoVersionsError: log.error(f"No versions are available for crate {args.crate!r}.") @@ -118,6 +118,7 @@ def main(): rpm_name=rpm_name, license_files=license_files, doc_files=doc_files, + vendor_tarball=vendor_tarball, tomlconf=tomlconf, feature_flags=FeatureFlags(all_features=args.all_features), rpmautospec=args.rpmautospec, @@ -145,6 +146,7 @@ def main(): patch_file_manual=patch_files[1], license_files=license_files, doc_files=doc_files, + vendor_tarball=vendor_tarball, tomlconf=tomlconf, feature_flags=FeatureFlags(all_features=args.all_features), rpmautospec=args.rpmautospec, @@ -172,6 +174,7 @@ def main(): patch_file_manual=patch_files[1], license_files=license_files, doc_files=doc_files, + vendor_tarball=vendor_tarball, tomlconf=tomlconf, feature_flags=FeatureFlags(all_features=args.all_features), relative_license_paths=args.relative_license_paths, diff --git a/rust2rpm/cli.py b/rust2rpm/cli.py index 692268c..bd9a540 100644 --- a/rust2rpm/cli.py +++ b/rust2rpm/cli.py @@ -98,6 +98,12 @@ def get_parser() -> argparse.ArgumentParser: action="store_true", help="Enable interactive mode", ) + parser.add_argument( + "-V", + "--vendor", + action="store_true", + help="Create a vendor tarball and write a spec for building with vendored dependencies", + ) parser.add_argument( "crate", help="crates.io name\n" "path/to/local.crate\n" "path/to/project/", diff --git a/rust2rpm/crate.py b/rust2rpm/crate.py index dfefd4d..305587b 100644 --- a/rust2rpm/crate.py +++ b/rust2rpm/crate.py @@ -1,5 +1,6 @@ import contextlib import os +import pathlib import re import shutil import tarfile @@ -12,6 +13,7 @@ from cargo2rpm.semver import Version, VersionReq from rust2rpm.cratesio import download_crate, query_available_versions from rust2rpm import log from rust2rpm.patching import make_patches +from rust2rpm.vendor import generate_vendor_tarball LICENSE_FILE_PATTERN = re.compile( @@ -162,18 +164,22 @@ def toml_temp_copy(toml_path: str): def process_project_local( - project: str, patch: bool, patch_foreign: bool -) -> tuple[str, str, tuple[Optional[list[str]], Optional[list[str]]], Metadata, list[str], list[str]]: + project: str, + patch: bool, + patch_foreign: bool, + vendor: bool, +) -> tuple[str, str, tuple[Optional[list[str]], Optional[list[str]]], Metadata, list[str], list[str], Optional[str]]: if os.path.isdir(project): toml_path, doc_files, license_files = local_cargo_dir(project) + parent_dir = pathlib.Path(project).parent else: toml_path, doc_files, license_files = local_toml_file(project) + parent_dir = pathlib.Path(project).parent.parent metadata = Metadata.from_cargo(toml_path) if len(metadata.packages) > 1: - log.warn(f"More than one package in {toml_path!r} crate metadata.") - log.warn("Skipping automatic creation of patches.") + log.info("Skipping automatic creation of patches for cargo workspace.") # fall back to the directory name for determining the name / version # of the project heuristically @@ -182,6 +188,11 @@ def process_project_local( log.warn(f"Falling back to {name!r} as the name of the project (based on the name of the containing folder).") diffs: tuple[Optional[list[str]], Optional[list[str]]] = (None, None) + if vendor: + vendor_tarball = generate_vendor_tarball(toml_path, name, version) + else: + vendor_tarball = None + else: package = metadata.packages[0] name = package.name @@ -194,7 +205,15 @@ def process_project_local( # 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 + if vendor: + vendor_tarball = generate_vendor_tarball(temp_toml, name, package.version) + else: + vendor_tarball = None + + if vendor_tarball: + os.rename(vendor_tarball, parent_dir / vendor_tarball) + + return name, version, diffs, metadata, doc_files, license_files, vendor_tarball def resolve_version(crate: str, version: str) -> Optional[str]: @@ -233,14 +252,20 @@ 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], bool]: + vendor: bool, +) -> tuple[ + str, str, tuple[Optional[list[str]], Optional[list[str]]], Metadata, list[str], list[str], bool, Optional[str] +]: 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), True) + name, version, diffs, metadata, doc_files, license_files, vendor_tarball = process_project_local( + project, patch, patch_foreign, vendor + ) + return name, version, diffs, metadata, doc_files, license_files, True, vendor_tarball if project_is_path(project) and project.endswith(".crate"): # project points at a local .crate file @@ -287,4 +312,9 @@ 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, False + if vendor: + vendor_tarball = generate_vendor_tarball(toml_path, name, version) + else: + vendor_tarball = None + + return name, version, diffs, metadata, doc_files, license_files, False, vendor_tarball diff --git a/rust2rpm/generator.py b/rust2rpm/generator.py index 0f1d7a5..6e34db2 100644 --- a/rust2rpm/generator.py +++ b/rust2rpm/generator.py @@ -32,8 +32,12 @@ RUST_PACKAGING_TARGET_MIN: dict[str, int] = { } -def min_rust_packaging_dep(package: Package, target: str, is_bin: bool, is_cdylib: bool) -> int: - if package_uses_rust_1_60_feature_syntax(package.features): +def min_rust_packaging_dep( + package: Package, target: str, is_bin: bool, is_cdylib: bool, vendor_tarball: Optional[str] +) -> int: + if vendor_tarball: + min_dep = 25 + elif package_uses_rust_1_60_feature_syntax(package.features): min_dep = 24 elif is_bin or is_cdylib: min_dep = 23 @@ -150,6 +154,7 @@ def spec_render_crate( patch_file_manual: Optional[str], license_files: list[str], doc_files: list[str], + vendor_tarball: Optional[str], tomlconf: TomlConf, feature_flags: FeatureFlags, relative_license_paths: bool, @@ -219,7 +224,7 @@ def spec_render_crate( for feature in features_hide: features.remove(feature) - rust_packaging_dep = RUST_PACKAGING_DEPS[min_rust_packaging_dep(package, target, is_bin, is_cdylib)] + rust_packaging_dep = RUST_PACKAGING_DEPS[min_rust_packaging_dep(package, target, is_bin, is_cdylib, vendor_tarball)] if feature_flags.all_features or tomlconf.features_enable_all: cargo_args = " -a" @@ -284,6 +289,7 @@ def spec_render_crate( "rpm_doc_files": doc_files, "rpm_bcond_check": rpm_bcond_check, "rpm_test_comments": rpm_test_comments, + "rpm_vendor_source": vendor_tarball, # Parameters that control generation of subpackages "rpm_binary_package": is_bin, "rpm_cdylib_package": is_cdylib, @@ -295,15 +301,19 @@ def spec_render_crate( "crate_version": package.version, "crate_license": package.license, "upstream_version": upstream_version, + # Parameters for RPM macros + "rpm_autosetup_args": " -a1" if vendor_tarball else "", + "cargo_args": cargo_args, + "cargo_prep_args": " -v vendor" if vendor_tarball else "", + "cargo_test_args": cargo_test_args, # Parameters derived from rust2rpm.conf "conf_buildrequires": tomlconf.requires_build or list(), "conf_test_requires": tomlconf.requires_test or list(), "conf_bin_requires": tomlconf.requires_bin or list(), "conf_lib_requires": conf_lib_requires, "conf_supported_arches": conf_supported_arches, - "cargo_test_args": cargo_test_args, # Parameters derived from command-line flags - "cargo_args": cargo_args, + "use_vendor_tarball": vendor_tarball is not None, "use_relative_license_paths": relative_license_paths, "use_rpmautospec": rpmautospec, "make_changelog_entry": auto_changelog_entry, @@ -342,6 +352,7 @@ def spec_render_project( patch_file_manual: Optional[str], license_files: list[str], doc_files: list[str], + vendor_tarball: Optional[str], tomlconf: TomlConf, feature_flags: FeatureFlags, rpmautospec: bool, @@ -384,7 +395,7 @@ def spec_render_project( rpm_buildrequires = list(sorted(buildrequires)) rpm_test_requires = list(sorted(test_requires)) - rust_packaging_dep = RUST_PACKAGING_DEPS[min_rust_packaging_dep(package, target, is_bin, is_cdylib)] + rust_packaging_dep = RUST_PACKAGING_DEPS[min_rust_packaging_dep(package, target, is_bin, is_cdylib, vendor_tarball)] if feature_flags.all_features or tomlconf.features_enable_all: cargo_args = " -a" @@ -448,6 +459,7 @@ def spec_render_project( "rpm_doc_files": doc_files, "rpm_bcond_check": rpm_bcond_check, "rpm_test_comments": rpm_test_comments, + "rpm_vendor_source": vendor_tarball, # Parameters that control generation of subpackages "rpm_binary_package": is_bin, "rpm_cdylib_package": is_cdylib, @@ -457,14 +469,18 @@ def spec_render_project( "crate_version": package.version, "crate_license": package.license, "upstream_version": upstream_version, + # Parameters for RPM macros + "rpm_autosetup_args": " -a1" if vendor_tarball else "", + "cargo_args": cargo_args, + "cargo_prep_args": " -v vendor" if vendor_tarball else "", + "cargo_test_args": cargo_test_args, # Parameters derived from rust2rpm.conf "conf_buildrequires": tomlconf.requires_build or list(), "conf_test_requires": tomlconf.requires_test or list(), "conf_bin_requires": tomlconf.requires_bin or list(), "conf_supported_arches": conf_supported_arches, - "cargo_test_args": cargo_test_args, # Parameters derived from command-line flags - "cargo_args": cargo_args, + "use_vendor_tarball": vendor_tarball is not None, "use_rpmautospec": rpmautospec, "make_changelog_entry": auto_changelog_entry, } @@ -500,6 +516,7 @@ def spec_render_workspace( rpm_name: str, license_files: list[str], doc_files: list[str], + vendor_tarball: Optional[str], tomlconf: TomlConf, feature_flags: FeatureFlags, rpmautospec: bool, @@ -549,7 +566,7 @@ def spec_render_workspace( ( 24, max( - min_rust_packaging_dep(package, target, package.is_bin(), package.is_cdylib()) + min_rust_packaging_dep(package, target, package.is_bin(), package.is_cdylib(), vendor_tarball) for package in metadata.packages ), ) @@ -605,13 +622,18 @@ def spec_render_workspace( "upstream_version": upstream_version, "rpm_bcond_check": rpm_bcond_check, "rpm_test_comments": rpm_test_comments, + "rpm_vendor_source": vendor_tarball, + # Parameters for RPM macros + "rpm_autosetup_args": " -a1" if vendor_tarball else "", + "cargo_args": cargo_args, + "cargo_prep_args": " -v vendor" if vendor_tarball else "", + "cargo_test_args": cargo_test_args, # Parameters derived from rust2rpm.conf "conf_buildrequires": tomlconf.requires_build or list(), "conf_test_requires": tomlconf.requires_test or list(), "conf_bin_requires": tomlconf.requires_bin or list(), - "cargo_test_args": cargo_test_args, # Parameters derived from command-line flags - "cargo_args": cargo_args, + "use_vendor_tarball": vendor_tarball is not None, "use_rpmautospec": rpmautospec, "make_changelog_entry": auto_changelog_entry, } diff --git a/rust2rpm/templates/crate.spec b/rust2rpm/templates/crate.spec index ecccdf4..ecb69c7 100644 --- a/rust2rpm/templates/crate.spec +++ b/rust2rpm/templates/crate.spec @@ -54,6 +54,9 @@ Source: %{crates_source %{crate} %{upstream_version}} {% else %} Source: %{crates_source} {% endif %} +{% if use_vendor_tarball %} +Source: {{ rpm_vendor_source }} +{% endif %} {% if rpm_patch_file_automatic is not none %} # Automatically generated patch to strip dependencies and normalize metadata Patch: {{ rpm_patch_file_automatic }} @@ -72,7 +75,7 @@ ExclusiveArch: %{rust_arches} {% endif %} BuildRequires: {{ rust_packaging_dep }} -{% if include_build_requires %} +{% if include_build_requires and not use_vendor_tarball %} {% for req in rpm_buildrequires %} BuildRequires: {{ req }} {% endfor %} @@ -129,6 +132,9 @@ Requires: {{ req }} # FIXME: no license files detected {% endif %} %license LICENSE.dependencies +{% if use_vendor_tarball %} +%license cargo-vendor.txt +{% endif %} {% for file in rpm_doc_files %} %doc {{ file }} {% endfor %} @@ -196,15 +202,15 @@ use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "% %prep {% if crate_version != rpm_version %} -%autosetup -n %{crate}-%{crate_version} -p1 +%autosetup -n %{crate}-%{crate_version} -p1{{ rpm_autosetup_args}} {% elif crate_version != upstream_version %} -%autosetup -n %{crate}-%{upstream_version} -p1 +%autosetup -n %{crate}-%{upstream_version} -p1{{ rpm_autosetup_args}} {% else %} -%autosetup -n %{crate}-%{version} -p1 +%autosetup -n %{crate}-%{version} -p1{{ rpm_autosetup_args}} {% endif %} -%cargo_prep +%cargo_prep{{ cargo_prep_args }} -{% if not include_build_requires %} +{% if not include_build_requires and not use_vendor_tarball %} %generate_buildrequires %cargo_generate_buildrequires{{ cargo_args }} {% for req in conf_buildrequires %} @@ -232,6 +238,9 @@ echo {{ "%r" | format(req) }} %{cargo_license_summary{{ cargo_args }}} %{cargo_license{{ cargo_args }}} > LICENSE.dependencies {% endif %} +{% if use_vendor_tarball %} +%{cargo_vendor_manifest} +{% endif %} %install {% if rpm_cdylib_package and (rpm_library_package or rpm_binary_package) %} diff --git a/rust2rpm/templates/project.spec b/rust2rpm/templates/project.spec index d23f484..dcca2eb 100644 --- a/rust2rpm/templates/project.spec +++ b/rust2rpm/templates/project.spec @@ -49,6 +49,9 @@ License: # FIXME URL: {{ rpm_url }} {% endif %} Source: # FIXME +{% if use_vendor_tarball %} +Source: {{ rpm_vendor_source }} +{% endif %} {% if rpm_patch_file_automatic is not none %} # Automatically generated patch to strip dependencies and normalize metadata Patch: {{ rpm_patch_file_automatic }} @@ -69,7 +72,7 @@ ExclusiveArch: %{rust_arches} {% endif %} BuildRequires: {{ rust_packaging_dep }} -{% if include_build_requires %} +{% if include_build_requires and not use_vendor_tarball %} {% for req in rpm_buildrequires %} BuildRequires: {{ req }} {% endfor %} @@ -107,15 +110,15 @@ Requires: {{ req }} %prep {% if crate_version != rpm_version %} -%autosetup -n %{crate}-%{crate_version} -p1 +%autosetup -n %{crate}-%{crate_version} -p1{{ rpm_autosetup_args}} {% elif crate_version != upstream_version %} -%autosetup -n %{crate}-%{upstream_version} -p1 +%autosetup -n %{crate}-%{upstream_version} -p1{{ rpm_autosetup_args}} {% else %} -%autosetup -n %{crate}-%{version} -p1 +%autosetup -n %{crate}-%{version} -p1{{ rpm_autosetup_args}} {% endif %} -%cargo_prep +%cargo_prep{{ cargo_prep_args }} -{% if not include_build_requires %} +{% if not include_build_requires and not use_vendor_tarball %} %generate_buildrequires %cargo_generate_buildrequires{{ cargo_args }} {% for req in conf_buildrequires %} @@ -135,6 +138,9 @@ echo {{ "%r" | format(req) }} %cargo_build{{ cargo_args }} %{cargo_license_summary{{ cargo_args }}} %{cargo_license{{ cargo_args }}} > LICENSE.dependencies +{% if use_vendor_tarball %} +%{cargo_vendor_manifest} +{% endif %} %install {% if rpm_cdylib_package and rpm_binary_package %} @@ -171,6 +177,9 @@ echo {{ "%r" | format(req) }} # FIXME: no license files detected {% endif %} %license LICENSE.dependencies +{% if use_vendor_tarball %} +%license cargo-vendor.txt +{% endif %} {% for file in rpm_doc_files %} %doc {{ file }} {% endfor %} diff --git a/rust2rpm/templates/workspace.spec b/rust2rpm/templates/workspace.spec index 91b08a7..5028a09 100644 --- a/rust2rpm/templates/workspace.spec +++ b/rust2rpm/templates/workspace.spec @@ -36,6 +36,9 @@ License: # FIXME URL: # FIXME Source: # FIXME +{% if use_vendor_tarball %} +Source: {{ rpm_vendor_source }} +{% endif %} {% if conf_supported_arches %} ExclusiveArch: {{ conf_supported_arches }} @@ -44,7 +47,7 @@ ExclusiveArch: %{rust_arches} {% endif %} BuildRequires: {{ rust_packaging_dep }} -{% if include_build_requires %} +{% if include_build_requires and not use_vendor_tarball %} {% for req in rpm_buildrequires %} BuildRequires: {{ req }} {% endfor %} @@ -82,13 +85,13 @@ Requires: {{ req }} %prep {% if rpm_version != upstream_version %} -%autosetup -n {{ rpm_name }}-%{upstream_version} -p1 +%autosetup -n {{ rpm_name }}-%{upstream_version} -p1{{ rpm_autosetup_args}} {% else %} -%autosetup -n {{ rpm_name }}-%{version} -p1 +%autosetup -n {{ rpm_name }}-%{version} -p1{{ rpm_autosetup_args}} {% endif %} -%cargo_prep +%cargo_prep{{ cargo_prep_args }} -{% if not include_build_requires %} +{% if not include_build_requires and not use_vendor_tarball %} %generate_buildrequires %cargo_generate_buildrequires{{ cargo_args }} {% for req in conf_buildrequires %} @@ -108,6 +111,9 @@ echo {{ "%r" | format(req) }} %cargo_build{{ cargo_args }} %{cargo_license_summary{{ cargo_args }}} %{cargo_license{{ cargo_args }}} > LICENSE.dependencies +{% if use_vendor_tarball %} +%{cargo_vendor_manifest} +{% endif %} %install {% if rpm_cdylib_package and rpm_binary_names|length >= 1 %} @@ -144,6 +150,9 @@ echo {{ "%r" | format(req) }} # FIXME: no license files detected {% endif %} %license LICENSE.dependencies +{% if use_vendor_tarball %} +%license cargo-vendor.txt +{% endif %} {% for file in rpm_doc_files %} %doc {{ file }} {% endfor %} diff --git a/rust2rpm/tests/samples/stgit-2.3.3.fedora.spec b/rust2rpm/tests/samples/stgit-2.3.3.fedora.spec index 06a06d9..934dc1c 100644 --- a/rust2rpm/tests/samples/stgit-2.3.3.fedora.spec +++ b/rust2rpm/tests/samples/stgit-2.3.3.fedora.spec @@ -18,12 +18,13 @@ License: # FIXME URL: https://github.com/stacked-git/stgit Source: # FIXME +Source: stgit-vendor-2.3.3.tar.xz # 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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: Stack-based patch management for Git.} @@ -31,16 +32,14 @@ Stack-based patch management for Git.} %description %{_description} %prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep - -%generate_buildrequires -%cargo_generate_buildrequires +%autosetup -n %{crate}-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -54,6 +53,7 @@ Stack-based patch management for Git.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/stg diff --git a/rust2rpm/tests/samples/stgit-2.3.3.mageia.spec b/rust2rpm/tests/samples/stgit-2.3.3.mageia.spec index fc1f2b8..b3a2299 100644 --- a/rust2rpm/tests/samples/stgit-2.3.3.mageia.spec +++ b/rust2rpm/tests/samples/stgit-2.3.3.mageia.spec @@ -20,6 +20,7 @@ License: # FIXME URL: https://github.com/stacked-git/stgit Source: # FIXME +Source: stgit-vendor-2.3.3.tar.xz # Automatically generated patch to strip dependencies and normalize metadata Patch: stgit-patch1.diff # Manually created patch for downstream crate metadata changes @@ -27,45 +28,7 @@ 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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: Stack-based patch management for Git.} @@ -73,13 +36,14 @@ Stack-based patch management for Git.} %description %{_description} %prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep +%autosetup -n %{crate}-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -93,6 +57,7 @@ Stack-based patch management for Git.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/stg diff --git a/rust2rpm/tests/samples/stgit-2.3.3.opensuse.spec b/rust2rpm/tests/samples/stgit-2.3.3.opensuse.spec index b951dcc..2ed43ad 100644 --- a/rust2rpm/tests/samples/stgit-2.3.3.opensuse.spec +++ b/rust2rpm/tests/samples/stgit-2.3.3.opensuse.spec @@ -36,6 +36,7 @@ License: # FIXME URL: https://github.com/stacked-git/stgit Source: # FIXME +Source: stgit-vendor-2.3.3.tar.xz # 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 @@ -43,45 +44,7 @@ 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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: Stack-based patch management for Git.} @@ -89,13 +52,14 @@ Stack-based patch management for Git.} %description %{_description} %prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep +%autosetup -n %{crate}-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -109,6 +73,7 @@ Stack-based patch management for Git.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/stg diff --git a/rust2rpm/tests/samples/stgit-2.3.3.plain.spec b/rust2rpm/tests/samples/stgit-2.3.3.plain.spec index c4b02ec..5db3674 100644 --- a/rust2rpm/tests/samples/stgit-2.3.3.plain.spec +++ b/rust2rpm/tests/samples/stgit-2.3.3.plain.spec @@ -18,6 +18,7 @@ License: # FIXME URL: https://github.com/stacked-git/stgit Source: # FIXME +Source: stgit-vendor-2.3.3.tar.xz # Automatically generated patch to strip dependencies and normalize metadata Patch: stgit-patch1.diff # Manually created patch for downstream crate metadata changes @@ -25,45 +26,7 @@ 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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: Stack-based patch management for Git.} @@ -71,13 +34,14 @@ Stack-based patch management for Git.} %description %{_description} %prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep +%autosetup -n %{crate}-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -91,6 +55,7 @@ Stack-based patch management for Git.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/stg 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 new file mode 100644 index 0000000..0203686 --- /dev/null +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.fedora.spec @@ -0,0 +1,55 @@ +# Generated by rust2rpm NNN +%bcond_without check + +Name: system76-keyboard-configurator +Version: 0.1.0 +Release: %autorelease +Summary: # FIXME + +SourceLicense: GPL-3.0-or-later +# FIXME: paste output of %%cargo_license_summary here +License: # FIXME +# LICENSE.dependencies contains a full license breakdown + +URL: # FIXME +Source: # FIXME + +BuildRequires: cargo-rpm-macros >= 24 + +%global _description %{expand: +%{summary}.} + +%description %{_description} + +%prep +%autosetup -n system76-keyboard-configurator-%{version} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install +# FIXME: install shared library + +%if %{with check} +%check +%cargo_test +%endif + +%files +%license LIC1 +%license LIC2 +%license LICENSE.dependencies +%doc DOC1 +%doc DOC2 +%{_bindir}/pkgconfig +%{_bindir}/system76-keyboard-configurator + +%changelog +%autochangelog diff --git a/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.json b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.json new file mode 100644 index 0000000..1f50962 --- /dev/null +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.json @@ -0,0 +1 @@ +{"packages":[{"name":"tools","version":"0.1.0","id":"tools 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/tools)","license":null,"license_file":null,"description":"build tools used by this project","source":null,"dependencies":[],"targets":[{"kind":["bin"],"crate_types":["bin"],"name":"pkgconfig","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/tools/src/pkgconfig.rs","edition":"2018","doc":true,"doctest":false,"test":true}],"features":{},"manifest_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/tools/Cargo.toml","metadata":null,"publish":null,"authors":["Michael Aaron Murphy "],"categories":[],"keywords":[],"readme":null,"repository":null,"homepage":null,"documentation":null,"edition":"2018","links":null,"default_run":null,"rust_version":null},{"name":"ffi","version":"0.1.0","id":"ffi 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/ffi)","license":null,"license_file":null,"description":null,"source":null,"dependencies":[{"name":"gtk","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"system76-keyboard-configurator-widgets","source":null,"req":"*","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null,"path":"/home/deca/Downloads/keyboard-configurator-1.3.9/widgets"}],"targets":[{"kind":["cdylib"],"crate_types":["cdylib"],"name":"system76_keyboard_configurator","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/ffi/src/lib.rs","edition":"2021","doc":true,"doctest":false,"test":true},{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/ffi/build.rs","edition":"2021","doc":false,"doctest":false,"test":false}],"features":{},"manifest_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/ffi/Cargo.toml","metadata":null,"publish":null,"authors":["Ian Douglas Scott "],"categories":[],"keywords":[],"readme":null,"repository":null,"homepage":null,"documentation":null,"edition":"2021","links":null,"default_run":null,"rust_version":null},{"name":"system76-keyboard-configurator-widgets","version":"0.1.0","id":"system76-keyboard-configurator-widgets 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/widgets)","license":"GPL-3.0-or-later","license_file":null,"description":null,"source":null,"dependencies":[{"name":"system76-keyboard-configurator-backend","source":null,"req":"*","kind":null,"rename":"backend","optional":false,"uses_default_features":true,"features":["glib"],"target":null,"registry":null,"path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend"},{"name":"cascade","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"futures","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.3.13","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"gtk","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"i18n-embed","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.12.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["fluent-system","desktop-requester"],"target":null,"registry":null},{"name":"i18n-embed-fl","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.5.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"libc","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.2","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"log","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.4.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"once_cell","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.4","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"rust-embed","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^5.9.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["debug-embed"],"target":null,"registry":null},{"name":"serde","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["derive"],"target":null,"registry":null},{"name":"serde_json","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"gio","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":"build","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"winreg","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.8","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":"cfg(target_os = \"windows\")","registry":null}],"targets":[{"kind":["lib"],"crate_types":["lib"],"name":"system76-keyboard-configurator-widgets","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/widgets/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},{"kind":["example"],"crate_types":["bin"],"name":"keyboard_color","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/widgets/examples/keyboard_color.rs","edition":"2021","doc":false,"doctest":false,"test":false}],"features":{"appimage":["backend/appimage"]},"manifest_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/widgets/Cargo.toml","metadata":null,"publish":null,"authors":["Ian Douglas Scott ","Jeremy Soller "],"categories":[],"keywords":[],"readme":null,"repository":null,"homepage":null,"documentation":null,"edition":"2021","links":null,"default_run":null,"rust_version":null},{"name":"system76-keyboard-configurator-backend","version":"0.1.0","id":"system76-keyboard-configurator-backend 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/backend)","license":"GPL-3.0-or-later","license_file":null,"description":null,"source":null,"dependencies":[{"name":"async-process","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.7.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"cascade","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"futures","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.3.13","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["thread-pool"],"target":null,"registry":null},{"name":"futures-timer","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^3.0.2","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"glib","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":null,"rename":null,"optional":true,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"hidapi","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.2","kind":null,"rename":null,"optional":false,"uses_default_features":false,"features":["linux-shared-hidraw"],"target":null,"registry":null},{"name":"i18n-embed","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.12.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["fluent-system","desktop-requester"],"target":null,"registry":null},{"name":"i18n-embed-fl","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.5.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"libc","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.2","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"log","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.4.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"once_cell","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.4","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"ordered-float","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^2.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["serde"],"target":null,"registry":null},{"name":"palette","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.5","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"regex","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"rust-embed","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^5.9.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["debug-embed"],"target":null,"registry":null},{"name":"serde","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["derive"],"target":null,"registry":null},{"name":"serde_json","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"system76_ectool","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.3.8","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["hidapi","std"],"target":null,"registry":null},{"name":"uuid","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.8.2","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["v4"],"target":null,"registry":null},{"name":"libc","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.2","kind":"dev","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"serde_json","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":"build","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"zbus","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.9.1","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":"cfg(target_os = \"linux\")","registry":null}],"targets":[{"kind":["lib"],"crate_types":["lib"],"name":"system76-keyboard-configurator-backend","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},{"kind":["example"],"crate_types":["bin"],"name":"benchmark","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend/examples/benchmark.rs","edition":"2021","doc":false,"doctest":false,"test":false},{"kind":["example"],"crate_types":["bin"],"name":"daemon","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend/examples/daemon.rs","edition":"2021","doc":false,"doctest":false,"test":false},{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend/build.rs","edition":"2021","doc":false,"doctest":false,"test":false}],"features":{"appimage":[],"glib":["dep:glib"]},"manifest_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend/Cargo.toml","metadata":null,"publish":null,"authors":["Ian Douglas Scott ","Jeremy Soller "],"categories":[],"keywords":[],"readme":null,"repository":null,"homepage":null,"documentation":null,"edition":"2021","links":null,"default_run":null,"rust_version":null},{"name":"system76-keyboard-configurator","version":"1.3.9","id":"system76-keyboard-configurator 1.3.9 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9)","license":"GPL-3.0-or-later","license_file":null,"description":null,"source":null,"dependencies":[{"name":"system76-keyboard-configurator-backend","source":null,"req":"*","kind":null,"rename":"backend","optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null,"path":"/home/deca/Downloads/keyboard-configurator-1.3.9/backend"},{"name":"cascade","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"env_logger","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.8.3","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"futures","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.3.13","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"gtk","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"i18n-embed","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.12.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["fluent-system","desktop-requester"],"target":null,"registry":null},{"name":"i18n-embed-fl","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.5.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"libc","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.2","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"log","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.4.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"once_cell","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.4","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"pangocairo","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"rust-embed","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^5.9.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["debug-embed"],"target":null,"registry":null},{"name":"serde","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":["derive"],"target":null,"registry":null},{"name":"serde_json","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"system76-keyboard-configurator-widgets","source":null,"req":"*","kind":null,"rename":"widgets","optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null,"path":"/home/deca/Downloads/keyboard-configurator-1.3.9/widgets"},{"name":"glib-build-tools","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.17.0","kind":"build","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"winreg","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.8","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":"cfg(target_os = \"windows\")","registry":null}],"targets":[{"kind":["bin"],"crate_types":["bin"],"name":"system76-keyboard-configurator","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/src/main.rs","edition":"2021","doc":true,"doctest":false,"test":true},{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/build.rs","edition":"2021","doc":false,"doctest":false,"test":false}],"features":{"appimage":["backend/appimage"]},"manifest_path":"/home/deca/Downloads/keyboard-configurator-1.3.9/Cargo.toml","metadata":null,"publish":null,"authors":["Ian Douglas Scott ","Jeremy Soller "],"categories":[],"keywords":[],"readme":"README.md","repository":null,"homepage":null,"documentation":null,"edition":"2021","links":null,"default_run":null,"rust_version":null}],"workspace_members":["tools 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/tools)","ffi 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/ffi)","system76-keyboard-configurator-widgets 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/widgets)","system76-keyboard-configurator-backend 0.1.0 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9/backend)","system76-keyboard-configurator 1.3.9 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9)"],"workspace_default_members":["system76-keyboard-configurator 1.3.9 (path+file:///home/deca/Downloads/keyboard-configurator-1.3.9)"],"resolve":null,"target_directory":"/home/deca/Downloads/keyboard-configurator-1.3.9/target","version":1,"workspace_root":"/home/deca/Downloads/keyboard-configurator-1.3.9","metadata":null} 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 new file mode 100644 index 0000000..56de809 --- /dev/null +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.mageia.spec @@ -0,0 +1,92 @@ +# Generated by rust2rpm NNN +%bcond_without check + +Name: system76-keyboard-configurator +Version: 0.1.0 +Release: %mkrel 1 +Summary: # FIXME +Group: Development/Rust + +SourceLicense: GPLv3+ +# FIXME: paste output of %%cargo_license_summary here +License: # FIXME +# LICENSE.dependencies contains a full license breakdown + +URL: # FIXME +Source: # FIXME + +ExclusiveArch: %{rust_arches} + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: (crate(async-process/default) >= 1.7.0 with crate(async-process/default) < 2.0.0~) +BuildRequires: (crate(cascade/default) >= 1.0.0 with crate(cascade/default) < 2.0.0~) +BuildRequires: (crate(env_logger/default) >= 0.8.3 with crate(env_logger/default) < 0.9.0~) +BuildRequires: (crate(futures-timer/default) >= 3.0.2 with crate(futures-timer/default) < 4.0.0~) +BuildRequires: (crate(futures/default) >= 0.3.13 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(futures/thread-pool) >= 0.3.13 with crate(futures/thread-pool) < 0.4.0~) +BuildRequires: (crate(gio/default) >= 0.17.0 with crate(gio/default) < 0.18.0~) +BuildRequires: (crate(glib-build-tools/default) >= 0.17.0 with crate(glib-build-tools/default) < 0.18.0~) +BuildRequires: (crate(glib/default) >= 0.17.0 with crate(glib/default) < 0.18.0~) +BuildRequires: (crate(gtk/default) >= 0.17.0 with crate(gtk/default) < 0.18.0~) +BuildRequires: (crate(hidapi) >= 1.2.0 with crate(hidapi) < 2.0.0~) +BuildRequires: (crate(hidapi/linux-shared-hidraw) >= 1.2.0 with crate(hidapi/linux-shared-hidraw) < 2.0.0~) +BuildRequires: (crate(i18n-embed-fl/default) >= 0.5.0 with crate(i18n-embed-fl/default) < 0.6.0~) +BuildRequires: (crate(i18n-embed/default) >= 0.12.0 with crate(i18n-embed/default) < 0.13.0~) +BuildRequires: (crate(i18n-embed/desktop-requester) >= 0.12.0 with crate(i18n-embed/desktop-requester) < 0.13.0~) +BuildRequires: (crate(i18n-embed/fluent-system) >= 0.12.0 with crate(i18n-embed/fluent-system) < 0.13.0~) +BuildRequires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(log/default) >= 0.4.0 with crate(log/default) < 0.5.0~) +BuildRequires: (crate(once_cell/default) >= 1.4.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(ordered-float/default) >= 2.0.0 with crate(ordered-float/default) < 3.0.0~) +BuildRequires: (crate(ordered-float/serde) >= 2.0.0 with crate(ordered-float/serde) < 3.0.0~) +BuildRequires: (crate(palette/default) >= 0.5.0 with crate(palette/default) < 0.6.0~) +BuildRequires: (crate(pangocairo/default) >= 0.17.0 with crate(pangocairo/default) < 0.18.0~) +BuildRequires: (crate(regex/default) >= 1.0.0 with crate(regex/default) < 2.0.0~) +BuildRequires: (crate(rust-embed/debug-embed) >= 5.9.0 with crate(rust-embed/debug-embed) < 6.0.0~) +BuildRequires: (crate(rust-embed/default) >= 5.9.0 with crate(rust-embed/default) < 6.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(system76_ectool/default) >= 0.3.8 with crate(system76_ectool/default) < 0.4.0~) +BuildRequires: (crate(system76_ectool/hidapi) >= 0.3.8 with crate(system76_ectool/hidapi) < 0.4.0~) +BuildRequires: (crate(system76_ectool/std) >= 0.3.8 with crate(system76_ectool/std) < 0.4.0~) +BuildRequires: (crate(uuid/default) >= 0.8.2 with crate(uuid/default) < 0.9.0~) +BuildRequires: (crate(uuid/v4) >= 0.8.2 with crate(uuid/v4) < 0.9.0~) +BuildRequires: (crate(winreg/default) >= 0.8.0 with crate(winreg/default) < 0.9.0~) +BuildRequires: (crate(zbus/default) >= 1.9.1 with crate(zbus/default) < 2.0.0~) + +%global _description %{expand: +%{summary}.} + +%description %{_description} + +%prep +%autosetup -n system76-keyboard-configurator-%{version} -p1 +%cargo_prep + +%build +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install +# FIXME: install shared library + +%if %{with check} +%check +%cargo_test +%endif + +%files +%license LIC1 +%license LIC2 +%license LICENSE.dependencies +%doc DOC1 +%doc DOC2 +%{_bindir}/pkgconfig +%{_bindir}/system76-keyboard-configurator + +%changelog +* Thu Jan 01 1970 Jane Jane - 0.1.0-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 new file mode 100644 index 0000000..5a71f9e --- /dev/null +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.opensuse.spec @@ -0,0 +1,110 @@ +# +# spec file for package system76-keyboard-configurator +# +# Copyright (c) XXXX Jane Jane . +# +# 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: system76-keyboard-configurator +Version: 0.1.0 +Release: 0 +Summary: # FIXME +Group: Development/Libraries/Rust + +SourceLicense: GPL-3.0-or-later +# FIXME: paste output of %%cargo_license_summary here +License: # FIXME +# LICENSE.dependencies contains a full license breakdown + +URL: # FIXME +Source: # FIXME + +ExclusiveArch: %{rust_arches} + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: (crate(async-process/default) >= 1.7.0 with crate(async-process/default) < 2.0.0~) +BuildRequires: (crate(cascade/default) >= 1.0.0 with crate(cascade/default) < 2.0.0~) +BuildRequires: (crate(env_logger/default) >= 0.8.3 with crate(env_logger/default) < 0.9.0~) +BuildRequires: (crate(futures-timer/default) >= 3.0.2 with crate(futures-timer/default) < 4.0.0~) +BuildRequires: (crate(futures/default) >= 0.3.13 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(futures/thread-pool) >= 0.3.13 with crate(futures/thread-pool) < 0.4.0~) +BuildRequires: (crate(gio/default) >= 0.17.0 with crate(gio/default) < 0.18.0~) +BuildRequires: (crate(glib-build-tools/default) >= 0.17.0 with crate(glib-build-tools/default) < 0.18.0~) +BuildRequires: (crate(glib/default) >= 0.17.0 with crate(glib/default) < 0.18.0~) +BuildRequires: (crate(gtk/default) >= 0.17.0 with crate(gtk/default) < 0.18.0~) +BuildRequires: (crate(hidapi) >= 1.2.0 with crate(hidapi) < 2.0.0~) +BuildRequires: (crate(hidapi/linux-shared-hidraw) >= 1.2.0 with crate(hidapi/linux-shared-hidraw) < 2.0.0~) +BuildRequires: (crate(i18n-embed-fl/default) >= 0.5.0 with crate(i18n-embed-fl/default) < 0.6.0~) +BuildRequires: (crate(i18n-embed/default) >= 0.12.0 with crate(i18n-embed/default) < 0.13.0~) +BuildRequires: (crate(i18n-embed/desktop-requester) >= 0.12.0 with crate(i18n-embed/desktop-requester) < 0.13.0~) +BuildRequires: (crate(i18n-embed/fluent-system) >= 0.12.0 with crate(i18n-embed/fluent-system) < 0.13.0~) +BuildRequires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(log/default) >= 0.4.0 with crate(log/default) < 0.5.0~) +BuildRequires: (crate(once_cell/default) >= 1.4.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(ordered-float/default) >= 2.0.0 with crate(ordered-float/default) < 3.0.0~) +BuildRequires: (crate(ordered-float/serde) >= 2.0.0 with crate(ordered-float/serde) < 3.0.0~) +BuildRequires: (crate(palette/default) >= 0.5.0 with crate(palette/default) < 0.6.0~) +BuildRequires: (crate(pangocairo/default) >= 0.17.0 with crate(pangocairo/default) < 0.18.0~) +BuildRequires: (crate(regex/default) >= 1.0.0 with crate(regex/default) < 2.0.0~) +BuildRequires: (crate(rust-embed/debug-embed) >= 5.9.0 with crate(rust-embed/debug-embed) < 6.0.0~) +BuildRequires: (crate(rust-embed/default) >= 5.9.0 with crate(rust-embed/default) < 6.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(system76_ectool/default) >= 0.3.8 with crate(system76_ectool/default) < 0.4.0~) +BuildRequires: (crate(system76_ectool/hidapi) >= 0.3.8 with crate(system76_ectool/hidapi) < 0.4.0~) +BuildRequires: (crate(system76_ectool/std) >= 0.3.8 with crate(system76_ectool/std) < 0.4.0~) +BuildRequires: (crate(uuid/default) >= 0.8.2 with crate(uuid/default) < 0.9.0~) +BuildRequires: (crate(uuid/v4) >= 0.8.2 with crate(uuid/v4) < 0.9.0~) +BuildRequires: (crate(winreg/default) >= 0.8.0 with crate(winreg/default) < 0.9.0~) +BuildRequires: (crate(zbus/default) >= 1.9.1 with crate(zbus/default) < 2.0.0~) + +%global _description %{expand: +%{summary}.} + +%description %{_description} + +%prep +%autosetup -n system76-keyboard-configurator-%{version} -p1 +%cargo_prep + +%build +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install +# FIXME: install shared library + +%if %{with check} +%check +%cargo_test +%endif + +%files +%license LIC1 +%license LIC2 +%license LICENSE.dependencies +%doc DOC1 +%doc DOC2 +%{_bindir}/pkgconfig +%{_bindir}/system76-keyboard-configurator + +%changelog +* Thu Jan 01 03:25:45 GMT 1970 Jane Jane +- Version 0.1.0 +- 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 new file mode 100644 index 0000000..7fd156f --- /dev/null +++ b/rust2rpm/tests/samples/system76-keyboard-configurator-1.3.9.plain.spec @@ -0,0 +1,91 @@ +# Generated by rust2rpm NNN +%bcond_without check + +Name: system76-keyboard-configurator +Version: 0.1.0 +Release: 1%{?dist} +Summary: # FIXME + +SourceLicense: GPL-3.0-or-later +# FIXME: paste output of %%cargo_license_summary here +License: # FIXME +# LICENSE.dependencies contains a full license breakdown + +URL: # FIXME +Source: # FIXME + +ExclusiveArch: %{rust_arches} + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: (crate(async-process/default) >= 1.7.0 with crate(async-process/default) < 2.0.0~) +BuildRequires: (crate(cascade/default) >= 1.0.0 with crate(cascade/default) < 2.0.0~) +BuildRequires: (crate(env_logger/default) >= 0.8.3 with crate(env_logger/default) < 0.9.0~) +BuildRequires: (crate(futures-timer/default) >= 3.0.2 with crate(futures-timer/default) < 4.0.0~) +BuildRequires: (crate(futures/default) >= 0.3.13 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(futures/thread-pool) >= 0.3.13 with crate(futures/thread-pool) < 0.4.0~) +BuildRequires: (crate(gio/default) >= 0.17.0 with crate(gio/default) < 0.18.0~) +BuildRequires: (crate(glib-build-tools/default) >= 0.17.0 with crate(glib-build-tools/default) < 0.18.0~) +BuildRequires: (crate(glib/default) >= 0.17.0 with crate(glib/default) < 0.18.0~) +BuildRequires: (crate(gtk/default) >= 0.17.0 with crate(gtk/default) < 0.18.0~) +BuildRequires: (crate(hidapi) >= 1.2.0 with crate(hidapi) < 2.0.0~) +BuildRequires: (crate(hidapi/linux-shared-hidraw) >= 1.2.0 with crate(hidapi/linux-shared-hidraw) < 2.0.0~) +BuildRequires: (crate(i18n-embed-fl/default) >= 0.5.0 with crate(i18n-embed-fl/default) < 0.6.0~) +BuildRequires: (crate(i18n-embed/default) >= 0.12.0 with crate(i18n-embed/default) < 0.13.0~) +BuildRequires: (crate(i18n-embed/desktop-requester) >= 0.12.0 with crate(i18n-embed/desktop-requester) < 0.13.0~) +BuildRequires: (crate(i18n-embed/fluent-system) >= 0.12.0 with crate(i18n-embed/fluent-system) < 0.13.0~) +BuildRequires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(log/default) >= 0.4.0 with crate(log/default) < 0.5.0~) +BuildRequires: (crate(once_cell/default) >= 1.4.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(ordered-float/default) >= 2.0.0 with crate(ordered-float/default) < 3.0.0~) +BuildRequires: (crate(ordered-float/serde) >= 2.0.0 with crate(ordered-float/serde) < 3.0.0~) +BuildRequires: (crate(palette/default) >= 0.5.0 with crate(palette/default) < 0.6.0~) +BuildRequires: (crate(pangocairo/default) >= 0.17.0 with crate(pangocairo/default) < 0.18.0~) +BuildRequires: (crate(regex/default) >= 1.0.0 with crate(regex/default) < 2.0.0~) +BuildRequires: (crate(rust-embed/debug-embed) >= 5.9.0 with crate(rust-embed/debug-embed) < 6.0.0~) +BuildRequires: (crate(rust-embed/default) >= 5.9.0 with crate(rust-embed/default) < 6.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(system76_ectool/default) >= 0.3.8 with crate(system76_ectool/default) < 0.4.0~) +BuildRequires: (crate(system76_ectool/hidapi) >= 0.3.8 with crate(system76_ectool/hidapi) < 0.4.0~) +BuildRequires: (crate(system76_ectool/std) >= 0.3.8 with crate(system76_ectool/std) < 0.4.0~) +BuildRequires: (crate(uuid/default) >= 0.8.2 with crate(uuid/default) < 0.9.0~) +BuildRequires: (crate(uuid/v4) >= 0.8.2 with crate(uuid/v4) < 0.9.0~) +BuildRequires: (crate(winreg/default) >= 0.8.0 with crate(winreg/default) < 0.9.0~) +BuildRequires: (crate(zbus/default) >= 1.9.1 with crate(zbus/default) < 2.0.0~) + +%global _description %{expand: +%{summary}.} + +%description %{_description} + +%prep +%autosetup -n system76-keyboard-configurator-%{version} -p1 +%cargo_prep + +%build +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install +# FIXME: install shared library + +%if %{with check} +%check +%cargo_test +%endif + +%files +%license LIC1 +%license LIC2 +%license LICENSE.dependencies +%doc DOC1 +%doc DOC2 +%{_bindir}/pkgconfig +%{_bindir}/system76-keyboard-configurator + +%changelog +* Thu Jan 01 1970 Jane Jane - 0.1.0-1 +- Initial package diff --git a/rust2rpm/tests/samples/zola-0.16.1.fedora.spec b/rust2rpm/tests/samples/zola-0.16.1.fedora.spec index bec670e..067fd23 100644 --- a/rust2rpm/tests/samples/zola-0.16.1.fedora.spec +++ b/rust2rpm/tests/samples/zola-0.16.1.fedora.spec @@ -13,8 +13,9 @@ License: # FIXME URL: # FIXME Source: # FIXME +Source: zola-0.16.1-vendor.tar.xz -BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: A fast static site generator with everything built-in.} @@ -22,16 +23,14 @@ A fast static site generator with everything built-in.} %description %{_description} %prep -%autosetup -n zola-%{version} -p1 -%cargo_prep - -%generate_buildrequires -%cargo_generate_buildrequires +%autosetup -n zola-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -45,6 +44,7 @@ A fast static site generator with everything built-in.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/zola diff --git a/rust2rpm/tests/samples/zola-0.16.1.mageia.spec b/rust2rpm/tests/samples/zola-0.16.1.mageia.spec index fecd972..b42db8c 100644 --- a/rust2rpm/tests/samples/zola-0.16.1.mageia.spec +++ b/rust2rpm/tests/samples/zola-0.16.1.mageia.spec @@ -14,104 +14,11 @@ License: # FIXME URL: # FIXME Source: # FIXME +Source: zola-0.16.1-vendor.tar.xz ExclusiveArch: %{rust_arches} -BuildRequires: cargo-rpm-macros >= 24 -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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: A fast static site generator with everything built-in.} @@ -119,13 +26,14 @@ A fast static site generator with everything built-in.} %description %{_description} %prep -%autosetup -n zola-%{version} -p1 -%cargo_prep +%autosetup -n zola-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -139,6 +47,7 @@ A fast static site generator with everything built-in.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/zola diff --git a/rust2rpm/tests/samples/zola-0.16.1.opensuse.spec b/rust2rpm/tests/samples/zola-0.16.1.opensuse.spec index d70c902..682f39d 100644 --- a/rust2rpm/tests/samples/zola-0.16.1.opensuse.spec +++ b/rust2rpm/tests/samples/zola-0.16.1.opensuse.spec @@ -31,104 +31,11 @@ License: # FIXME URL: # FIXME Source: # FIXME +Source: zola-0.16.1-vendor.tar.xz ExclusiveArch: %{rust_arches} -BuildRequires: cargo-rpm-macros >= 24 -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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: A fast static site generator with everything built-in.} @@ -136,13 +43,14 @@ A fast static site generator with everything built-in.} %description %{_description} %prep -%autosetup -n zola-%{version} -p1 -%cargo_prep +%autosetup -n zola-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -156,6 +64,7 @@ A fast static site generator with everything built-in.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/zola diff --git a/rust2rpm/tests/samples/zola-0.16.1.plain.spec b/rust2rpm/tests/samples/zola-0.16.1.plain.spec index cce4587..e659270 100644 --- a/rust2rpm/tests/samples/zola-0.16.1.plain.spec +++ b/rust2rpm/tests/samples/zola-0.16.1.plain.spec @@ -13,104 +13,11 @@ License: # FIXME URL: # FIXME Source: # FIXME +Source: zola-0.16.1-vendor.tar.xz ExclusiveArch: %{rust_arches} -BuildRequires: cargo-rpm-macros >= 24 -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 +BuildRequires: cargo-rpm-macros >= 25 %global _description %{expand: A fast static site generator with everything built-in.} @@ -118,13 +25,14 @@ A fast static site generator with everything built-in.} %description %{_description} %prep -%autosetup -n zola-%{version} -p1 -%cargo_prep +%autosetup -n zola-%{version} -p1 -a1 +%cargo_prep -v vendor %build %cargo_build %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies +%{cargo_vendor_manifest} %install %cargo_install @@ -138,6 +46,7 @@ A fast static site generator with everything built-in.} %license LIC1 %license LIC2 %license LICENSE.dependencies +%license cargo-vendor.txt %doc DOC1 %doc DOC2 %{_bindir}/zola diff --git a/rust2rpm/tests/test_generator.py b/rust2rpm/tests/test_generator.py index ab2e0c8..d7f13f5 100644 --- a/rust2rpm/tests/test_generator.py +++ b/rust2rpm/tests/test_generator.py @@ -64,6 +64,7 @@ def test_spec_file_render_crate(filename: str, conf: Optional[str], target: str) patch_file_manual=f"{crate}-patch2.diff", license_files=["LIC1", "LIC2"], doc_files=["DOC1", "DOC2"], + vendor_tarball=None, tomlconf=tomlconf, feature_flags=FeatureFlags(), relative_license_paths=False, @@ -91,9 +92,16 @@ def test_spec_file_render_crate(filename: str, conf: Optional[str], target: str) assert rendered == expected -@pytest.mark.parametrize("filename", ["rust2rpm-helper-0.1.3.json", "stgit-2.3.3.json"]) +@pytest.mark.parametrize( + "filename,vendor_tarball", + [ + ("rust2rpm-helper-0.1.3.json", None), + ("stgit-2.3.3.json", "stgit-vendor-2.3.3.tar.xz"), + ], + ids=repr, +) @pytest.mark.parametrize("target", ["plain", "fedora", "mageia", "opensuse"]) -def test_spec_file_render_project(filename: str, target: str): +def test_spec_file_render_project(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] @@ -110,6 +118,7 @@ def test_spec_file_render_project(filename: str, target: str): patch_file_manual=f"{crate}-patch2.diff", license_files=["LIC1", "LIC2"], doc_files=["DOC1", "DOC2"], + vendor_tarball=vendor_tarball, tomlconf=TomlConf(), feature_flags=FeatureFlags(), rpmautospec=target == "fedora", @@ -136,9 +145,15 @@ def test_spec_file_render_project(filename: str, target: str): assert rendered == expected -@pytest.mark.parametrize("filename", ["zola-0.16.1.json"]) +@pytest.mark.parametrize( + "filename,vendor_tarball", + [ + ("system76-keyboard-configurator-1.3.9.json", None), + ("zola-0.16.1.json", "zola-0.16.1-vendor.tar.xz"), + ], +) @pytest.mark.parametrize("target", ["plain", "fedora", "mageia", "opensuse"]) -def test_spec_file_render_workspace(filename: str, target: 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] @@ -152,6 +167,7 @@ def test_spec_file_render_workspace(filename: str, target: str): rpm_name=crate, license_files=["LIC1", "LIC2"], doc_files=["DOC1", "DOC2"], + vendor_tarball=vendor_tarball, tomlconf=TomlConf(), feature_flags=FeatureFlags(), rpmautospec=target == "fedora", diff --git a/rust2rpm/vendor.py b/rust2rpm/vendor.py new file mode 100644 index 0000000..6abbb34 --- /dev/null +++ b/rust2rpm/vendor.py @@ -0,0 +1,26 @@ +import shutil +import subprocess + +from rust2rpm import log + + +def generate_vendor_tarball(toml_path: str, project_name: str, project_version: str) -> str: + tarball_name = f"{project_name}-{project_version}-vendor.tar.xz" + + log.info("Generating vendor tarball ...") + + ret = subprocess.run( + ["cargo", "vendor", "--versioned-dirs", "--manifest-path", toml_path, "vendor/"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + ret.check_returncode() + + log.info("Compressing vendor tarball ...") + + ret = subprocess.run(["tar", "-cJvf", tarball_name, "vendor/"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ret.check_returncode() + + shutil.rmtree("vendor/") + + return tarball_name