From 80602add3dfe97e4af3a4d0c4ff2b8ba675ef390 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Jul 12 2022 08:46:57 +0000 Subject: Merge #200 `Add tests that actually test spec file generation` --- diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index 8ae8361..3f40d0a 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -15,29 +15,18 @@ import shutil import sys import tarfile import tempfile -import time import subprocess -import jinja2 import requests import tqdm -from . import Metadata, licensing, __version__ -from .metadata import normalize_deps +from . import Metadata, licensing, generator DEFAULT_EDITOR = "vi" XDG_CACHE_HOME = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")) CACHEDIR = os.path.join(XDG_CACHE_HOME, "rust2rpm") API_URL = "https://crates.io/api/v1/" DIST_GIT_URL = "https://src.fedoraproject.org/api/0/" -JINJA_ENV = jinja2.Environment( - loader=jinja2.ChoiceLoader([ - jinja2.FileSystemLoader(["/"]), - jinja2.PackageLoader("rust2rpm", "templates"), - ]), - extensions=["jinja2.ext.do"], - trim_blocks=True, - lstrip_blocks=True) LICENSES = re.compile(r""" COPYING(?:[.-].*)?|COPYRIGHT(?:[.-].*)?| EULA(?:[.-].*)?|[Ll]icen[cs]e|[Ll]icen[cs]e.*| @@ -333,10 +322,6 @@ def make_diff_metadata(args, crate, version): shutil.copy2(cratef, os.path.join(os.getcwd(), f"{metadata.name}-{version}.crate")) return crate, diff, metadata, doc_files, license_files -def to_list(s): - if not s: - return [] - return list(filter(None, (l.strip() for l in s.splitlines()))) def detect_rpmautospec(default_target, spec_file): """Guess whether %autorelease+%autochangelog should be used @@ -412,9 +397,7 @@ def exit_on_common_errors(): except FileNotFoundError as e: sys.exit(str(e)) - -@exit_on_common_errors() -def main(): +def get_parser(): default_target = get_default_target() parser = argparse.ArgumentParser("rust2rpm", @@ -461,6 +444,13 @@ def main(): "path/to/project/", nargs="?") parser.add_argument("version", nargs="?", help="crates.io version") + + return parser + + +@exit_on_common_errors() +def main(): + parser = get_parser() args = parser.parse_args() if args.show_license_map: @@ -481,34 +471,9 @@ def main(): crate, diff, metadata, doc_files, license_files = make_diff_metadata(args, args.crate, args.version) - JINJA_ENV.globals["normalize_deps"] = normalize_deps - JINJA_ENV.globals["to_list"] = to_list - template = JINJA_ENV.get_template("main.spec") - - if args.patch and len(diff) > 0: - patch_file = f"{metadata.name}-fix-metadata.diff" - else: - patch_file = None - - kwargs = {} - kwargs["generator_version"] = __version__ - kwargs["crate"] = crate - kwargs["target"] = args.target - - bins = [tgt for tgt in metadata.targets if tgt.kind == "bin"] - libs = [tgt for tgt in metadata.targets if tgt.kind in {"lib", "rlib", "proc-macro"}] - is_bin = len(bins) > 0 - is_lib = len(libs) > 0 - if is_bin: - kwargs["include_main"] = True - kwargs["bins"] = bins - elif is_lib: - kwargs["include_main"] = False - else: - raise ValueError("No bins and no libs") - kwargs["include_devel"] = is_lib + patch_file = f"{metadata.name}-fix-metadata.diff" if diff else None - kwargs["pkg_name"] = pkg_name = package_name_suffixed(metadata.name, args.suffix) + pkg_name = package_name_suffixed(metadata.name, args.suffix) spec_file = pathlib.Path(f"{pkg_name}.spec") if args.target in {"fedora"} and args.existence_check and not os.path.exists(spec_file): @@ -527,58 +492,13 @@ def main(): print("Re-run with --no-existence-check if you still want to start from scratch.") sys.exit(1) - kwargs["auto_changelog_entry"] = args.auto_changelog_entry - - rpmautospec = args.rpmautospec - if rpmautospec is None: - rpmautospec = detect_rpmautospec(args.target, spec_file) - kwargs["rpmautospec"] = rpmautospec - - kwargs["relative_license_paths"] = args.relative_license_paths - - if args.target in {"fedora", "mageia", "opensuse"}: - kwargs["include_build_requires"] = True - kwargs["include_provides"] = False - kwargs["include_requires"] = False - elif args.target == "plain": - kwargs["include_build_requires"] = True - kwargs["include_provides"] = True - kwargs["include_requires"] = True - else: - assert False, f"Unknown target {args.target!r}" - - if args.target == "mageia": - kwargs["pkg_release"] = "%mkrel 1" - kwargs["rust_group"] = "Development/Rust" - elif args.target == "opensuse": - kwargs["spec_copyright_year"] = time.strftime("%Y") - kwargs["pkg_release"] = "0" - kwargs["rust_group"] = "Development/Libraries/Rust" - elif rpmautospec: - kwargs["pkg_release"] = "%autorelease" - else: - kwargs["pkg_release"] = "1%{?dist}" + if args.rpmautospec is None: + args.rpmautospec = detect_rpmautospec(args.target, spec_file) if args.dynamic_buildrequires is None: args.dynamic_buildrequires = args.target == "fedora" - kwargs["generate_buildrequires"] = args.dynamic_buildrequires - - if args.target in {"opensuse"}: - kwargs["date"] = time.strftime("%a %b %d %T %Z %Y") - else: - kwargs["date"] = time.strftime("%a %b %d %Y") packager_identity = detect_packager() - if packager_identity is not None: - kwargs["packager"] = packager_identity - - if metadata.license is not None: - license, comments = licensing.translate_license(args.target, metadata.license) - kwargs["license"] = license - kwargs["license_comments"] = comments - - kwargs["doc_files"] = doc_files - kwargs["license_files"] = license_files conf = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation()) confs = conf.read([".rust2rpm.conf", "_rust2rpm.conf", "rust2rpm.conf"]) @@ -600,16 +520,24 @@ def main(): if args.target not in conf: conf.add_section(args.target) - kwargs["distconf"] = conf[args.target] - conf_all_features = conf[args.target].getboolean("all-features") - kwargs["all_features"] = conf_all_features or args.all_features - if conf_all_features is False and args.all_features: print("WARNING: Conflicting settings for enabling all features: The setting is \"false\"") print(" in rust2rpm.conf but it was enabled with the \"--all-features\" CLI flag.") - spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs) + spec_contents = generator.spec_file_render( + args = args, + pkg_name = pkg_name, + crate = crate, + metadata = metadata, + patch_file = patch_file, + packager_identity = packager_identity, + doc_files = doc_files, + license_files = license_files, + distconf = conf[args.target], + all_features = conf_all_features or args.all_features, + ) + if args.stdout: print(f"# {spec_file}") print(spec_contents) diff --git a/rust2rpm/generator.py b/rust2rpm/generator.py new file mode 100644 index 0000000..6d5d641 --- /dev/null +++ b/rust2rpm/generator.py @@ -0,0 +1,111 @@ +import time + +import jinja2 + +from . import __version__, metadata, licensing + +def to_list(s): + if not s: + return [] + return list(filter(None, (l.strip() for l in s.splitlines()))) + +def spec_file_template(): + env = jinja2.Environment( + loader=jinja2.ChoiceLoader([ + jinja2.FileSystemLoader(['/']), + jinja2.PackageLoader('rust2rpm', 'templates'), + ]), + extensions=['jinja2.ext.do'], + trim_blocks=True, + lstrip_blocks=True) + + env.globals['normalize_deps'] = metadata.normalize_deps + env.globals['to_list'] = to_list + + return env.get_template('main.spec') + +def spec_file_render( + args, + pkg_name, + crate, + metadata, + patch_file, + packager_identity, + doc_files, + license_files, + distconf, + all_features, + date=None, +): + template = spec_file_template() + + bins = [tgt for tgt in metadata.targets if tgt.kind == "bin"] + libs = [tgt for tgt in metadata.targets if tgt.kind in {"lib", "rlib", "proc-macro"}] + is_bin = len(bins) > 0 + is_lib = len(libs) > 0 + + kwargs = { + 'generator_version': __version__, + 'target': args.target, + 'crate': crate, + 'include_devel': is_lib, + 'pkg_name': pkg_name, + 'auto_changelog_entry': args.auto_changelog_entry, + 'rpmautospec': args.rpmautospec, + 'relative_license_paths': args.relative_license_paths, + 'generate_buildrequires': args.dynamic_buildrequires, + 'doc_files': doc_files, + 'license_files': license_files, + 'distconf': distconf, + 'all_features': all_features, + } + + if is_bin: + kwargs['include_main'] = True + kwargs['bins'] = bins + elif is_lib: + kwargs['include_main'] = False + else: + raise ValueError('No bins and no libs') + + if args.target in {'fedora', 'mageia', 'opensuse'}: + kwargs['include_build_requires'] = True + kwargs['include_provides'] = False + kwargs['include_requires'] = False + elif args.target == 'plain': + kwargs['include_build_requires'] = True + kwargs['include_provides'] = True + kwargs['include_requires'] = True + else: + assert False, f'Unknown target {args.target!r}' + + if args.target == 'mageia': + kwargs['pkg_release'] = '%mkrel 1' + kwargs['rust_group'] = 'Development/Rust' + elif args.target == 'opensuse': + kwargs['spec_copyright_year'] = time.strftime('%Y') + kwargs['pkg_release'] = '0' + kwargs['rust_group'] = 'Development/Libraries/Rust' + elif args.rpmautospec: + kwargs['pkg_release'] = '%autorelease' + else: + kwargs['pkg_release'] = '1%{?dist}' + + time_args = (['%a %b %d %T %Z %Y' if args.target in {'opensuse'} else '%a %b %d %Y'] + + ([date] if date else [])) + kwargs['date'] = time.strftime(*time_args) + + if packager_identity is not None: + kwargs['packager'] = packager_identity + + if metadata.license is not None: + license, comments = licensing.translate_license(args.target, metadata.license) + kwargs["license"] = license + kwargs["license_comments"] = comments + + spec_contents = template.render( + metadata=metadata, + patch_file=patch_file, + **kwargs) + '\n' + + return spec_contents diff --git a/rust2rpm/templates/fedora-changelog.spec.inc b/rust2rpm/templates/fedora-changelog.spec.inc index 5200a90..74994d2 100644 --- a/rust2rpm/templates/fedora-changelog.spec.inc +++ b/rust2rpm/templates/fedora-changelog.spec.inc @@ -1,2 +1,2 @@ -* {{ date }} {{ packager|default("rust2rpm ") }} - {{ md.version }}-1 +* {{ date }} {{ packager|default("rust2rpm ") }} - {{ metadata.version }}-1 - Initial package diff --git a/rust2rpm/templates/mageia-changelog.spec.inc b/rust2rpm/templates/mageia-changelog.spec.inc index 222813b..c803363 100644 --- a/rust2rpm/templates/mageia-changelog.spec.inc +++ b/rust2rpm/templates/mageia-changelog.spec.inc @@ -1,2 +1,2 @@ -* {{ date }} {{ packager|default("rust2rpm ") }} - {{ md.version }}-1 +* {{ date }} {{ packager|default("rust2rpm ") }} - {{ metadata.version }}-1 - Initial package diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec index ee69224..4f0c09b 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -8,24 +8,26 @@ {% set only_main = True %} {% endif %} -%global crate {{ md.name }} -{% if md.name != crate %} +%global crate {{ metadata.name }} +{% if metadata.name != crate %} %global real_crate {{ crate }} {% endif %} Name: {{ pkg_name }} -Version: {{ md.version }} +Version: {{ metadata.version }} Release: {{ pkg_release }} -{% if md.description is none %} +{% if metadata.description is none %} Summary: # FIXME {% else %} -Summary: {{ md.summary }} +Summary: {{ metadata.summary }} {% endif %} {% if rust_group is defined %} Group: {{ rust_group }} {% endif %} -# Upstream license specification: {{ md.license|default("(missing)") }} +{% if metadata.license != license %} +# Upstream license specification: {{ metadata.license|default("(missing)") }} +{% endif %} License: {{ license|default("# FIXME") }} {% if license_comments is not none %} {{ license_comments }} @@ -49,11 +51,11 @@ BuildRequires: rust-packaging >= 21 {% endif %} {% if not generate_buildrequires %} {% if not all_features %} - {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %} + {% set buildrequires = normalize_deps(metadata.requires("default", resolve=True))|sort %} {% else %} - {% set buildrequires = normalize_deps(md.all_dependencies)|sort %} + {% set buildrequires = normalize_deps(metadata.all_dependencies)|sort %} {% endif %} - {% set testrequires = normalize_deps(md.dev_dependencies)|sort %} + {% set testrequires = normalize_deps(metadata.dev_dependencies)|sort %} {% set has_buildrequires = (buildrequires + testrequires)|length > 0 %} {% if has_buildrequires and not only_main %} {% endif %} @@ -75,10 +77,10 @@ BuildRequires: {{ req }} {% endif %} %global _description %{expand: -{% if md.description is none %} +{% if metadata.description is none %} %{summary}. {%- else %} -{{ md.description|wordwrap }} +{{ metadata.description|wordwrap }} {%- endif %} } @@ -118,7 +120,7 @@ Requires: {{ req }} {% endif -%} {% if include_devel %} - {% set features = md.dependencies.keys()|list %} + {% set features = metadata.dependencies.keys()|list %} {% do features.remove(None) %} {% do features.remove("default") %} {% set features = features|sort %} @@ -142,11 +144,11 @@ Group: {{ rust_group }} {% endif %} BuildArch: noarch {% if include_provides %} -Provides: {{ md.provides(feature) }} +Provides: {{ metadata.provides(feature) }} {% endif %} {% if include_requires %} Requires: cargo - {% for req in normalize_deps(md.requires(feature))|map("string")|sort %} + {% for req in normalize_deps(metadata.requires(feature))|map("string")|sort %} Requires: {{ req }} {% endfor %} {% endif %} @@ -184,7 +186,7 @@ use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "% {% endif -%} %prep -{% if md.name != crate %} +{% if metadata.name != crate %} %autosetup -n %{real_crate}-%{version_no_tilde} -p1 {% else %} %autosetup -n %{crate}-%{version_no_tilde} -p1 diff --git a/rust2rpm/templates/opensuse-changelog.spec.inc b/rust2rpm/templates/opensuse-changelog.spec.inc index 8849edd..5b8b310 100644 --- a/rust2rpm/templates/opensuse-changelog.spec.inc +++ b/rust2rpm/templates/opensuse-changelog.spec.inc @@ -1,3 +1,3 @@ * {{ date }} {{ packager|default("rust2rpm ") }} -- Version {{ md.version }} +- Version {{ metadata.version }} - Initial package diff --git a/rust2rpm/templates/opensuse-header.spec.inc b/rust2rpm/templates/opensuse-header.spec.inc index b1e98be..87592dd 100644 --- a/rust2rpm/templates/opensuse-header.spec.inc +++ b/rust2rpm/templates/opensuse-header.spec.inc @@ -1,5 +1,5 @@ # -# spec file for package rust-{{ md.name }} +# spec file for package rust-{{ metadata.name }} # # Copyright (c) {{ spec_copyright_year }} {{ packager|default("SUSE LINUX GmbH, Nuernberg, Germany") }}. # diff --git a/rust2rpm/tests/samples/cxx-build-1.0.71.fedora.spec b/rust2rpm/tests/samples/cxx-build-1.0.71.fedora.spec new file mode 100644 index 0000000..5d80487 --- /dev/null +++ b/rust2rpm/tests/samples/cxx-build-1.0.71.fedora.spec @@ -0,0 +1,121 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate cxx-build +%global real_crate cxx-build-1.0.71 + +Name: rust-cxx-build-1.0.71 +Version: 1.0.71 +Release: %autorelease +Summary: C++ code generator for integrating `cxx` crate into a Cargo build + +License: MIT OR Apache-2.0 +URL: https://crates.io/crates/cxx-build-1.0.71 +Source: %{crates_source} +# Initial patched metadata +Patch: cxx-build-1.0.71-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(cc/default) >= 1.0.49 with crate(cc/default) < 2.0.0~) +BuildRequires: (crate(codespan-reporting/default) >= 0.11.0 with crate(codespan-reporting/default) < 0.12.0~) +BuildRequires: (crate(once_cell/default) >= 1.9.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(proc-macro2/span-locations) >= 1.0.39 with crate(proc-macro2/span-locations) < 2.0.0~) +BuildRequires: (crate(quote) >= 1.0.0 with crate(quote) < 2.0.0~) +BuildRequires: (crate(scratch/default) >= 1.0.0 with crate(scratch/default) < 2.0.0~) +BuildRequires: (crate(syn/clone-impls) >= 1.0.95 with crate(syn/clone-impls) < 2.0.0~) +BuildRequires: (crate(syn/full) >= 1.0.95 with crate(syn/full) < 2.0.0~) +BuildRequires: (crate(syn/parsing) >= 1.0.95 with crate(syn/parsing) < 2.0.0~) +BuildRequires: (crate(syn/printing) >= 1.0.95 with crate(syn/printing) < 2.0.0~) +%if %{with check} +BuildRequires: (crate(cxx-gen/default) >= 0.7.0 with crate(cxx-gen/default) < 0.8.0~) +BuildRequires: (crate(pkg-config/default) >= 0.3.0 with crate(pkg-config/default) < 0.4.0~) +%endif + +%global _description %{expand: +C++ code generator for integrating `cxx` crate into a Cargo build.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/cxx-build + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+experimental-async-fn-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+experimental-async-fn-devel %{_description} + +This package contains library source intended for building other packages which +use the "experimental-async-fn" feature of the "%{crate}" crate. + +%files -n %{name}+experimental-async-fn-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parallel-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+parallel-devel %{_description} + +This package contains library source intended for building other packages which +use the "parallel" feature of the "%{crate}" crate. + +%files -n %{name}+parallel-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rust2rpm/tests/samples/cxx-build-1.0.71.mageia.spec b/rust2rpm/tests/samples/cxx-build-1.0.71.mageia.spec new file mode 100644 index 0000000..41c830f --- /dev/null +++ b/rust2rpm/tests/samples/cxx-build-1.0.71.mageia.spec @@ -0,0 +1,129 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate cxx-build +%global real_crate cxx-build-1.0.71 + +Name: rust-cxx-build-1.0.71 +Version: 1.0.71 +Release: %mkrel 1 +Summary: C++ code generator for integrating `cxx` crate into a Cargo build +Group: Development/Rust + +# Upstream license specification: MIT OR Apache-2.0 +License: MIT or ASL 2.0 +URL: https://crates.io/crates/cxx-build-1.0.71 +Source: %{crates_source} +# Initial patched metadata +Patch: cxx-build-1.0.71-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(cc/default) >= 1.0.49 with crate(cc/default) < 2.0.0~) +BuildRequires: (crate(codespan-reporting/default) >= 0.11.0 with crate(codespan-reporting/default) < 0.12.0~) +BuildRequires: (crate(once_cell/default) >= 1.9.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(proc-macro2/span-locations) >= 1.0.39 with crate(proc-macro2/span-locations) < 2.0.0~) +BuildRequires: (crate(quote) >= 1.0.0 with crate(quote) < 2.0.0~) +BuildRequires: (crate(scratch/default) >= 1.0.0 with crate(scratch/default) < 2.0.0~) +BuildRequires: (crate(syn/clone-impls) >= 1.0.95 with crate(syn/clone-impls) < 2.0.0~) +BuildRequires: (crate(syn/full) >= 1.0.95 with crate(syn/full) < 2.0.0~) +BuildRequires: (crate(syn/parsing) >= 1.0.95 with crate(syn/parsing) < 2.0.0~) +BuildRequires: (crate(syn/printing) >= 1.0.95 with crate(syn/printing) < 2.0.0~) +%if %{with check} +BuildRequires: (crate(cxx-gen/default) >= 0.7.0 with crate(cxx-gen/default) < 0.8.0~) +BuildRequires: (crate(pkg-config/default) >= 0.3.0 with crate(pkg-config/default) < 0.4.0~) +%endif + +%global _description %{expand: +C++ code generator for integrating `cxx` crate into a Cargo build.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Group: # FIXME + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/cxx-build + +%package devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+experimental-async-fn-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+experimental-async-fn-devel %{_description} + +This package contains library source intended for building other packages which +use the "experimental-async-fn" feature of the "%{crate}" crate. + +%files -n %{name}+experimental-async-fn-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parallel-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+parallel-devel %{_description} + +This package contains library source intended for building other packages which +use the "parallel" feature of the "%{crate}" crate. + +%files -n %{name}+parallel-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 1970 Jane Jane - 1.0.71-1 +- Initial package diff --git a/rust2rpm/tests/samples/cxx-build-1.0.71.opensuse.spec b/rust2rpm/tests/samples/cxx-build-1.0.71.opensuse.spec new file mode 100644 index 0000000..63cc21f --- /dev/null +++ b/rust2rpm/tests/samples/cxx-build-1.0.71.opensuse.spec @@ -0,0 +1,146 @@ +# +# spec file for package rust-cxx-build +# +# Copyright (c) 2022 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 21 +%bcond_without check + +%global crate cxx-build +%global real_crate cxx-build-1.0.71 + +Name: rust-cxx-build-1.0.71 +Version: 1.0.71 +Release: 0 +Summary: C++ code generator for integrating `cxx` crate into a Cargo build +Group: Development/Libraries/Rust + +License: MIT OR Apache-2.0 +URL: https://crates.io/crates/cxx-build-1.0.71 +Source: %{crates_source} +# PATCH-FIX-OPENSUSE cxx-build-1.0.71-patch1.diff -- Initial patched metadata +Patch: cxx-build-1.0.71-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(cc/default) >= 1.0.49 with crate(cc/default) < 2.0.0~) +BuildRequires: (crate(codespan-reporting/default) >= 0.11.0 with crate(codespan-reporting/default) < 0.12.0~) +BuildRequires: (crate(once_cell/default) >= 1.9.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(proc-macro2/span-locations) >= 1.0.39 with crate(proc-macro2/span-locations) < 2.0.0~) +BuildRequires: (crate(quote) >= 1.0.0 with crate(quote) < 2.0.0~) +BuildRequires: (crate(scratch/default) >= 1.0.0 with crate(scratch/default) < 2.0.0~) +BuildRequires: (crate(syn/clone-impls) >= 1.0.95 with crate(syn/clone-impls) < 2.0.0~) +BuildRequires: (crate(syn/full) >= 1.0.95 with crate(syn/full) < 2.0.0~) +BuildRequires: (crate(syn/parsing) >= 1.0.95 with crate(syn/parsing) < 2.0.0~) +BuildRequires: (crate(syn/printing) >= 1.0.95 with crate(syn/printing) < 2.0.0~) +%if %{with check} +BuildRequires: (crate(cxx-gen/default) >= 0.7.0 with crate(cxx-gen/default) < 0.8.0~) +BuildRequires: (crate(pkg-config/default) >= 0.3.0 with crate(pkg-config/default) < 0.4.0~) +%endif + +%global _description %{expand: +C++ code generator for integrating `cxx` crate into a Cargo build.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Group: # FIXME + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/cxx-build + +%package devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+experimental-async-fn-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+experimental-async-fn-devel %{_description} + +This package contains library source intended for building other packages which +use the "experimental-async-fn" feature of the "%{crate}" crate. + +%files -n %{name}+experimental-async-fn-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parallel-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+parallel-devel %{_description} + +This package contains library source intended for building other packages which +use the "parallel" feature of the "%{crate}" crate. + +%files -n %{name}+parallel-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 03:25:45 GMT 1970 Jane Jane +- Version 1.0.71 +- Initial package diff --git a/rust2rpm/tests/samples/cxx-build-1.0.71.plain.spec b/rust2rpm/tests/samples/cxx-build-1.0.71.plain.spec new file mode 100644 index 0000000..3466690 --- /dev/null +++ b/rust2rpm/tests/samples/cxx-build-1.0.71.plain.spec @@ -0,0 +1,144 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate cxx-build +%global real_crate cxx-build-1.0.71 + +Name: rust-cxx-build-1.0.71 +Version: 1.0.71 +Release: 1%{?dist} +Summary: C++ code generator for integrating `cxx` crate into a Cargo build + +License: MIT OR Apache-2.0 +URL: https://crates.io/crates/cxx-build-1.0.71 +Source: %{crates_source} +# Initial patched metadata +Patch: cxx-build-1.0.71-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(cc/default) >= 1.0.49 with crate(cc/default) < 2.0.0~) +BuildRequires: (crate(codespan-reporting/default) >= 0.11.0 with crate(codespan-reporting/default) < 0.12.0~) +BuildRequires: (crate(once_cell/default) >= 1.9.0 with crate(once_cell/default) < 2.0.0~) +BuildRequires: (crate(proc-macro2/span-locations) >= 1.0.39 with crate(proc-macro2/span-locations) < 2.0.0~) +BuildRequires: (crate(quote) >= 1.0.0 with crate(quote) < 2.0.0~) +BuildRequires: (crate(scratch/default) >= 1.0.0 with crate(scratch/default) < 2.0.0~) +BuildRequires: (crate(syn/clone-impls) >= 1.0.95 with crate(syn/clone-impls) < 2.0.0~) +BuildRequires: (crate(syn/full) >= 1.0.95 with crate(syn/full) < 2.0.0~) +BuildRequires: (crate(syn/parsing) >= 1.0.95 with crate(syn/parsing) < 2.0.0~) +BuildRequires: (crate(syn/printing) >= 1.0.95 with crate(syn/printing) < 2.0.0~) +%if %{with check} +BuildRequires: (crate(cxx-gen/default) >= 0.7.0 with crate(cxx-gen/default) < 0.8.0~) +BuildRequires: (crate(pkg-config/default) >= 0.3.0 with crate(pkg-config/default) < 0.4.0~) +%endif + +%global _description %{expand: +C++ code generator for integrating `cxx` crate into a Cargo build.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/cxx-build + +%package devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(cxx-build) = 1.0.71 +Requires: cargo +Requires: (crate(cc/default) >= 1.0.49 with crate(cc/default) < 2.0.0~) +Requires: (crate(codespan-reporting/default) >= 0.11.0 with crate(codespan-reporting/default) < 0.12.0~) +Requires: (crate(once_cell/default) >= 1.9.0 with crate(once_cell/default) < 2.0.0~) +Requires: (crate(proc-macro2/span-locations) >= 1.0.39 with crate(proc-macro2/span-locations) < 2.0.0~) +Requires: (crate(quote) >= 1.0.0 with crate(quote) < 2.0.0~) +Requires: (crate(scratch/default) >= 1.0.0 with crate(scratch/default) < 2.0.0~) +Requires: (crate(syn/clone-impls) >= 1.0.95 with crate(syn/clone-impls) < 2.0.0~) +Requires: (crate(syn/full) >= 1.0.95 with crate(syn/full) < 2.0.0~) +Requires: (crate(syn/parsing) >= 1.0.95 with crate(syn/parsing) < 2.0.0~) +Requires: (crate(syn/printing) >= 1.0.95 with crate(syn/printing) < 2.0.0~) + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(cxx-build/default) = 1.0.71 +Requires: cargo +Requires: crate(cxx-build) = 1.0.71 + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+experimental-async-fn-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(cxx-build/experimental-async-fn) = 1.0.71 +Requires: cargo +Requires: crate(cxx-build) = 1.0.71 + +%description -n %{name}+experimental-async-fn-devel %{_description} + +This package contains library source intended for building other packages which +use the "experimental-async-fn" feature of the "%{crate}" crate. + +%files -n %{name}+experimental-async-fn-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parallel-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(cxx-build/parallel) = 1.0.71 +Requires: cargo +Requires: (crate(cc/parallel) >= 1.0.49 with crate(cc/parallel) < 2.0.0~) +Requires: crate(cxx-build) = 1.0.71 + +%description -n %{name}+parallel-devel %{_description} + +This package contains library source intended for building other packages which +use the "parallel" feature of the "%{crate}" crate. + +%files -n %{name}+parallel-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 1970 Jane Jane - 1.0.71-1 +- Initial package diff --git a/rust2rpm/tests/samples/cxx-build-1.0.71.toml b/rust2rpm/tests/samples/cxx-build-1.0.71.toml new file mode 100644 index 0000000..f3a7019 --- /dev/null +++ b/rust2rpm/tests/samples/cxx-build-1.0.71.toml @@ -0,0 +1,68 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2018" +rust-version = "1.48" +name = "cxx-build" +version = "1.0.71" +authors = ["David Tolnay "] +exclude = ["build.rs"] +description = "C++ code generator for integrating `cxx` crate into a Cargo build." +homepage = "https://cxx.rs" +keywords = ["ffi"] +categories = ["development-tools::ffi"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/dtolnay/cxx" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies.cc] +version = "1.0.49" + +[dependencies.codespan-reporting] +version = "0.11" + +[dependencies.once_cell] +version = "1.9" + +[dependencies.proc-macro2] +version = "1.0.39" +features = ["span-locations"] +default-features = false + +[dependencies.quote] +version = "1.0" +default-features = false + +[dependencies.scratch] +version = "1.0" + +[dependencies.syn] +version = "1.0.95" +features = [ + "parsing", + "printing", + "clone-impls", + "full", +] +default-features = false + +[dev-dependencies.cxx-gen] +version = "0.7" + +[dev-dependencies.pkg-config] +version = "0.3" + +[features] +experimental-async-fn = [] +parallel = ["cc/parallel"] diff --git a/rust2rpm/tests/samples/nix-0.24.1.fedora.spec b/rust2rpm/tests/samples/nix-0.24.1.fedora.spec new file mode 100644 index 0000000..eea1da3 --- /dev/null +++ b/rust2rpm/tests/samples/nix-0.24.1.fedora.spec @@ -0,0 +1,494 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate nix +%global real_crate nix-0.24.1 + +Name: rust-nix-0.24.1 +Version: 0.24.1 +Release: %autorelease +Summary: Rust friendly bindings to *nix APIs + +License: MIT +URL: https://crates.io/crates/nix-0.24.1 +Source: %{crates_source} +# Initial patched metadata +Patch: nix-0.24.1-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(bitflags/default) >= 1.1.0 with crate(bitflags/default) < 2.0.0~) +BuildRequires: (crate(cfg-if/default) >= 1.0.0 with crate(cfg-if/default) < 2.0.0~) +BuildRequires: (crate(libc/default) >= 0.2.121 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(libc/extra_traits) >= 0.2.121 with crate(libc/extra_traits) < 0.3.0~) +BuildRequires: (crate(memoffset/default) >= 0.6.3 with crate(memoffset/default) < 0.7.0~) +%if %{with check} +BuildRequires: (crate(assert-impl/default) >= 0.1.0 with crate(assert-impl/default) < 0.2.0~) +BuildRequires: (crate(caps/default) >= 0.5.1 with crate(caps/default) < 0.6.0~) +BuildRequires: (crate(lazy_static/default) >= 1.2.0 with crate(lazy_static/default) < 2.0.0~) +BuildRequires: (crate(parking_lot/default) >= 0.11.2 with crate(parking_lot/default) < 0.12.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(semver/default) >= 1.0.0 with crate(semver/default) < 2.0.0~) +BuildRequires: (crate(sysctl/default) >= 0.1.0 with crate(sysctl/default) < 0.2.0~) +BuildRequires: (crate(tempfile/default) >= 3.2.0 with crate(tempfile/default) < 4.0.0~) +%endif + +%global _description %{expand: +Rust friendly bindings to *nix APIs.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/nix + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+acct-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+acct-devel %{_description} + +This package contains library source intended for building other packages which +use the "acct" feature of the "%{crate}" crate. + +%files -n %{name}+acct-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+aio-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+aio-devel %{_description} + +This package contains library source intended for building other packages which +use the "aio" feature of the "%{crate}" crate. + +%files -n %{name}+aio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+dir-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+dir-devel %{_description} + +This package contains library source intended for building other packages which +use the "dir" feature of the "%{crate}" crate. + +%files -n %{name}+dir-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+env-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+env-devel %{_description} + +This package contains library source intended for building other packages which +use the "env" feature of the "%{crate}" crate. + +%files -n %{name}+env-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+event-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+event-devel %{_description} + +This package contains library source intended for building other packages which +use the "event" feature of the "%{crate}" crate. + +%files -n %{name}+event-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+feature-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+feature-devel %{_description} + +This package contains library source intended for building other packages which +use the "feature" feature of the "%{crate}" crate. + +%files -n %{name}+feature-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+hostname-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+hostname-devel %{_description} + +This package contains library source intended for building other packages which +use the "hostname" feature of the "%{crate}" crate. + +%files -n %{name}+hostname-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+inotify-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+inotify-devel %{_description} + +This package contains library source intended for building other packages which +use the "inotify" feature of the "%{crate}" crate. + +%files -n %{name}+inotify-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ioctl-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+ioctl-devel %{_description} + +This package contains library source intended for building other packages which +use the "ioctl" feature of the "%{crate}" crate. + +%files -n %{name}+ioctl-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+kmod-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+kmod-devel %{_description} + +This package contains library source intended for building other packages which +use the "kmod" feature of the "%{crate}" crate. + +%files -n %{name}+kmod-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memoffset-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+memoffset-devel %{_description} + +This package contains library source intended for building other packages which +use the "memoffset" feature of the "%{crate}" crate. + +%files -n %{name}+memoffset-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mman-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+mman-devel %{_description} + +This package contains library source intended for building other packages which +use the "mman" feature of the "%{crate}" crate. + +%files -n %{name}+mman-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mount-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+mount-devel %{_description} + +This package contains library source intended for building other packages which +use the "mount" feature of the "%{crate}" crate. + +%files -n %{name}+mount-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mqueue-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+mqueue-devel %{_description} + +This package contains library source intended for building other packages which +use the "mqueue" feature of the "%{crate}" crate. + +%files -n %{name}+mqueue-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+personality-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+personality-devel %{_description} + +This package contains library source intended for building other packages which +use the "personality" feature of the "%{crate}" crate. + +%files -n %{name}+personality-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+poll-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+poll-devel %{_description} + +This package contains library source intended for building other packages which +use the "poll" feature of the "%{crate}" crate. + +%files -n %{name}+poll-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+pthread-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+pthread-devel %{_description} + +This package contains library source intended for building other packages which +use the "pthread" feature of the "%{crate}" crate. + +%files -n %{name}+pthread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ptrace-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+ptrace-devel %{_description} + +This package contains library source intended for building other packages which +use the "ptrace" feature of the "%{crate}" crate. + +%files -n %{name}+ptrace-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+quota-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+quota-devel %{_description} + +This package contains library source intended for building other packages which +use the "quota" feature of the "%{crate}" crate. + +%files -n %{name}+quota-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+reboot-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+reboot-devel %{_description} + +This package contains library source intended for building other packages which +use the "reboot" feature of the "%{crate}" crate. + +%files -n %{name}+reboot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+resource-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+resource-devel %{_description} + +This package contains library source intended for building other packages which +use the "resource" feature of the "%{crate}" crate. + +%files -n %{name}+resource-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sched-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+sched-devel %{_description} + +This package contains library source intended for building other packages which +use the "sched" feature of the "%{crate}" crate. + +%files -n %{name}+sched-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+socket-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket" feature of the "%{crate}" crate. + +%files -n %{name}+socket-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+term-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+term-devel %{_description} + +This package contains library source intended for building other packages which +use the "term" feature of the "%{crate}" crate. + +%files -n %{name}+term-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ucontext-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+ucontext-devel %{_description} + +This package contains library source intended for building other packages which +use the "ucontext" feature of the "%{crate}" crate. + +%files -n %{name}+ucontext-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+uio-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+uio-devel %{_description} + +This package contains library source intended for building other packages which +use the "uio" feature of the "%{crate}" crate. + +%files -n %{name}+uio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+user-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+user-devel %{_description} + +This package contains library source intended for building other packages which +use the "user" feature of the "%{crate}" crate. + +%files -n %{name}+user-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+zerocopy-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+zerocopy-devel %{_description} + +This package contains library source intended for building other packages which +use the "zerocopy" feature of the "%{crate}" crate. + +%files -n %{name}+zerocopy-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rust2rpm/tests/samples/nix-0.24.1.mageia.spec b/rust2rpm/tests/samples/nix-0.24.1.mageia.spec new file mode 100644 index 0000000..f72fe57 --- /dev/null +++ b/rust2rpm/tests/samples/nix-0.24.1.mageia.spec @@ -0,0 +1,532 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate nix +%global real_crate nix-0.24.1 + +Name: rust-nix-0.24.1 +Version: 0.24.1 +Release: %mkrel 1 +Summary: Rust friendly bindings to *nix APIs +Group: Development/Rust + +License: MIT +URL: https://crates.io/crates/nix-0.24.1 +Source: %{crates_source} +# Initial patched metadata +Patch: nix-0.24.1-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(bitflags/default) >= 1.1.0 with crate(bitflags/default) < 2.0.0~) +BuildRequires: (crate(cfg-if/default) >= 1.0.0 with crate(cfg-if/default) < 2.0.0~) +BuildRequires: (crate(libc/default) >= 0.2.121 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(libc/extra_traits) >= 0.2.121 with crate(libc/extra_traits) < 0.3.0~) +BuildRequires: (crate(memoffset/default) >= 0.6.3 with crate(memoffset/default) < 0.7.0~) +%if %{with check} +BuildRequires: (crate(assert-impl/default) >= 0.1.0 with crate(assert-impl/default) < 0.2.0~) +BuildRequires: (crate(caps/default) >= 0.5.1 with crate(caps/default) < 0.6.0~) +BuildRequires: (crate(lazy_static/default) >= 1.2.0 with crate(lazy_static/default) < 2.0.0~) +BuildRequires: (crate(parking_lot/default) >= 0.11.2 with crate(parking_lot/default) < 0.12.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(semver/default) >= 1.0.0 with crate(semver/default) < 2.0.0~) +BuildRequires: (crate(sysctl/default) >= 0.1.0 with crate(sysctl/default) < 0.2.0~) +BuildRequires: (crate(tempfile/default) >= 3.2.0 with crate(tempfile/default) < 4.0.0~) +%endif + +%global _description %{expand: +Rust friendly bindings to *nix APIs.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Group: # FIXME + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/nix + +%package devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+acct-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+acct-devel %{_description} + +This package contains library source intended for building other packages which +use the "acct" feature of the "%{crate}" crate. + +%files -n %{name}+acct-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+aio-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+aio-devel %{_description} + +This package contains library source intended for building other packages which +use the "aio" feature of the "%{crate}" crate. + +%files -n %{name}+aio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+dir-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+dir-devel %{_description} + +This package contains library source intended for building other packages which +use the "dir" feature of the "%{crate}" crate. + +%files -n %{name}+dir-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+env-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+env-devel %{_description} + +This package contains library source intended for building other packages which +use the "env" feature of the "%{crate}" crate. + +%files -n %{name}+env-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+event-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+event-devel %{_description} + +This package contains library source intended for building other packages which +use the "event" feature of the "%{crate}" crate. + +%files -n %{name}+event-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+feature-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+feature-devel %{_description} + +This package contains library source intended for building other packages which +use the "feature" feature of the "%{crate}" crate. + +%files -n %{name}+feature-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+hostname-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+hostname-devel %{_description} + +This package contains library source intended for building other packages which +use the "hostname" feature of the "%{crate}" crate. + +%files -n %{name}+hostname-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+inotify-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+inotify-devel %{_description} + +This package contains library source intended for building other packages which +use the "inotify" feature of the "%{crate}" crate. + +%files -n %{name}+inotify-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ioctl-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+ioctl-devel %{_description} + +This package contains library source intended for building other packages which +use the "ioctl" feature of the "%{crate}" crate. + +%files -n %{name}+ioctl-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+kmod-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+kmod-devel %{_description} + +This package contains library source intended for building other packages which +use the "kmod" feature of the "%{crate}" crate. + +%files -n %{name}+kmod-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memoffset-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+memoffset-devel %{_description} + +This package contains library source intended for building other packages which +use the "memoffset" feature of the "%{crate}" crate. + +%files -n %{name}+memoffset-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mman-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+mman-devel %{_description} + +This package contains library source intended for building other packages which +use the "mman" feature of the "%{crate}" crate. + +%files -n %{name}+mman-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mount-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+mount-devel %{_description} + +This package contains library source intended for building other packages which +use the "mount" feature of the "%{crate}" crate. + +%files -n %{name}+mount-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mqueue-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+mqueue-devel %{_description} + +This package contains library source intended for building other packages which +use the "mqueue" feature of the "%{crate}" crate. + +%files -n %{name}+mqueue-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+personality-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+personality-devel %{_description} + +This package contains library source intended for building other packages which +use the "personality" feature of the "%{crate}" crate. + +%files -n %{name}+personality-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+poll-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+poll-devel %{_description} + +This package contains library source intended for building other packages which +use the "poll" feature of the "%{crate}" crate. + +%files -n %{name}+poll-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+pthread-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+pthread-devel %{_description} + +This package contains library source intended for building other packages which +use the "pthread" feature of the "%{crate}" crate. + +%files -n %{name}+pthread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ptrace-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+ptrace-devel %{_description} + +This package contains library source intended for building other packages which +use the "ptrace" feature of the "%{crate}" crate. + +%files -n %{name}+ptrace-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+quota-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+quota-devel %{_description} + +This package contains library source intended for building other packages which +use the "quota" feature of the "%{crate}" crate. + +%files -n %{name}+quota-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+reboot-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+reboot-devel %{_description} + +This package contains library source intended for building other packages which +use the "reboot" feature of the "%{crate}" crate. + +%files -n %{name}+reboot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+resource-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+resource-devel %{_description} + +This package contains library source intended for building other packages which +use the "resource" feature of the "%{crate}" crate. + +%files -n %{name}+resource-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sched-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+sched-devel %{_description} + +This package contains library source intended for building other packages which +use the "sched" feature of the "%{crate}" crate. + +%files -n %{name}+sched-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+socket-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket" feature of the "%{crate}" crate. + +%files -n %{name}+socket-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+term-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+term-devel %{_description} + +This package contains library source intended for building other packages which +use the "term" feature of the "%{crate}" crate. + +%files -n %{name}+term-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ucontext-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+ucontext-devel %{_description} + +This package contains library source intended for building other packages which +use the "ucontext" feature of the "%{crate}" crate. + +%files -n %{name}+ucontext-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+uio-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+uio-devel %{_description} + +This package contains library source intended for building other packages which +use the "uio" feature of the "%{crate}" crate. + +%files -n %{name}+uio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+user-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+user-devel %{_description} + +This package contains library source intended for building other packages which +use the "user" feature of the "%{crate}" crate. + +%files -n %{name}+user-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+zerocopy-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+zerocopy-devel %{_description} + +This package contains library source intended for building other packages which +use the "zerocopy" feature of the "%{crate}" crate. + +%files -n %{name}+zerocopy-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 1970 Jane Jane - 0.24.1-1 +- Initial package diff --git a/rust2rpm/tests/samples/nix-0.24.1.opensuse.spec b/rust2rpm/tests/samples/nix-0.24.1.opensuse.spec new file mode 100644 index 0000000..fbfca43 --- /dev/null +++ b/rust2rpm/tests/samples/nix-0.24.1.opensuse.spec @@ -0,0 +1,550 @@ +# +# spec file for package rust-nix +# +# Copyright (c) 2022 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 21 +%bcond_without check + +%global crate nix +%global real_crate nix-0.24.1 + +Name: rust-nix-0.24.1 +Version: 0.24.1 +Release: 0 +Summary: Rust friendly bindings to *nix APIs +Group: Development/Libraries/Rust + +License: MIT +URL: https://crates.io/crates/nix-0.24.1 +Source: %{crates_source} +# PATCH-FIX-OPENSUSE nix-0.24.1-patch1.diff -- Initial patched metadata +Patch: nix-0.24.1-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(bitflags/default) >= 1.1.0 with crate(bitflags/default) < 2.0.0~) +BuildRequires: (crate(cfg-if/default) >= 1.0.0 with crate(cfg-if/default) < 2.0.0~) +BuildRequires: (crate(libc/default) >= 0.2.121 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(libc/extra_traits) >= 0.2.121 with crate(libc/extra_traits) < 0.3.0~) +BuildRequires: (crate(memoffset/default) >= 0.6.3 with crate(memoffset/default) < 0.7.0~) +%if %{with check} +BuildRequires: (crate(assert-impl/default) >= 0.1.0 with crate(assert-impl/default) < 0.2.0~) +BuildRequires: (crate(caps/default) >= 0.5.1 with crate(caps/default) < 0.6.0~) +BuildRequires: (crate(lazy_static/default) >= 1.2.0 with crate(lazy_static/default) < 2.0.0~) +BuildRequires: (crate(parking_lot/default) >= 0.11.2 with crate(parking_lot/default) < 0.12.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(semver/default) >= 1.0.0 with crate(semver/default) < 2.0.0~) +BuildRequires: (crate(sysctl/default) >= 0.1.0 with crate(sysctl/default) < 0.2.0~) +BuildRequires: (crate(tempfile/default) >= 3.2.0 with crate(tempfile/default) < 4.0.0~) +%endif + +%global _description %{expand: +Rust friendly bindings to *nix APIs.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Group: # FIXME + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/nix + +%package devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+acct-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+acct-devel %{_description} + +This package contains library source intended for building other packages which +use the "acct" feature of the "%{crate}" crate. + +%files -n %{name}+acct-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+aio-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+aio-devel %{_description} + +This package contains library source intended for building other packages which +use the "aio" feature of the "%{crate}" crate. + +%files -n %{name}+aio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+dir-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+dir-devel %{_description} + +This package contains library source intended for building other packages which +use the "dir" feature of the "%{crate}" crate. + +%files -n %{name}+dir-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+env-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+env-devel %{_description} + +This package contains library source intended for building other packages which +use the "env" feature of the "%{crate}" crate. + +%files -n %{name}+env-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+event-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+event-devel %{_description} + +This package contains library source intended for building other packages which +use the "event" feature of the "%{crate}" crate. + +%files -n %{name}+event-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+feature-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+feature-devel %{_description} + +This package contains library source intended for building other packages which +use the "feature" feature of the "%{crate}" crate. + +%files -n %{name}+feature-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+hostname-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+hostname-devel %{_description} + +This package contains library source intended for building other packages which +use the "hostname" feature of the "%{crate}" crate. + +%files -n %{name}+hostname-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+inotify-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+inotify-devel %{_description} + +This package contains library source intended for building other packages which +use the "inotify" feature of the "%{crate}" crate. + +%files -n %{name}+inotify-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ioctl-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+ioctl-devel %{_description} + +This package contains library source intended for building other packages which +use the "ioctl" feature of the "%{crate}" crate. + +%files -n %{name}+ioctl-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+kmod-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+kmod-devel %{_description} + +This package contains library source intended for building other packages which +use the "kmod" feature of the "%{crate}" crate. + +%files -n %{name}+kmod-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memoffset-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+memoffset-devel %{_description} + +This package contains library source intended for building other packages which +use the "memoffset" feature of the "%{crate}" crate. + +%files -n %{name}+memoffset-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mman-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+mman-devel %{_description} + +This package contains library source intended for building other packages which +use the "mman" feature of the "%{crate}" crate. + +%files -n %{name}+mman-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mount-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+mount-devel %{_description} + +This package contains library source intended for building other packages which +use the "mount" feature of the "%{crate}" crate. + +%files -n %{name}+mount-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mqueue-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+mqueue-devel %{_description} + +This package contains library source intended for building other packages which +use the "mqueue" feature of the "%{crate}" crate. + +%files -n %{name}+mqueue-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+personality-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+personality-devel %{_description} + +This package contains library source intended for building other packages which +use the "personality" feature of the "%{crate}" crate. + +%files -n %{name}+personality-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+poll-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+poll-devel %{_description} + +This package contains library source intended for building other packages which +use the "poll" feature of the "%{crate}" crate. + +%files -n %{name}+poll-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+pthread-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+pthread-devel %{_description} + +This package contains library source intended for building other packages which +use the "pthread" feature of the "%{crate}" crate. + +%files -n %{name}+pthread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ptrace-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+ptrace-devel %{_description} + +This package contains library source intended for building other packages which +use the "ptrace" feature of the "%{crate}" crate. + +%files -n %{name}+ptrace-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+quota-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+quota-devel %{_description} + +This package contains library source intended for building other packages which +use the "quota" feature of the "%{crate}" crate. + +%files -n %{name}+quota-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+reboot-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+reboot-devel %{_description} + +This package contains library source intended for building other packages which +use the "reboot" feature of the "%{crate}" crate. + +%files -n %{name}+reboot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+resource-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+resource-devel %{_description} + +This package contains library source intended for building other packages which +use the "resource" feature of the "%{crate}" crate. + +%files -n %{name}+resource-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sched-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+sched-devel %{_description} + +This package contains library source intended for building other packages which +use the "sched" feature of the "%{crate}" crate. + +%files -n %{name}+sched-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+socket-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket" feature of the "%{crate}" crate. + +%files -n %{name}+socket-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+term-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+term-devel %{_description} + +This package contains library source intended for building other packages which +use the "term" feature of the "%{crate}" crate. + +%files -n %{name}+term-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ucontext-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+ucontext-devel %{_description} + +This package contains library source intended for building other packages which +use the "ucontext" feature of the "%{crate}" crate. + +%files -n %{name}+ucontext-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+uio-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+uio-devel %{_description} + +This package contains library source intended for building other packages which +use the "uio" feature of the "%{crate}" crate. + +%files -n %{name}+uio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+user-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+user-devel %{_description} + +This package contains library source intended for building other packages which +use the "user" feature of the "%{crate}" crate. + +%files -n %{name}+user-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+zerocopy-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+zerocopy-devel %{_description} + +This package contains library source intended for building other packages which +use the "zerocopy" feature of the "%{crate}" crate. + +%files -n %{name}+zerocopy-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 03:25:45 GMT 1970 Jane Jane +- Version 0.24.1 +- Initial package diff --git a/rust2rpm/tests/samples/nix-0.24.1.plain.spec b/rust2rpm/tests/samples/nix-0.24.1.plain.spec new file mode 100644 index 0000000..d8950ea --- /dev/null +++ b/rust2rpm/tests/samples/nix-0.24.1.plain.spec @@ -0,0 +1,648 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate nix +%global real_crate nix-0.24.1 + +Name: rust-nix-0.24.1 +Version: 0.24.1 +Release: 1%{?dist} +Summary: Rust friendly bindings to *nix APIs + +License: MIT +URL: https://crates.io/crates/nix-0.24.1 +Source: %{crates_source} +# Initial patched metadata +Patch: nix-0.24.1-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(bitflags/default) >= 1.1.0 with crate(bitflags/default) < 2.0.0~) +BuildRequires: (crate(cfg-if/default) >= 1.0.0 with crate(cfg-if/default) < 2.0.0~) +BuildRequires: (crate(libc/default) >= 0.2.121 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(libc/extra_traits) >= 0.2.121 with crate(libc/extra_traits) < 0.3.0~) +BuildRequires: (crate(memoffset/default) >= 0.6.3 with crate(memoffset/default) < 0.7.0~) +%if %{with check} +BuildRequires: (crate(assert-impl/default) >= 0.1.0 with crate(assert-impl/default) < 0.2.0~) +BuildRequires: (crate(caps/default) >= 0.5.1 with crate(caps/default) < 0.6.0~) +BuildRequires: (crate(lazy_static/default) >= 1.2.0 with crate(lazy_static/default) < 2.0.0~) +BuildRequires: (crate(parking_lot/default) >= 0.11.2 with crate(parking_lot/default) < 0.12.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(semver/default) >= 1.0.0 with crate(semver/default) < 2.0.0~) +BuildRequires: (crate(sysctl/default) >= 0.1.0 with crate(sysctl/default) < 0.2.0~) +BuildRequires: (crate(tempfile/default) >= 3.2.0 with crate(tempfile/default) < 4.0.0~) +%endif + +%global _description %{expand: +Rust friendly bindings to *nix APIs.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/nix + +%package devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix) = 0.24.1 +Requires: cargo +Requires: (crate(bitflags/default) >= 1.1.0 with crate(bitflags/default) < 2.0.0~) +Requires: (crate(cfg-if/default) >= 1.0.0 with crate(cfg-if/default) < 2.0.0~) +Requires: (crate(libc/default) >= 0.2.121 with crate(libc/default) < 0.3.0~) +Requires: (crate(libc/extra_traits) >= 0.2.121 with crate(libc/extra_traits) < 0.3.0~) + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/default) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/acct) = 0.24.1 +Requires: crate(nix/aio) = 0.24.1 +Requires: crate(nix/dir) = 0.24.1 +Requires: crate(nix/env) = 0.24.1 +Requires: crate(nix/event) = 0.24.1 +Requires: crate(nix/feature) = 0.24.1 +Requires: crate(nix/fs) = 0.24.1 +Requires: crate(nix/hostname) = 0.24.1 +Requires: crate(nix/inotify) = 0.24.1 +Requires: crate(nix/ioctl) = 0.24.1 +Requires: crate(nix/kmod) = 0.24.1 +Requires: crate(nix/mman) = 0.24.1 +Requires: crate(nix/mount) = 0.24.1 +Requires: crate(nix/mqueue) = 0.24.1 +Requires: crate(nix/net) = 0.24.1 +Requires: crate(nix/personality) = 0.24.1 +Requires: crate(nix/poll) = 0.24.1 +Requires: crate(nix/process) = 0.24.1 +Requires: crate(nix/pthread) = 0.24.1 +Requires: crate(nix/ptrace) = 0.24.1 +Requires: crate(nix/quota) = 0.24.1 +Requires: crate(nix/reboot) = 0.24.1 +Requires: crate(nix/resource) = 0.24.1 +Requires: crate(nix/sched) = 0.24.1 +Requires: crate(nix/signal) = 0.24.1 +Requires: crate(nix/socket) = 0.24.1 +Requires: crate(nix/term) = 0.24.1 +Requires: crate(nix/time) = 0.24.1 +Requires: crate(nix/ucontext) = 0.24.1 +Requires: crate(nix/uio) = 0.24.1 +Requires: crate(nix/user) = 0.24.1 +Requires: crate(nix/zerocopy) = 0.24.1 + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+acct-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/acct) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+acct-devel %{_description} + +This package contains library source intended for building other packages which +use the "acct" feature of the "%{crate}" crate. + +%files -n %{name}+acct-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+aio-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/aio) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+aio-devel %{_description} + +This package contains library source intended for building other packages which +use the "aio" feature of the "%{crate}" crate. + +%files -n %{name}+aio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+dir-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/dir) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/fs) = 0.24.1 + +%description -n %{name}+dir-devel %{_description} + +This package contains library source intended for building other packages which +use the "dir" feature of the "%{crate}" crate. + +%files -n %{name}+dir-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+env-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/env) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+env-devel %{_description} + +This package contains library source intended for building other packages which +use the "env" feature of the "%{crate}" crate. + +%files -n %{name}+env-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+event-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/event) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+event-devel %{_description} + +This package contains library source intended for building other packages which +use the "event" feature of the "%{crate}" crate. + +%files -n %{name}+event-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+feature-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/feature) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+feature-devel %{_description} + +This package contains library source intended for building other packages which +use the "feature" feature of the "%{crate}" crate. + +%files -n %{name}+feature-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/fs) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+hostname-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/hostname) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+hostname-devel %{_description} + +This package contains library source intended for building other packages which +use the "hostname" feature of the "%{crate}" crate. + +%files -n %{name}+hostname-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+inotify-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/inotify) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+inotify-devel %{_description} + +This package contains library source intended for building other packages which +use the "inotify" feature of the "%{crate}" crate. + +%files -n %{name}+inotify-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ioctl-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/ioctl) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+ioctl-devel %{_description} + +This package contains library source intended for building other packages which +use the "ioctl" feature of the "%{crate}" crate. + +%files -n %{name}+ioctl-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+kmod-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/kmod) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+kmod-devel %{_description} + +This package contains library source intended for building other packages which +use the "kmod" feature of the "%{crate}" crate. + +%files -n %{name}+kmod-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memoffset-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/memoffset) = 0.24.1 +Requires: cargo +Requires: (crate(memoffset/default) >= 0.6.3 with crate(memoffset/default) < 0.7.0~) +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+memoffset-devel %{_description} + +This package contains library source intended for building other packages which +use the "memoffset" feature of the "%{crate}" crate. + +%files -n %{name}+memoffset-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mman-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/mman) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+mman-devel %{_description} + +This package contains library source intended for building other packages which +use the "mman" feature of the "%{crate}" crate. + +%files -n %{name}+mman-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mount-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/mount) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/uio) = 0.24.1 + +%description -n %{name}+mount-devel %{_description} + +This package contains library source intended for building other packages which +use the "mount" feature of the "%{crate}" crate. + +%files -n %{name}+mount-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mqueue-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/mqueue) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/fs) = 0.24.1 + +%description -n %{name}+mqueue-devel %{_description} + +This package contains library source intended for building other packages which +use the "mqueue" feature of the "%{crate}" crate. + +%files -n %{name}+mqueue-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/net) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/socket) = 0.24.1 + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+personality-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/personality) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+personality-devel %{_description} + +This package contains library source intended for building other packages which +use the "personality" feature of the "%{crate}" crate. + +%files -n %{name}+personality-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+poll-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/poll) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+poll-devel %{_description} + +This package contains library source intended for building other packages which +use the "poll" feature of the "%{crate}" crate. + +%files -n %{name}+poll-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/process) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+pthread-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/pthread) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+pthread-devel %{_description} + +This package contains library source intended for building other packages which +use the "pthread" feature of the "%{crate}" crate. + +%files -n %{name}+pthread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ptrace-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/ptrace) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/process) = 0.24.1 + +%description -n %{name}+ptrace-devel %{_description} + +This package contains library source intended for building other packages which +use the "ptrace" feature of the "%{crate}" crate. + +%files -n %{name}+ptrace-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+quota-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/quota) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+quota-devel %{_description} + +This package contains library source intended for building other packages which +use the "quota" feature of the "%{crate}" crate. + +%files -n %{name}+quota-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+reboot-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/reboot) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+reboot-devel %{_description} + +This package contains library source intended for building other packages which +use the "reboot" feature of the "%{crate}" crate. + +%files -n %{name}+reboot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+resource-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/resource) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+resource-devel %{_description} + +This package contains library source intended for building other packages which +use the "resource" feature of the "%{crate}" crate. + +%files -n %{name}+resource-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sched-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/sched) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/process) = 0.24.1 + +%description -n %{name}+sched-devel %{_description} + +This package contains library source intended for building other packages which +use the "sched" feature of the "%{crate}" crate. + +%files -n %{name}+sched-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/signal) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/process) = 0.24.1 + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/socket) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/memoffset) = 0.24.1 + +%description -n %{name}+socket-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket" feature of the "%{crate}" crate. + +%files -n %{name}+socket-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+term-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/term) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+term-devel %{_description} + +This package contains library source intended for building other packages which +use the "term" feature of the "%{crate}" crate. + +%files -n %{name}+term-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/time) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+ucontext-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/ucontext) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/signal) = 0.24.1 + +%description -n %{name}+ucontext-devel %{_description} + +This package contains library source intended for building other packages which +use the "ucontext" feature of the "%{crate}" crate. + +%files -n %{name}+ucontext-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+uio-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/uio) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 + +%description -n %{name}+uio-devel %{_description} + +This package contains library source intended for building other packages which +use the "uio" feature of the "%{crate}" crate. + +%files -n %{name}+uio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+user-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/user) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/feature) = 0.24.1 + +%description -n %{name}+user-devel %{_description} + +This package contains library source intended for building other packages which +use the "user" feature of the "%{crate}" crate. + +%files -n %{name}+user-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+zerocopy-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(nix/zerocopy) = 0.24.1 +Requires: cargo +Requires: crate(nix) = 0.24.1 +Requires: crate(nix/fs) = 0.24.1 +Requires: crate(nix/uio) = 0.24.1 + +%description -n %{name}+zerocopy-devel %{_description} + +This package contains library source intended for building other packages which +use the "zerocopy" feature of the "%{crate}" crate. + +%files -n %{name}+zerocopy-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 1970 Jane Jane - 0.24.1-1 +- Initial package diff --git a/rust2rpm/tests/samples/nix-0.24.1.toml b/rust2rpm/tests/samples/nix-0.24.1.toml new file mode 100644 index 0000000..fb4afc8 --- /dev/null +++ b/rust2rpm/tests/samples/nix-0.24.1.toml @@ -0,0 +1,182 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2018" +rust-version = "1.46" +name = "nix" +version = "0.24.1" +authors = ["The nix-rust Project Developers"] +include = [ + "src/**/*", + "test/**/*", + "LICENSE", + "README.md", + "CHANGELOG.md", +] +description = "Rust friendly bindings to *nix APIs" +readme = "README.md" +categories = ["os::unix-apis"] +license = "MIT" +repository = "https://github.com/nix-rust/nix" + +[package.metadata.docs.rs] +rustdoc-args = [ + "--cfg", + "docsrs", +] +targets = [ + "x86_64-unknown-linux-gnu", + "aarch64-linux-android", + "x86_64-apple-darwin", + "aarch64-apple-ios", + "x86_64-unknown-freebsd", + "x86_64-unknown-openbsd", + "x86_64-unknown-netbsd", + "x86_64-unknown-dragonfly", + "x86_64-fuchsia", + "x86_64-unknown-redox", + "x86_64-unknown-illumos", +] + +[[test]] +name = "test" +path = "test/test.rs" + +[[test]] +name = "test-aio-drop" +path = "test/sys/test_aio_drop.rs" + +[[test]] +name = "test-clearenv" +path = "test/test_clearenv.rs" + +[[test]] +name = "test-lio-listio-resubmit" +path = "test/sys/test_lio_listio_resubmit.rs" + +[[test]] +name = "test-mount" +path = "test/test_mount.rs" +harness = false + +[[test]] +name = "test-ptymaster-drop" +path = "test/test_ptymaster_drop.rs" + +[dependencies.bitflags] +version = "1.1" + +[dependencies.cfg-if] +version = "1.0" + +[dependencies.libc] +version = "0.2.121" +features = ["extra_traits"] + +[dev-dependencies.assert-impl] +version = "0.1" + +[dev-dependencies.lazy_static] +version = "1.2" + +[dev-dependencies.parking_lot] +version = "0.11.2" + +[dev-dependencies.rand] +version = "0.8" + +[dev-dependencies.semver] +version = "1.0.0" + +[dev-dependencies.tempfile] +version = "3.2.0" + +[features] +acct = [] +aio = [] +default = [ + "acct", + "aio", + "dir", + "env", + "event", + "feature", + "fs", + "hostname", + "inotify", + "ioctl", + "kmod", + "mman", + "mount", + "mqueue", + "net", + "personality", + "poll", + "process", + "pthread", + "ptrace", + "quota", + "reboot", + "resource", + "sched", + "signal", + "socket", + "term", + "time", + "ucontext", + "uio", + "user", + "zerocopy", +] +dir = ["fs"] +env = [] +event = [] +feature = [] +fs = [] +hostname = [] +inotify = [] +ioctl = [] +kmod = [] +mman = [] +mount = ["uio"] +mqueue = ["fs"] +net = ["socket"] +personality = [] +poll = [] +process = [] +pthread = [] +ptrace = ["process"] +quota = [] +reboot = [] +resource = [] +sched = ["process"] +signal = ["process"] +socket = ["memoffset"] +term = [] +time = [] +ucontext = ["signal"] +uio = [] +user = ["feature"] +zerocopy = [ + "fs", + "uio", +] + +[target."cfg(any(target_os = \"android\", target_os = \"linux\"))".dev-dependencies.caps] +version = "0.5.1" + +[target."cfg(not(target_os = \"redox\"))".dependencies.memoffset] +version = "0.6.3" +optional = true + +[target."cfg(target_os = \"freebsd\")".dev-dependencies.sysctl] +version = "0.1" diff --git a/rust2rpm/tests/samples/tokio-1.19.2.fedora.spec b/rust2rpm/tests/samples/tokio-1.19.2.fedora.spec new file mode 100644 index 0000000..9cb33f6 --- /dev/null +++ b/rust2rpm/tests/samples/tokio-1.19.2.fedora.spec @@ -0,0 +1,419 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate tokio +%global real_crate tokio-1.19.2 + +Name: rust-tokio-1.19.2 +Version: 1.19.2 +Release: %autorelease +Summary: Event-driven, non-blocking I/O platform for writing asynchronous I/O + +License: MIT +URL: https://crates.io/crates/tokio-1.19.2 +Source: %{crates_source} +# Initial patched metadata +Patch: tokio-1.19.2-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~) +%if %{with check} +BuildRequires: (crate(async-stream/default) >= 0.3.0 with crate(async-stream/default) < 0.4.0~) +BuildRequires: (crate(futures/async-await) >= 0.3.0 with crate(futures/async-await) < 0.4.0~) +BuildRequires: (crate(futures/default) >= 0.3.0 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(loom/checkpoint) >= 0.5.2 with crate(loom/checkpoint) < 0.6.0~) +BuildRequires: (crate(loom/default) >= 0.5.2 with crate(loom/default) < 0.6.0~) +BuildRequires: (crate(loom/futures) >= 0.5.2 with crate(loom/futures) < 0.6.0~) +BuildRequires: (crate(mio-aio/default) >= 0.6.0 with crate(mio-aio/default) < 0.7.0~) +BuildRequires: (crate(mio-aio/tokio) >= 0.6.0 with crate(mio-aio/tokio) < 0.7.0~) +BuildRequires: (crate(mockall/default) >= 0.11.1 with crate(mockall/default) < 0.12.0~) +BuildRequires: (crate(nix/fs) >= 0.24.0 with crate(nix/fs) < 0.25.0~) +BuildRequires: (crate(nix/socket) >= 0.24.0 with crate(nix/socket) < 0.25.0~) +BuildRequires: (crate(ntapi/default) >= 0.3.6 with crate(ntapi/default) < 0.4.0~) +BuildRequires: (crate(proptest/default) >= 1.0.0 with crate(proptest/default) < 2.0.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(socket2/default) >= 0.4.0 with crate(socket2/default) < 0.5.0~) +BuildRequires: (crate(tempfile/default) >= 3.1.0 with crate(tempfile/default) < 4.0.0~) +BuildRequires: (crate(tokio-stream/default) >= 0.1.0 with crate(tokio-stream/default) < 0.2.0~) +BuildRequires: (crate(tokio-test/default) >= 0.4.0 with crate(tokio-test/default) < 0.5.0~) +BuildRequires: (crate(wasm-bindgen-test/default) >= 0.3.0 with crate(wasm-bindgen-test/default) < 0.4.0~) +%endif + +%global _description %{expand: +Event-driven, non-blocking I/O platform for writing asynchronous I/O +backed applications.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/tokio + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+bytes-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+bytes-devel %{_description} + +This package contains library source intended for building other packages which +use the "bytes" feature of the "%{crate}" crate. + +%files -n %{name}+bytes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+full-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+full-devel %{_description} + +This package contains library source intended for building other packages which +use the "full" feature of the "%{crate}" crate. + +%files -n %{name}+full-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-std-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+io-std-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-std" feature of the "%{crate}" crate. + +%files -n %{name}+io-std-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-util-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+io-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-util" feature of the "%{crate}" crate. + +%files -n %{name}+io-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+libc-devel %{_description} + +This package contains library source intended for building other packages which +use the "libc" feature of the "%{crate}" crate. + +%files -n %{name}+libc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+macros-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "macros" feature of the "%{crate}" crate. + +%files -n %{name}+macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memchr-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+memchr-devel %{_description} + +This package contains library source intended for building other packages which +use the "memchr" feature of the "%{crate}" crate. + +%files -n %{name}+memchr-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mio-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+mio-devel %{_description} + +This package contains library source intended for building other packages which +use the "mio" feature of the "%{crate}" crate. + +%files -n %{name}+mio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+num_cpus-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+num_cpus-devel %{_description} + +This package contains library source intended for building other packages which +use the "num_cpus" feature of the "%{crate}" crate. + +%files -n %{name}+num_cpus-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+once_cell-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+once_cell-devel %{_description} + +This package contains library source intended for building other packages which +use the "once_cell" feature of the "%{crate}" crate. + +%files -n %{name}+once_cell-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parking_lot-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+parking_lot-devel %{_description} + +This package contains library source intended for building other packages which +use the "parking_lot" feature of the "%{crate}" crate. + +%files -n %{name}+parking_lot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+rt-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt" feature of the "%{crate}" crate. + +%files -n %{name}+rt-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-multi-thread-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+rt-multi-thread-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt-multi-thread" feature of the "%{crate}" crate. + +%files -n %{name}+rt-multi-thread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-hook-registry-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+signal-hook-registry-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal-hook-registry" feature of the "%{crate}" crate. + +%files -n %{name}+signal-hook-registry-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket2-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+socket2-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket2" feature of the "%{crate}" crate. + +%files -n %{name}+socket2-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+stats-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+stats-devel %{_description} + +This package contains library source intended for building other packages which +use the "stats" feature of the "%{crate}" crate. + +%files -n %{name}+stats-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sync-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+sync-devel %{_description} + +This package contains library source intended for building other packages which +use the "sync" feature of the "%{crate}" crate. + +%files -n %{name}+sync-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+test-util-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+test-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "test-util" feature of the "%{crate}" crate. + +%files -n %{name}+test-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tokio-macros-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+tokio-macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "tokio-macros" feature of the "%{crate}" crate. + +%files -n %{name}+tokio-macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tracing-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+tracing-devel %{_description} + +This package contains library source intended for building other packages which +use the "tracing" feature of the "%{crate}" crate. + +%files -n %{name}+tracing-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+winapi-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+winapi-devel %{_description} + +This package contains library source intended for building other packages which +use the "winapi" feature of the "%{crate}" crate. + +%files -n %{name}+winapi-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/rust2rpm/tests/samples/tokio-1.19.2.mageia.spec b/rust2rpm/tests/samples/tokio-1.19.2.mageia.spec new file mode 100644 index 0000000..099a229 --- /dev/null +++ b/rust2rpm/tests/samples/tokio-1.19.2.mageia.spec @@ -0,0 +1,450 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate tokio +%global real_crate tokio-1.19.2 + +Name: rust-tokio-1.19.2 +Version: 1.19.2 +Release: %mkrel 1 +Summary: Event-driven, non-blocking I/O platform for writing asynchronous I/O +Group: Development/Rust + +License: MIT +URL: https://crates.io/crates/tokio-1.19.2 +Source: %{crates_source} +# Initial patched metadata +Patch: tokio-1.19.2-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~) +%if %{with check} +BuildRequires: (crate(async-stream/default) >= 0.3.0 with crate(async-stream/default) < 0.4.0~) +BuildRequires: (crate(futures/async-await) >= 0.3.0 with crate(futures/async-await) < 0.4.0~) +BuildRequires: (crate(futures/default) >= 0.3.0 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(loom/checkpoint) >= 0.5.2 with crate(loom/checkpoint) < 0.6.0~) +BuildRequires: (crate(loom/default) >= 0.5.2 with crate(loom/default) < 0.6.0~) +BuildRequires: (crate(loom/futures) >= 0.5.2 with crate(loom/futures) < 0.6.0~) +BuildRequires: (crate(mio-aio/default) >= 0.6.0 with crate(mio-aio/default) < 0.7.0~) +BuildRequires: (crate(mio-aio/tokio) >= 0.6.0 with crate(mio-aio/tokio) < 0.7.0~) +BuildRequires: (crate(mockall/default) >= 0.11.1 with crate(mockall/default) < 0.12.0~) +BuildRequires: (crate(nix/fs) >= 0.24.0 with crate(nix/fs) < 0.25.0~) +BuildRequires: (crate(nix/socket) >= 0.24.0 with crate(nix/socket) < 0.25.0~) +BuildRequires: (crate(ntapi/default) >= 0.3.6 with crate(ntapi/default) < 0.4.0~) +BuildRequires: (crate(proptest/default) >= 1.0.0 with crate(proptest/default) < 2.0.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(socket2/default) >= 0.4.0 with crate(socket2/default) < 0.5.0~) +BuildRequires: (crate(tempfile/default) >= 3.1.0 with crate(tempfile/default) < 4.0.0~) +BuildRequires: (crate(tokio-stream/default) >= 0.1.0 with crate(tokio-stream/default) < 0.2.0~) +BuildRequires: (crate(tokio-test/default) >= 0.4.0 with crate(tokio-test/default) < 0.5.0~) +BuildRequires: (crate(wasm-bindgen-test/default) >= 0.3.0 with crate(wasm-bindgen-test/default) < 0.4.0~) +%endif + +%global _description %{expand: +Event-driven, non-blocking I/O platform for writing asynchronous I/O +backed applications.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Group: # FIXME + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/tokio + +%package devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+bytes-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+bytes-devel %{_description} + +This package contains library source intended for building other packages which +use the "bytes" feature of the "%{crate}" crate. + +%files -n %{name}+bytes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+full-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+full-devel %{_description} + +This package contains library source intended for building other packages which +use the "full" feature of the "%{crate}" crate. + +%files -n %{name}+full-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-std-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+io-std-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-std" feature of the "%{crate}" crate. + +%files -n %{name}+io-std-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-util-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+io-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-util" feature of the "%{crate}" crate. + +%files -n %{name}+io-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libc-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+libc-devel %{_description} + +This package contains library source intended for building other packages which +use the "libc" feature of the "%{crate}" crate. + +%files -n %{name}+libc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+macros-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "macros" feature of the "%{crate}" crate. + +%files -n %{name}+macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memchr-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+memchr-devel %{_description} + +This package contains library source intended for building other packages which +use the "memchr" feature of the "%{crate}" crate. + +%files -n %{name}+memchr-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mio-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+mio-devel %{_description} + +This package contains library source intended for building other packages which +use the "mio" feature of the "%{crate}" crate. + +%files -n %{name}+mio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+num_cpus-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+num_cpus-devel %{_description} + +This package contains library source intended for building other packages which +use the "num_cpus" feature of the "%{crate}" crate. + +%files -n %{name}+num_cpus-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+once_cell-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+once_cell-devel %{_description} + +This package contains library source intended for building other packages which +use the "once_cell" feature of the "%{crate}" crate. + +%files -n %{name}+once_cell-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parking_lot-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+parking_lot-devel %{_description} + +This package contains library source intended for building other packages which +use the "parking_lot" feature of the "%{crate}" crate. + +%files -n %{name}+parking_lot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+rt-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt" feature of the "%{crate}" crate. + +%files -n %{name}+rt-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-multi-thread-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+rt-multi-thread-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt-multi-thread" feature of the "%{crate}" crate. + +%files -n %{name}+rt-multi-thread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-hook-registry-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+signal-hook-registry-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal-hook-registry" feature of the "%{crate}" crate. + +%files -n %{name}+signal-hook-registry-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket2-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+socket2-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket2" feature of the "%{crate}" crate. + +%files -n %{name}+socket2-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+stats-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+stats-devel %{_description} + +This package contains library source intended for building other packages which +use the "stats" feature of the "%{crate}" crate. + +%files -n %{name}+stats-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sync-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+sync-devel %{_description} + +This package contains library source intended for building other packages which +use the "sync" feature of the "%{crate}" crate. + +%files -n %{name}+sync-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+test-util-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+test-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "test-util" feature of the "%{crate}" crate. + +%files -n %{name}+test-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tokio-macros-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+tokio-macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "tokio-macros" feature of the "%{crate}" crate. + +%files -n %{name}+tokio-macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tracing-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+tracing-devel %{_description} + +This package contains library source intended for building other packages which +use the "tracing" feature of the "%{crate}" crate. + +%files -n %{name}+tracing-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+winapi-devel +Summary: %{summary} +Group: Development/Rust +BuildArch: noarch + +%description -n %{name}+winapi-devel %{_description} + +This package contains library source intended for building other packages which +use the "winapi" feature of the "%{crate}" crate. + +%files -n %{name}+winapi-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 1970 Jane Jane - 1.19.2-1 +- Initial package diff --git a/rust2rpm/tests/samples/tokio-1.19.2.opensuse.spec b/rust2rpm/tests/samples/tokio-1.19.2.opensuse.spec new file mode 100644 index 0000000..48678dc --- /dev/null +++ b/rust2rpm/tests/samples/tokio-1.19.2.opensuse.spec @@ -0,0 +1,468 @@ +# +# spec file for package rust-tokio +# +# Copyright (c) 2022 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 21 +%bcond_without check + +%global crate tokio +%global real_crate tokio-1.19.2 + +Name: rust-tokio-1.19.2 +Version: 1.19.2 +Release: 0 +Summary: Event-driven, non-blocking I/O platform for writing asynchronous I/O +Group: Development/Libraries/Rust + +License: MIT +URL: https://crates.io/crates/tokio-1.19.2 +Source: %{crates_source} +# PATCH-FIX-OPENSUSE tokio-1.19.2-patch1.diff -- Initial patched metadata +Patch: tokio-1.19.2-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~) +%if %{with check} +BuildRequires: (crate(async-stream/default) >= 0.3.0 with crate(async-stream/default) < 0.4.0~) +BuildRequires: (crate(futures/async-await) >= 0.3.0 with crate(futures/async-await) < 0.4.0~) +BuildRequires: (crate(futures/default) >= 0.3.0 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(loom/checkpoint) >= 0.5.2 with crate(loom/checkpoint) < 0.6.0~) +BuildRequires: (crate(loom/default) >= 0.5.2 with crate(loom/default) < 0.6.0~) +BuildRequires: (crate(loom/futures) >= 0.5.2 with crate(loom/futures) < 0.6.0~) +BuildRequires: (crate(mio-aio/default) >= 0.6.0 with crate(mio-aio/default) < 0.7.0~) +BuildRequires: (crate(mio-aio/tokio) >= 0.6.0 with crate(mio-aio/tokio) < 0.7.0~) +BuildRequires: (crate(mockall/default) >= 0.11.1 with crate(mockall/default) < 0.12.0~) +BuildRequires: (crate(nix/fs) >= 0.24.0 with crate(nix/fs) < 0.25.0~) +BuildRequires: (crate(nix/socket) >= 0.24.0 with crate(nix/socket) < 0.25.0~) +BuildRequires: (crate(ntapi/default) >= 0.3.6 with crate(ntapi/default) < 0.4.0~) +BuildRequires: (crate(proptest/default) >= 1.0.0 with crate(proptest/default) < 2.0.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(socket2/default) >= 0.4.0 with crate(socket2/default) < 0.5.0~) +BuildRequires: (crate(tempfile/default) >= 3.1.0 with crate(tempfile/default) < 4.0.0~) +BuildRequires: (crate(tokio-stream/default) >= 0.1.0 with crate(tokio-stream/default) < 0.2.0~) +BuildRequires: (crate(tokio-test/default) >= 0.4.0 with crate(tokio-test/default) < 0.5.0~) +BuildRequires: (crate(wasm-bindgen-test/default) >= 0.3.0 with crate(wasm-bindgen-test/default) < 0.4.0~) +%endif + +%global _description %{expand: +Event-driven, non-blocking I/O platform for writing asynchronous I/O +backed applications.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Group: # FIXME + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/tokio + +%package devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+bytes-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+bytes-devel %{_description} + +This package contains library source intended for building other packages which +use the "bytes" feature of the "%{crate}" crate. + +%files -n %{name}+bytes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+full-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+full-devel %{_description} + +This package contains library source intended for building other packages which +use the "full" feature of the "%{crate}" crate. + +%files -n %{name}+full-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-std-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+io-std-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-std" feature of the "%{crate}" crate. + +%files -n %{name}+io-std-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-util-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+io-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-util" feature of the "%{crate}" crate. + +%files -n %{name}+io-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libc-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+libc-devel %{_description} + +This package contains library source intended for building other packages which +use the "libc" feature of the "%{crate}" crate. + +%files -n %{name}+libc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+macros-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "macros" feature of the "%{crate}" crate. + +%files -n %{name}+macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memchr-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+memchr-devel %{_description} + +This package contains library source intended for building other packages which +use the "memchr" feature of the "%{crate}" crate. + +%files -n %{name}+memchr-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mio-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+mio-devel %{_description} + +This package contains library source intended for building other packages which +use the "mio" feature of the "%{crate}" crate. + +%files -n %{name}+mio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+num_cpus-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+num_cpus-devel %{_description} + +This package contains library source intended for building other packages which +use the "num_cpus" feature of the "%{crate}" crate. + +%files -n %{name}+num_cpus-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+once_cell-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+once_cell-devel %{_description} + +This package contains library source intended for building other packages which +use the "once_cell" feature of the "%{crate}" crate. + +%files -n %{name}+once_cell-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parking_lot-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+parking_lot-devel %{_description} + +This package contains library source intended for building other packages which +use the "parking_lot" feature of the "%{crate}" crate. + +%files -n %{name}+parking_lot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+rt-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt" feature of the "%{crate}" crate. + +%files -n %{name}+rt-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-multi-thread-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+rt-multi-thread-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt-multi-thread" feature of the "%{crate}" crate. + +%files -n %{name}+rt-multi-thread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-hook-registry-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+signal-hook-registry-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal-hook-registry" feature of the "%{crate}" crate. + +%files -n %{name}+signal-hook-registry-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket2-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+socket2-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket2" feature of the "%{crate}" crate. + +%files -n %{name}+socket2-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+stats-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+stats-devel %{_description} + +This package contains library source intended for building other packages which +use the "stats" feature of the "%{crate}" crate. + +%files -n %{name}+stats-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sync-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+sync-devel %{_description} + +This package contains library source intended for building other packages which +use the "sync" feature of the "%{crate}" crate. + +%files -n %{name}+sync-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+test-util-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+test-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "test-util" feature of the "%{crate}" crate. + +%files -n %{name}+test-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tokio-macros-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+tokio-macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "tokio-macros" feature of the "%{crate}" crate. + +%files -n %{name}+tokio-macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tracing-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+tracing-devel %{_description} + +This package contains library source intended for building other packages which +use the "tracing" feature of the "%{crate}" crate. + +%files -n %{name}+tracing-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+winapi-devel +Summary: %{summary} +Group: Development/Libraries/Rust +BuildArch: noarch + +%description -n %{name}+winapi-devel %{_description} + +This package contains library source intended for building other packages which +use the "winapi" feature of the "%{crate}" crate. + +%files -n %{name}+winapi-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 03:25:45 GMT 1970 Jane Jane +- Version 1.19.2 +- Initial package diff --git a/rust2rpm/tests/samples/tokio-1.19.2.plain.spec b/rust2rpm/tests/samples/tokio-1.19.2.plain.spec new file mode 100644 index 0000000..8e3141c --- /dev/null +++ b/rust2rpm/tests/samples/tokio-1.19.2.plain.spec @@ -0,0 +1,564 @@ +# Generated by rust2rpm NNN +%bcond_without check + +%global crate tokio +%global real_crate tokio-1.19.2 + +Name: rust-tokio-1.19.2 +Version: 1.19.2 +Release: 1%{?dist} +Summary: Event-driven, non-blocking I/O platform for writing asynchronous I/O + +License: MIT +URL: https://crates.io/crates/tokio-1.19.2 +Source: %{crates_source} +# Initial patched metadata +Patch: tokio-1.19.2-patch1.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging >= 21 +BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~) +%if %{with check} +BuildRequires: (crate(async-stream/default) >= 0.3.0 with crate(async-stream/default) < 0.4.0~) +BuildRequires: (crate(futures/async-await) >= 0.3.0 with crate(futures/async-await) < 0.4.0~) +BuildRequires: (crate(futures/default) >= 0.3.0 with crate(futures/default) < 0.4.0~) +BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~) +BuildRequires: (crate(loom/checkpoint) >= 0.5.2 with crate(loom/checkpoint) < 0.6.0~) +BuildRequires: (crate(loom/default) >= 0.5.2 with crate(loom/default) < 0.6.0~) +BuildRequires: (crate(loom/futures) >= 0.5.2 with crate(loom/futures) < 0.6.0~) +BuildRequires: (crate(mio-aio/default) >= 0.6.0 with crate(mio-aio/default) < 0.7.0~) +BuildRequires: (crate(mio-aio/tokio) >= 0.6.0 with crate(mio-aio/tokio) < 0.7.0~) +BuildRequires: (crate(mockall/default) >= 0.11.1 with crate(mockall/default) < 0.12.0~) +BuildRequires: (crate(nix/fs) >= 0.24.0 with crate(nix/fs) < 0.25.0~) +BuildRequires: (crate(nix/socket) >= 0.24.0 with crate(nix/socket) < 0.25.0~) +BuildRequires: (crate(ntapi/default) >= 0.3.6 with crate(ntapi/default) < 0.4.0~) +BuildRequires: (crate(proptest/default) >= 1.0.0 with crate(proptest/default) < 2.0.0~) +BuildRequires: (crate(rand/default) >= 0.8.0 with crate(rand/default) < 0.9.0~) +BuildRequires: (crate(socket2/default) >= 0.4.0 with crate(socket2/default) < 0.5.0~) +BuildRequires: (crate(tempfile/default) >= 3.1.0 with crate(tempfile/default) < 4.0.0~) +BuildRequires: (crate(tokio-stream/default) >= 0.1.0 with crate(tokio-stream/default) < 0.2.0~) +BuildRequires: (crate(tokio-test/default) >= 0.4.0 with crate(tokio-test/default) < 0.5.0~) +BuildRequires: (crate(wasm-bindgen-test/default) >= 0.3.0 with crate(wasm-bindgen-test/default) < 0.4.0~) +%endif + +%global _description %{expand: +Event-driven, non-blocking I/O platform for writing asynchronous I/O +backed applications.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LIC1 +%license LIC2 +%doc DOC1 +%doc DOC2 +%{_bindir}/tokio + +%package devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio) = 1.19.2 +Requires: cargo +Requires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~) + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LIC1 +%license %{crate_instdir}/LIC2 +%doc %{crate_instdir}/DOC1 +%doc %{crate_instdir}/DOC2 +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/default) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+bytes-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/bytes) = 1.19.2 +Requires: cargo +Requires: (crate(bytes/default) >= 1.0.0 with crate(bytes/default) < 2.0.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+bytes-devel %{_description} + +This package contains library source intended for building other packages which +use the "bytes" feature of the "%{crate}" crate. + +%files -n %{name}+bytes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+fs-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/fs) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+fs-devel %{_description} + +This package contains library source intended for building other packages which +use the "fs" feature of the "%{crate}" crate. + +%files -n %{name}+fs-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+full-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/full) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/fs) = 1.19.2 +Requires: crate(tokio/io-std) = 1.19.2 +Requires: crate(tokio/io-util) = 1.19.2 +Requires: crate(tokio/macros) = 1.19.2 +Requires: crate(tokio/net) = 1.19.2 +Requires: crate(tokio/parking_lot) = 1.19.2 +Requires: crate(tokio/process) = 1.19.2 +Requires: crate(tokio/rt) = 1.19.2 +Requires: crate(tokio/rt-multi-thread) = 1.19.2 +Requires: crate(tokio/signal) = 1.19.2 +Requires: crate(tokio/sync) = 1.19.2 +Requires: crate(tokio/time) = 1.19.2 + +%description -n %{name}+full-devel %{_description} + +This package contains library source intended for building other packages which +use the "full" feature of the "%{crate}" crate. + +%files -n %{name}+full-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-std-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/io-std) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+io-std-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-std" feature of the "%{crate}" crate. + +%files -n %{name}+io-std-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+io-util-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/io-util) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/bytes) = 1.19.2 +Requires: crate(tokio/memchr) = 1.19.2 + +%description -n %{name}+io-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "io-util" feature of the "%{crate}" crate. + +%files -n %{name}+io-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+libc-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/libc) = 1.19.2 +Requires: cargo +Requires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+libc-devel %{_description} + +This package contains library source intended for building other packages which +use the "libc" feature of the "%{crate}" crate. + +%files -n %{name}+libc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+macros-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/macros) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/tokio-macros) = 1.19.2 + +%description -n %{name}+macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "macros" feature of the "%{crate}" crate. + +%files -n %{name}+macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+memchr-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/memchr) = 1.19.2 +Requires: cargo +Requires: (crate(memchr/default) >= 2.2.0 with crate(memchr/default) < 3.0.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+memchr-devel %{_description} + +This package contains library source intended for building other packages which +use the "memchr" feature of the "%{crate}" crate. + +%files -n %{name}+memchr-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+mio-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/mio) = 1.19.2 +Requires: cargo +Requires: (crate(mio/default) >= 0.8.1 with crate(mio/default) < 0.9.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+mio-devel %{_description} + +This package contains library source intended for building other packages which +use the "mio" feature of the "%{crate}" crate. + +%files -n %{name}+mio-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+net-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/net) = 1.19.2 +Requires: cargo +Requires: (crate(mio/net) >= 0.8.1 with crate(mio/net) < 0.9.0~) +Requires: (crate(mio/os-ext) >= 0.8.1 with crate(mio/os-ext) < 0.9.0~) +Requires: (crate(mio/os-poll) >= 0.8.1 with crate(mio/os-poll) < 0.9.0~) +Requires: (crate(winapi/namedpipeapi) >= 0.3.8 with crate(winapi/namedpipeapi) < 0.4.0~) +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/libc) = 1.19.2 +Requires: crate(tokio/socket2) = 1.19.2 + +%description -n %{name}+net-devel %{_description} + +This package contains library source intended for building other packages which +use the "net" feature of the "%{crate}" crate. + +%files -n %{name}+net-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+num_cpus-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/num_cpus) = 1.19.2 +Requires: cargo +Requires: (crate(num_cpus/default) >= 1.8.0 with crate(num_cpus/default) < 2.0.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+num_cpus-devel %{_description} + +This package contains library source intended for building other packages which +use the "num_cpus" feature of the "%{crate}" crate. + +%files -n %{name}+num_cpus-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+once_cell-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/once_cell) = 1.19.2 +Requires: cargo +Requires: (crate(once_cell/default) >= 1.5.2 with crate(once_cell/default) < 2.0.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+once_cell-devel %{_description} + +This package contains library source intended for building other packages which +use the "once_cell" feature of the "%{crate}" crate. + +%files -n %{name}+once_cell-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+parking_lot-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/parking_lot) = 1.19.2 +Requires: cargo +Requires: (crate(parking_lot/default) >= 0.12.0 with crate(parking_lot/default) < 0.13.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+parking_lot-devel %{_description} + +This package contains library source intended for building other packages which +use the "parking_lot" feature of the "%{crate}" crate. + +%files -n %{name}+parking_lot-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+process-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/process) = 1.19.2 +Requires: cargo +Requires: (crate(mio/net) >= 0.8.1 with crate(mio/net) < 0.9.0~) +Requires: (crate(mio/os-ext) >= 0.8.1 with crate(mio/os-ext) < 0.9.0~) +Requires: (crate(mio/os-poll) >= 0.8.1 with crate(mio/os-poll) < 0.9.0~) +Requires: (crate(winapi/threadpoollegacyapiset) >= 0.3.8 with crate(winapi/threadpoollegacyapiset) < 0.4.0~) +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/bytes) = 1.19.2 +Requires: crate(tokio/libc) = 1.19.2 +Requires: crate(tokio/once_cell) = 1.19.2 +Requires: crate(tokio/signal-hook-registry) = 1.19.2 + +%description -n %{name}+process-devel %{_description} + +This package contains library source intended for building other packages which +use the "process" feature of the "%{crate}" crate. + +%files -n %{name}+process-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/rt) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/once_cell) = 1.19.2 + +%description -n %{name}+rt-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt" feature of the "%{crate}" crate. + +%files -n %{name}+rt-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+rt-multi-thread-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/rt-multi-thread) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/num_cpus) = 1.19.2 +Requires: crate(tokio/rt) = 1.19.2 + +%description -n %{name}+rt-multi-thread-devel %{_description} + +This package contains library source intended for building other packages which +use the "rt-multi-thread" feature of the "%{crate}" crate. + +%files -n %{name}+rt-multi-thread-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/signal) = 1.19.2 +Requires: cargo +Requires: (crate(mio/net) >= 0.8.1 with crate(mio/net) < 0.9.0~) +Requires: (crate(mio/os-ext) >= 0.8.1 with crate(mio/os-ext) < 0.9.0~) +Requires: (crate(mio/os-poll) >= 0.8.1 with crate(mio/os-poll) < 0.9.0~) +Requires: (crate(winapi/consoleapi) >= 0.3.8 with crate(winapi/consoleapi) < 0.4.0~) +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/libc) = 1.19.2 +Requires: crate(tokio/once_cell) = 1.19.2 +Requires: crate(tokio/signal-hook-registry) = 1.19.2 + +%description -n %{name}+signal-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal" feature of the "%{crate}" crate. + +%files -n %{name}+signal-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+signal-hook-registry-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/signal-hook-registry) = 1.19.2 +Requires: cargo +Requires: (crate(signal-hook-registry/default) >= 1.1.1 with crate(signal-hook-registry/default) < 2.0.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+signal-hook-registry-devel %{_description} + +This package contains library source intended for building other packages which +use the "signal-hook-registry" feature of the "%{crate}" crate. + +%files -n %{name}+signal-hook-registry-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+socket2-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/socket2) = 1.19.2 +Requires: cargo +Requires: (crate(socket2/all) >= 0.4.4 with crate(socket2/all) < 0.5.0~) +Requires: (crate(socket2/default) >= 0.4.4 with crate(socket2/default) < 0.5.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+socket2-devel %{_description} + +This package contains library source intended for building other packages which +use the "socket2" feature of the "%{crate}" crate. + +%files -n %{name}+socket2-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+stats-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/stats) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+stats-devel %{_description} + +This package contains library source intended for building other packages which +use the "stats" feature of the "%{crate}" crate. + +%files -n %{name}+stats-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+sync-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/sync) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+sync-devel %{_description} + +This package contains library source intended for building other packages which +use the "sync" feature of the "%{crate}" crate. + +%files -n %{name}+sync-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+test-util-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/test-util) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 +Requires: crate(tokio/rt) = 1.19.2 +Requires: crate(tokio/sync) = 1.19.2 +Requires: crate(tokio/time) = 1.19.2 + +%description -n %{name}+test-util-devel %{_description} + +This package contains library source intended for building other packages which +use the "test-util" feature of the "%{crate}" crate. + +%files -n %{name}+test-util-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+time-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/time) = 1.19.2 +Requires: cargo +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+time-devel %{_description} + +This package contains library source intended for building other packages which +use the "time" feature of the "%{crate}" crate. + +%files -n %{name}+time-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tokio-macros-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/tokio-macros) = 1.19.2 +Requires: cargo +Requires: (crate(tokio-macros/default) >= 1.7.0 with crate(tokio-macros/default) < 2.0.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+tokio-macros-devel %{_description} + +This package contains library source intended for building other packages which +use the "tokio-macros" feature of the "%{crate}" crate. + +%files -n %{name}+tokio-macros-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tracing-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/tracing) = 1.19.2 +Requires: cargo +Requires: (crate(tracing/std) >= 0.1.25 with crate(tracing/std) < 0.2.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+tracing-devel %{_description} + +This package contains library source intended for building other packages which +use the "tracing" feature of the "%{crate}" crate. + +%files -n %{name}+tracing-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+winapi-devel +Summary: %{summary} +BuildArch: noarch +Provides: crate(tokio/winapi) = 1.19.2 +Requires: cargo +Requires: (crate(winapi/handleapi) >= 0.3.8 with crate(winapi/handleapi) < 0.4.0~) +Requires: (crate(winapi/mswsock) >= 0.3.8 with crate(winapi/mswsock) < 0.4.0~) +Requires: (crate(winapi/std) >= 0.3.8 with crate(winapi/std) < 0.4.0~) +Requires: (crate(winapi/winsock2) >= 0.3.8 with crate(winapi/winsock2) < 0.4.0~) +Requires: (crate(winapi/ws2ipdef) >= 0.3.8 with crate(winapi/ws2ipdef) < 0.4.0~) +Requires: (crate(winapi/ws2tcpip) >= 0.3.8 with crate(winapi/ws2tcpip) < 0.4.0~) +Requires: crate(tokio) = 1.19.2 + +%description -n %{name}+winapi-devel %{_description} + +This package contains library source intended for building other packages which +use the "winapi" feature of the "%{crate}" crate. + +%files -n %{name}+winapi-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{real_crate}-%{version_no_tilde} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Thu Jan 01 1970 Jane Jane - 1.19.2-1 +- Initial package diff --git a/rust2rpm/tests/samples/tokio-1.19.2.toml b/rust2rpm/tests/samples/tokio-1.19.2.toml new file mode 100644 index 0000000..e42efe4 --- /dev/null +++ b/rust2rpm/tests/samples/tokio-1.19.2.toml @@ -0,0 +1,237 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2018" +rust-version = "1.49" +name = "tokio" +version = "1.19.2" +authors = ["Tokio Contributors "] +description = """ +An event-driven, non-blocking I/O platform for writing asynchronous I/O +backed applications. +""" +homepage = "https://tokio.rs" +readme = "README.md" +keywords = [ + "io", + "async", + "non-blocking", + "futures", +] +categories = [ + "asynchronous", + "network-programming", +] +license = "MIT" +repository = "https://github.com/tokio-rs/tokio" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = [ + "--cfg", + "docsrs", + "--cfg", + "tokio_unstable", +] +rustc-args = [ + "--cfg", + "tokio_unstable", +] + +[package.metadata.playground] +features = [ + "full", + "test-util", +] + +[dependencies.bytes] +version = "1.0.0" +optional = true + +[dependencies.memchr] +version = "2.2" +optional = true + +[dependencies.mio] +version = "0.8.1" +optional = true + +[dependencies.num_cpus] +version = "1.8.0" +optional = true + +[dependencies.once_cell] +version = "1.5.2" +optional = true + +[dependencies.parking_lot] +version = "0.12.0" +optional = true + +[dependencies.pin-project-lite] +version = "0.2.0" + +[dependencies.socket2] +version = "0.4.4" +features = ["all"] +optional = true + +[dependencies.tokio-macros] +version = "1.7.0" +optional = true + +[dev-dependencies.async-stream] +version = "0.3" + +[dev-dependencies.futures] +version = "0.3.0" +features = ["async-await"] + +[dev-dependencies.mockall] +version = "0.11.1" + +[dev-dependencies.tempfile] +version = "3.1.0" + +[dev-dependencies.tokio-stream] +version = "0.1" + +[dev-dependencies.tokio-test] +version = "0.4.0" + +[features] +default = [] +fs = [] +full = [ + "fs", + "io-util", + "io-std", + "macros", + "net", + "parking_lot", + "process", + "rt", + "rt-multi-thread", + "signal", + "sync", + "time", +] +io-std = [] +io-util = [ + "memchr", + "bytes", +] +macros = ["tokio-macros"] +net = [ + "libc", + "mio/os-poll", + "mio/os-ext", + "mio/net", + "socket2", + "winapi/namedpipeapi", +] +process = [ + "bytes", + "once_cell", + "libc", + "mio/os-poll", + "mio/os-ext", + "mio/net", + "signal-hook-registry", + "winapi/threadpoollegacyapiset", +] +rt = ["once_cell"] +rt-multi-thread = [ + "num_cpus", + "rt", +] +signal = [ + "once_cell", + "libc", + "mio/os-poll", + "mio/net", + "mio/os-ext", + "signal-hook-registry", + "winapi/consoleapi", +] +stats = [] +sync = [] +test-util = [ + "rt", + "sync", + "time", +] +time = [] + +[target."cfg(loom)".dev-dependencies.loom] +version = "0.5.2" +features = [ + "futures", + "checkpoint", +] + +[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.proptest] +version = "1" + +[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.rand] +version = "0.8.0" + +[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.socket2] +version = "0.4" + +[target."cfg(target_arch = \"wasm32\")".dev-dependencies.wasm-bindgen-test] +version = "0.3.0" + +[target."cfg(target_os = \"freebsd\")".dev-dependencies.mio-aio] +version = "0.6.0" +features = ["tokio"] + +[target."cfg(tokio_unstable)".dependencies.tracing] +version = "0.1.25" +features = ["std"] +optional = true +default-features = false + +[target."cfg(unix)".dependencies.libc] +version = "0.2.42" +optional = true + +[target."cfg(unix)".dependencies.signal-hook-registry] +version = "1.1.1" +optional = true + +[target."cfg(unix)".dev-dependencies.libc] +version = "0.2.42" + +[target."cfg(unix)".dev-dependencies.nix] +version = "0.24" +features = [ + "fs", + "socket", +] +default-features = false + +[target."cfg(windows)".dependencies.winapi] +version = "0.3.8" +features = [ + "std", + "winsock2", + "mswsock", + "handleapi", + "ws2ipdef", + "ws2tcpip", +] +optional = true +default-features = false + +[target."cfg(windows)".dev-dependencies.ntapi] +version = "0.3.6" diff --git a/rust2rpm/tests/test_generator.py b/rust2rpm/tests/test_generator.py new file mode 100644 index 0000000..1d2d21b --- /dev/null +++ b/rust2rpm/tests/test_generator.py @@ -0,0 +1,88 @@ +from importlib import resources +import pathlib +import os +import re +import time + +import pytest + +from rust2rpm.generator import to_list, spec_file_render +from rust2rpm.__main__ import ( + Metadata, + get_parser, + package_name_suffixed) + + +def test_to_list(): + assert to_list('1\n2') == ['1', '2'] + assert to_list('1\n\n 2' ) == ['1', '2'] + assert to_list(' 2 ') == ['2'] + assert to_list('\n\n') == [] + + +# How to add new tests samples: +# - find an interesting crate +# - copy unpatched Cargo.toml to rust2rpm/test/samples/-.toml +# (i.e. not Cargo.orig.toml and not the patched version after %prep) +# The license of the crate must allow this, e.g. MIT is fine. +# - execute PYTHONPATH=. SAVE_SPECS=1 pytest -v rust2rpm/tests/test_generator.py +# - review output and commit + +FIXED_DATE = time.gmtime(12345) + +tomlfiles = [p + for p in resources.files('rust2rpm.tests.samples').iterdir() + if p.suffix == '.toml'] + +def mock_spec_file_render(crate, tomlfile, target, tmpdir): + tmpdir = pathlib.Path(tmpdir) + # sadly we need to do this because cargo insists on looking for files + tmpdir.joinpath('src').mkdir() + tmpdir.joinpath('src/lib.rs').write_text('# hello!') + tmpdir.joinpath('src/main.rs').write_text('# hello!') + + args = get_parser().parse_args(['foobar', + f'--target={target}', + '-a' if target == 'fedora' else '--no-rpmautospec']) + pkg_name = package_name_suffixed(crate, args.suffix) + + toml_before = open(tomlfile).readlines() + + fake_toml = tmpdir / 'Cargo.toml' + fake_toml.write_text('\n'.join(toml_before)) + + metadata, = Metadata.from_file(fake_toml) + + return spec_file_render( + args = args, + pkg_name = pkg_name, + crate = crate, + metadata = metadata, + patch_file = f'{crate}-patch1.diff', + packager_identity = 'Jane Jane ', + doc_files = ['DOC1', 'DOC2'], + license_files = ['LIC1', 'LIC2'], + distconf = {}, + all_features = False, + date=FIXED_DATE, + ) + +@pytest.mark.parametrize('tomlfile', tomlfiles) +@pytest.mark.parametrize('target', ['plain', 'fedora', 'mageia', 'opensuse']) +def test_spec(tomlfile, target, tmpdir): + crate = tomlfile.with_suffix('').name + + spec = mock_spec_file_render(crate, tomlfile, target, tmpdir) + spec = re.sub('^(# Generated by rust2rpm) .*', r'\1 NNN', spec) + + if os.getenv('SAVE_SPECS') == '1': + # helper mode to create test data + path = resources.path('rust2rpm.tests.samples', + f'{crate}.{target}.spec') + path.write_text(spec) + + else: + expected = resources.read_text('rust2rpm.tests.samples', + f'{crate}.{target}.spec') + + assert spec == expected