wire up support for new configuration settings that control tests

This commit is contained in:
Fabio Valentini 2023-10-06 22:15:15 +02:00
parent 3a06b7e2bc
commit 9b52109a44
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
28 changed files with 1319 additions and 63 deletions

View file

@ -1,6 +1,7 @@
import configparser
import os
import sys
import textwrap
import tomllib
from typing import Any, Optional
@ -449,6 +450,15 @@ class TomlConf:
jsonschema.validate(toml, TOML_SCHEMA)
if tests := toml.get("tests"):
if run := tests.get("run"):
if "all" in run:
if len(run) != 1:
raise ConfError(f"Invalid set of tests to run: {run!r}")
if "none" in run:
if len(run) != 1:
raise ConfError(f"Invalid set of tests to run: {run!r}")
if features_list := toml.get("features"):
if enable_list := features_list.get("enable"):
for enabled in enable_list:
@ -544,3 +554,61 @@ def load_config(features: set[str], target: str) -> TomlConf:
tomlconf = TomlConf.from_conf(distconf)
return tomlconf
def conf_to_bcond_check(conf: TomlConf) -> bool:
if tests_run := conf.tests_run:
return "none" not in tests_run
else:
return True
def conf_to_test_comments(conf: TomlConf) -> list[str]:
if conf.tests_comments:
comments = conf.tests_comments
else:
return []
lines = []
for comment in comments:
lines.extend(
textwrap.wrap(
comment,
width=80,
initial_indent="# * ",
subsequent_indent="# ",
break_long_words=False,
break_on_hyphens=False,
)
)
return lines
def conf_to_cargo_test_args(conf: TomlConf) -> list[str]:
if skip := conf.tests_skip:
skip_flags = []
for name in skip:
skip_flags.extend(["--skip", name])
else:
skip_flags = []
if conf.tests_skip_exact is True:
skip_exact_flag = ["--exact"]
else:
skip_exact_flag = []
if run := conf.tests_run:
if not ("all" in run or "none" in run):
multi = []
for kind in run:
if skip_flags:
multi.append(" " + " ".join(["--", f"--{kind}", "--"] + skip_exact_flag + skip_flags))
else:
multi.append(" " + " ".join(["--", f"--{kind}"]))
return multi
if skip_flags:
return [" " + " ".join(["--", "--"] + skip_exact_flag + skip_flags)]
else:
return []

View file

@ -11,7 +11,7 @@ from cargo2rpm import rpm
import jinja2
from rust2rpm import __version__, log
from rust2rpm.conf import TomlConf
from rust2rpm.conf import TomlConf, conf_to_bcond_check, conf_to_test_comments, conf_to_cargo_test_args
from rust2rpm.licensing import translate_license
from rust2rpm.metadata import package_uses_rust_1_60_feature_syntax, get_required_features_for_binaries
@ -154,9 +154,21 @@ def spec_render_crate(
generator_version = __version__.split(".")[0]
buildrequires = rpm.buildrequires(package, feature_flags, False)
merged_feature_flags = FeatureFlags(
all_features=feature_flags.all_features or tomlconf.features_enable_all is True,
no_default_features=feature_flags.no_default_features and not tomlconf.features_enable_all,
features=list(
sorted(
set.union(
set(feature_flags.features), set(tomlconf.features_enable) if tomlconf.features_enable else set()
)
)
),
)
buildrequires = rpm.buildrequires(package, merged_feature_flags, False)
test_requires = set.difference(
rpm.buildrequires(package, feature_flags, True), rpm.buildrequires(package, feature_flags, False)
rpm.buildrequires(package, merged_feature_flags, True), rpm.buildrequires(package, merged_feature_flags, False)
)
rpm_buildrequires = list(sorted(buildrequires))
@ -223,6 +235,10 @@ def spec_render_crate(
else:
conf_supported_arches = None
rpm_bcond_check = conf_to_bcond_check(tomlconf)
rpm_test_comments = conf_to_test_comments(tomlconf)
cargo_test_args = conf_to_cargo_test_args(tomlconf)
template_args_common = {
# Parameters specific to rust2rpm
"rust2rpm_version": generator_version,
@ -243,6 +259,8 @@ def spec_render_crate(
"rpm_provides": rpm_provides,
"rpm_license_files": license_files,
"rpm_doc_files": doc_files,
"rpm_bcond_check": rpm_bcond_check,
"rpm_test_comments": rpm_test_comments,
# Parameters that control generation of subpackages
"rpm_binary_package": is_bin,
"rpm_cdylib_package": is_cdylib,
@ -260,6 +278,7 @@ def spec_render_crate(
"conf_bin_requires": tomlconf.requires_bin or list(),
"conf_lib_requires": conf_lib_requires,
"conf_supported_arches": conf_supported_arches,
"cargo_test_args": cargo_test_args,
# Parameters derived from command-line flags
"cargo_args": cargo_args,
"use_relative_license_paths": relative_license_paths,
@ -314,7 +333,6 @@ def spec_render_project(
binaries.sort()
is_bin = metadata.is_bin()
is_lib = metadata.is_lib()
is_cdylib = metadata.is_cdylib()
package = metadata.packages[0]
@ -323,9 +341,21 @@ def spec_render_project(
generator_version = __version__.split(".")[0]
buildrequires = rpm.buildrequires(package, feature_flags, False)
merged_feature_flags = FeatureFlags(
all_features=feature_flags.all_features or tomlconf.features_enable_all is True,
no_default_features=feature_flags.no_default_features and not tomlconf.features_enable_all,
features=list(
sorted(
set.union(
set(feature_flags.features), set(tomlconf.features_enable) if tomlconf.features_enable else set()
)
)
),
)
buildrequires = rpm.buildrequires(package, merged_feature_flags, False)
test_requires = set.difference(
rpm.buildrequires(package, feature_flags, True), rpm.buildrequires(package, feature_flags, False)
rpm.buildrequires(package, merged_feature_flags, True), rpm.buildrequires(package, merged_feature_flags, False)
)
rpm_buildrequires = list(sorted(buildrequires))
@ -375,6 +405,10 @@ def spec_render_project(
else:
conf_supported_arches = None
rpm_bcond_check = conf_to_bcond_check(tomlconf)
rpm_test_comments = conf_to_test_comments(tomlconf)
cargo_test_args = conf_to_cargo_test_args(tomlconf)
template_args_common = {
# Parameters specific to rust2rpm
"rust2rpm_version": generator_version,
@ -394,6 +428,8 @@ def spec_render_project(
"rpm_test_requires": rpm_test_requires,
"rpm_license_files": license_files,
"rpm_doc_files": doc_files,
"rpm_bcond_check": rpm_bcond_check,
"rpm_test_comments": rpm_test_comments,
# Parameters that control generation of subpackages
"rpm_binary_package": is_bin,
"rpm_cdylib_package": is_cdylib,
@ -408,6 +444,7 @@ def spec_render_project(
"conf_test_requires": tomlconf.requires_test or list(),
"conf_bin_requires": tomlconf.requires_bin or list(),
"conf_supported_arches": conf_supported_arches,
"cargo_test_args": cargo_test_args,
# Parameters derived from command-line flags
"cargo_args": cargo_args,
"use_rpmautospec": rpmautospec,
@ -468,10 +505,22 @@ def spec_render_workspace(
generator_version = __version__.split(".")[0]
buildrequires = rpm.workspace_buildrequires(metadata, feature_flags, False)
merged_feature_flags = FeatureFlags(
all_features=feature_flags.all_features or tomlconf.features_enable_all is True,
no_default_features=feature_flags.no_default_features and not tomlconf.features_enable_all,
features=list(
sorted(
set.union(
set(feature_flags.features), set(tomlconf.features_enable) if tomlconf.features_enable else set()
)
)
),
)
buildrequires = rpm.workspace_buildrequires(metadata, merged_feature_flags, False)
test_requires = set.difference(
rpm.workspace_buildrequires(metadata, feature_flags, True),
rpm.workspace_buildrequires(metadata, feature_flags, False),
rpm.workspace_buildrequires(metadata, merged_feature_flags, True),
rpm.workspace_buildrequires(metadata, merged_feature_flags, False),
)
rpm_buildrequires = list(sorted(buildrequires))
@ -506,6 +555,10 @@ def spec_render_workspace(
license_str = " AND ".join(license_strs)
rpm_license_tag, rpm_license_comments = translate_license(target, license_str)
rpm_bcond_check = conf_to_bcond_check(tomlconf)
rpm_test_comments = conf_to_test_comments(tomlconf)
cargo_test_args = conf_to_cargo_test_args(tomlconf)
template_args_common = {
# Parameters specific to rust2rpm
"rust2rpm_version": generator_version,
@ -525,10 +578,13 @@ def spec_render_workspace(
"rpm_binary_names": binaries,
"rpm_cdylib_package": is_cdylib,
"upstream_version": upstream_version,
"rpm_bcond_check": rpm_bcond_check,
"rpm_test_comments": rpm_test_comments,
# Parameters derived from rust2rpm.conf
"conf_buildrequires": tomlconf.requires_build or list(),
"conf_test_requires": tomlconf.requires_test or list(),
"conf_bin_requires": tomlconf.requires_bin or list(),
"cargo_test_args": cargo_test_args,
# Parameters derived from command-line flags
"cargo_args": cargo_args,
"use_rpmautospec": rpmautospec,

View file

@ -28,6 +28,8 @@
| `rpm_provides` | `dict[str, list[str]]` | map of feature names to lists of RPM `Provides` for library sub-packages |
| `rpm_license_files` | `list[str]` | list of the license files which were detected in crate sources |
| `rpm_doc_files` | `list[str]` | list of the documentation files which were detected in crate sources |
| `rpm_bcond_check` | `bool` | flag to switch default value of the `check` bcond |
| `rpm_test_comments` | `list[str]` | comments that document why (specific) tests are disabled |
### Parameters that control generation of subpackages
@ -48,7 +50,7 @@
| `crate_license` | `Optional[str]` | crate license (from `Cargo.toml` metadata) |
| `upstream_version` | `str` | upstream crate version (from `crates.io`) |
### Parameters derived from rust2rpm.conf
### Parameters derived from rust2rpm configuration
| parameter name | type | value |
| ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
@ -57,6 +59,7 @@
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
| `conf_lib_requires` | `dict[str, list[str]]` | map of feature names to lists of additional RPM `Requires` for library packages specified in `rust2rpm.conf` |
| `conf_supported_arches` | `list[str]` | list of supported architectures (results in `%ifarch` conditionals around `%cargo_build` and `%cargo_test` macros) |
| `cargo_test_args` | `list[str]` | list of arguments that are passed to `%cargo_test` |
### Parameters derived from command-line flags
@ -106,6 +109,8 @@
| `rpm_test_requires` | `list[str]` | list of RPM `BuildRequires` that are gated by an `%if %{with check}` conditional |
| `rpm_license_files` | `list[str]` | list of the license files which were detected in crate sources |
| `rpm_doc_files` | `list[str]` | list of the documentation files which were detected in crate sources |
| `rpm_bcond_check` | `bool` | flag to switch default value of the `check` bcond |
| `rpm_test_comments` | `list[str]` | comments that document why (specific) tests are disabled |
### Parameters that control generation of subpackages
@ -124,7 +129,7 @@
| `crate_license` | `Optional[str]` | crate license (from `Cargo.toml` metadata) |
| `upstream_version` | `str` | upstream crate version (from `crates.io`) |
### Parameters derived from rust2rpm.conf
### Parameters derived from rust2rpm configuration
| parameter name | type | value |
| ----------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
@ -132,6 +137,7 @@
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` that are gated by an `%if %{with check}` conditional |
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
| `conf_supported_arches` | `list[str]` | list of supported architectures (results in `%ifarch` conditionals around `%cargo_build` and `%cargo_test` macros) |
| `cargo_test_args` | `list[str]` | list of arguments that are passed to `%cargo_test` |
### Parameters derived from command-line flags
@ -177,14 +183,17 @@
| `rpm_doc_files` | `list[str]` | list of the documentation files which were detected in crate sources |
| `rpm_binary_names` | `list[str]` | list of the names of executables which are built from the project |
| `rpm_cdylib_package` | `bool` | `True` if package ships any shared libraries (`cdylib` targets) |
| `rpm_bcond_check` | `bool` | flag to switch default value of the `check` bcond |
| `rpm_test_comments` | `list[str]` | comments that document why (specific) tests are disabled |
### Parameters derived from rust2rpm.conf
### Parameters derived from rust2rpm configuration
| parameter name | type | value |
| -------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `conf_buildrequires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` |
| `conf_test_requires` | `list[str]` | list of additional RPM `BuildRequires` specified in `rust2rpm.conf` that are gated by an `%if %{with check}` conditional |
| `conf_bin_requires` | `list[str]` | list of additional RPM `Requires` for the binary package specified in `rust2rpm.conf` |
| `cargo_test_args` | `list[str]` | list of arguments that are passed to `%cargo_test` |
### Parameters derived from command-line flags

View file

@ -1,6 +1,15 @@
{% include rust2rpm_target ~ "-header.spec.inc" ignore missing %}
# Generated by rust2rpm {{ rust2rpm_version }}
{% if rpm_bcond_check %}
%bcond_without check
{% else %}
{% if rpm_test_comments %}
{% for comment in rpm_test_comments %}
{{ comment }}
{% endfor %}
{% endif %}
%bcond_with check
{% endif %}
{% if not (rpm_binary_package or rpm_cdylib_package) %}
%global debug_package %{nil}
{% endif %}
@ -239,7 +248,18 @@ echo {{ "%r" | format(req) }}
%ifarch %{supported_arches}
{% endif %}
%check
{% if cargo_test_args %}
{% if rpm_test_comments %}
{% for comment in rpm_test_comments %}
{{ comment }}
{% endfor %}
{% endif %}
{% for args in cargo_test_args %}
%cargo_test{{ cargo_args }}{{ args }}
{% endfor %}
{% else %}
%cargo_test{{ cargo_args }}
{% endif %}
{% if conf_supported_arches %}
%endif
{% endif %}

View file

@ -1,6 +1,15 @@
{% include rust2rpm_target ~ "-header.spec.inc" ignore missing %}
# Generated by rust2rpm {{ rust2rpm_version }}
{% if rpm_bcond_check %}
%bcond_without check
{% else %}
{% if rpm_test_comments %}
{% for comment in rpm_test_comments %}
{{ comment }}
{% endfor %}
{% endif %}
%bcond_with check
{% endif %}
# prevent library files from being installed
%global __cargo_is_lib() 0
@ -12,11 +21,6 @@
{% if crate_version != upstream_version %}
%global upstream_version {{ upstream_version }}
{% endif %}
{% if conf_supported_arches %}
# compile and run tests only on supported architectures
%global supported_arches {{ conf_supported_arches }}
{% endif %}
Name: {{ rpm_name }}
Version: {{ rpm_version }}
@ -58,7 +62,9 @@ Patch: {{ rpm_patch_file_automatic }}
Patch: {{ rpm_patch_file_manual }}
{% endif %}
{% if rust2rpm_target != "fedora" %}
{% if conf_supported_arches %}
ExclusiveArch: {{ conf_supported_arches }}
{% elif rust2rpm_target != "fedora" %}
ExclusiveArch: %{rust_arches}
{% endif %}
@ -126,13 +132,7 @@ echo {{ "%r" | format(req) }}
{% endif -%}
%build
{% if conf_supported_arches %}
%ifarch %{supported_arches}
{% endif %}
%cargo_build{{ cargo_args }}
{% if conf_supported_arches %}
%endif
{% endif %}
%{cargo_license_summary{{ cargo_args }}}
%{cargo_license{{ cargo_args }}} > LICENSE.dependencies
@ -147,13 +147,18 @@ echo {{ "%r" | format(req) }}
{% endif %}
%if %{with check}
{% if conf_supported_arches %}
%ifarch %{supported_arches}
{% endif %}
%check
{% if cargo_test_args %}
{% if rpm_test_comments %}
{% for comment in rpm_test_comments %}
{{ comment }}
{% endfor %}
{% endif %}
{% for args in cargo_test_args %}
%cargo_test{{ cargo_args }}{{ args }}
{% endfor %}
{% else %}
%cargo_test{{ cargo_args }}
{% if conf_supported_arches %}
%endif
{% endif %}
%endif

View file

@ -1,6 +1,15 @@
{% include rust2rpm_target ~ "-header.spec.inc" ignore missing %}
# Generated by rust2rpm {{ rust2rpm_version }}
{% if rpm_bcond_check %}
%bcond_without check
{% else %}
{% if rpm_test_comments %}
{% for comment in rpm_test_comments %}
{{ comment }}
{% endfor %}
{% endif %}
%bcond_with check
{% endif %}
{% if rpm_version != upstream_version %}
%global upstream_version {{ upstream_version }}
@ -112,7 +121,18 @@ echo {{ "%r" | format(req) }}
%if %{with check}
%check
{% if cargo_test_args %}
{% if rpm_test_comments %}
{% for comment in rpm_test_comments %}
{{ comment }}
{% endfor %}
{% endif %}
{% for args in cargo_test_args %}
%cargo_test{{ cargo_args }}{{ args }}
{% endfor %}
{% else %}
%cargo_test{{ cargo_args }}
{% endif %}
%endif
%files

View file

@ -108,7 +108,9 @@ use the "cli" feature of the "%{crate}" crate.
%if %{with check}
%check
%cargo_test -f cli
# * files required by doctests are not included in published crates
%cargo_test -f cli -- --lib
%cargo_test -f cli -- --tests
%endif
%changelog

View file

@ -117,7 +117,9 @@ use the "cli" feature of the "%{crate}" crate.
%if %{with check}
%check
%cargo_test -f cli
# * files required by doctests are not included in published crates
%cargo_test -f cli -- --lib
%cargo_test -f cli -- --tests
%endif
%changelog

View file

@ -134,7 +134,9 @@ use the "cli" feature of the "%{crate}" crate.
%if %{with check}
%check
%cargo_test -f cli
# * files required by doctests are not included in published crates
%cargo_test -f cli -- --lib
%cargo_test -f cli -- --tests
%endif
%changelog

View file

@ -124,7 +124,9 @@ use the "cli" feature of the "%{crate}" crate.
%if %{with check}
%check
%cargo_test -f cli
# * files required by doctests are not included in published crates
%cargo_test -f cli -- --lib
%cargo_test -f cli -- --tests
%endif
%changelog

View file

@ -0,0 +1,198 @@
# Generated by rust2rpm NNN
# * tests are known to be broken upstream:
# https://github.com/gtk-rs/gtk-rs-core/issues/64
%bcond_with check
%global debug_package %{nil}
%global crate glib-sys
Name: rust-glib-sys
Version: 0.17.2
Release: %autorelease
Summary: FFI bindings to libglib-2.0
License: MIT
URL: https://crates.io/crates/glib-sys
Source: %{crates_source}
# Automatically generated patch to strip dependencies and normalize metadata
Patch: glib-sys-patch1.diff
# Manually created patch for downstream crate metadata changes
Patch: glib-sys-patch2.diff
BuildRequires: rust-packaging >= 21
%global _description %{expand:
FFI bindings to libglib-2.0.}
%description %{_description}
%package devel
Summary: %{summary}
BuildArch: noarch
Requires: pkgconfig(glib-2.0) >= 2.56
%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}+dox-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+dox-devel %{_description}
This package contains library source intended for building other packages which
use the "dox" feature of the "%{crate}" crate.
%files -n %{name}+dox-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_58-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_58-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_58" feature of the "%{crate}" crate.
%files -n %{name}+v2_58-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_60-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_60-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_60" feature of the "%{crate}" crate.
%files -n %{name}+v2_60-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_62-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_62-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_62" feature of the "%{crate}" crate.
%files -n %{name}+v2_62-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_64-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_64-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_64" feature of the "%{crate}" crate.
%files -n %{name}+v2_64-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_66-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_66-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_66" feature of the "%{crate}" crate.
%files -n %{name}+v2_66-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_68-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_68-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_68" feature of the "%{crate}" crate.
%files -n %{name}+v2_68-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_70-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_70-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_70" feature of the "%{crate}" crate.
%files -n %{name}+v2_70-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_72-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_72-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_72" feature of the "%{crate}" crate.
%files -n %{name}+v2_72-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_74-devel
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+v2_74-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_74" feature of the "%{crate}" crate.
%files -n %{name}+v2_74-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
echo 'pkgconfig(glib-2.0) >= 2.56'
%build
%cargo_build
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog

View file

@ -0,0 +1 @@
{"packages":[{"name":"glib-sys","version":"0.17.2","id":"glib-sys 0.17.2 (path+file:///home/deca/Workspace/glib-sys-0.17.2)","license":"MIT","license_file":null,"description":"FFI bindings to libglib-2.0","source":null,"dependencies":[{"name":"libc","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^0.2","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"shell-words","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^1.0.0","kind":"dev","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"tempfile","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^3","kind":"dev","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null},{"name":"system-deps","source":"registry+https://github.com/rust-lang/crates.io-index","req":"^6","kind":"build","rename":null,"optional":false,"uses_default_features":true,"features":[],"target":null,"registry":null}],"targets":[{"kind":["lib"],"crate_types":["lib"],"name":"glib_sys","src_path":"/home/deca/Workspace/glib-sys-0.17.2/src/lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},{"kind":["test"],"crate_types":["bin"],"name":"abi","src_path":"/home/deca/Workspace/glib-sys-0.17.2/tests/abi.rs","edition":"2021","doc":false,"doctest":false,"test":true},{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/deca/Workspace/glib-sys-0.17.2/build.rs","edition":"2021","doc":false,"doctest":false,"test":false}],"features":{"dox":[],"v2_58":[],"v2_60":["v2_58"],"v2_62":["v2_60"],"v2_64":["v2_62"],"v2_66":["v2_64"],"v2_68":["v2_66"],"v2_70":["v2_68"],"v2_72":["v2_70"],"v2_74":["v2_72"],"v2_76":["v2_74"]},"manifest_path":"/home/deca/Workspace/glib-sys-0.17.2/Cargo.toml","metadata":{"docs":{"rs":{"features":["dox"]}},"system-deps":{"glib_2_0":{"name":"glib-2.0","version":"2.56","v2_58":{"version":"2.58"},"v2_60":{"version":"2.60"},"v2_62":{"version":"2.62"},"v2_64":{"version":"2.64"},"v2_66":{"version":"2.66"},"v2_68":{"version":"2.68"},"v2_70":{"version":"2.70"},"v2_72":{"version":"2.72"},"v2_74":{"version":"2.74"},"v2_76":{"version":"2.75"}},"gobject_2_0":{"name":"gobject-2.0","version":"2.56","v2_58":{"version":"2.58"},"v2_62":{"version":"2.62"}}}},"publish":null,"authors":["The gtk-rs Project Developers"],"categories":[],"keywords":["glib","ffi","gtk-rs","gnome"],"readme":null,"repository":"https://github.com/gtk-rs/gtk-rs-core","homepage":"http://gtk-rs.org/","documentation":null,"edition":"2021","links":null,"default_run":null,"rust_version":"1.64"}],"workspace_members":["glib-sys 0.17.2 (path+file:///home/deca/Workspace/glib-sys-0.17.2)"],"workspace_default_members":["glib-sys 0.17.2 (path+file:///home/deca/Workspace/glib-sys-0.17.2)"],"resolve":null,"target_directory":"/home/deca/Workspace/glib-sys-0.17.2/target","version":1,"workspace_root":"/home/deca/Workspace/glib-sys-0.17.2","metadata":null}

View file

@ -0,0 +1,218 @@
# Generated by rust2rpm NNN
# * tests are known to be broken upstream:
# https://github.com/gtk-rs/gtk-rs-core/issues/64
%bcond_with check
%global debug_package %{nil}
%global crate glib-sys
Name: rust-glib-sys
Version: 0.17.2
Release: %mkrel 1
Summary: FFI bindings to libglib-2.0
Group: Development/Rust
License: MIT
URL: https://crates.io/crates/glib-sys
Source: %{crates_source}
# Automatically generated patch to strip dependencies and normalize metadata
Patch: glib-sys-patch1.diff
# Manually created patch for downstream crate metadata changes
Patch: glib-sys-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
BuildRequires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~)
BuildRequires: (crate(system-deps/default) >= 6.0.0 with crate(system-deps/default) < 7.0.0~)
BuildRequires: rust >= 1.64
%if %{with check}
BuildRequires: (crate(shell-words/default) >= 1.0.0 with crate(shell-words/default) < 2.0.0~)
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
%endif
BuildRequires: pkgconfig(glib-2.0) >= 2.56
%global _description %{expand:
FFI bindings to libglib-2.0.}
%description %{_description}
%package devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
Requires: pkgconfig(glib-2.0) >= 2.56
%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}+dox-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+dox-devel %{_description}
This package contains library source intended for building other packages which
use the "dox" feature of the "%{crate}" crate.
%files -n %{name}+dox-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_58-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_58-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_58" feature of the "%{crate}" crate.
%files -n %{name}+v2_58-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_60-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_60-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_60" feature of the "%{crate}" crate.
%files -n %{name}+v2_60-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_62-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_62-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_62" feature of the "%{crate}" crate.
%files -n %{name}+v2_62-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_64-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_64-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_64" feature of the "%{crate}" crate.
%files -n %{name}+v2_64-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_66-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_66-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_66" feature of the "%{crate}" crate.
%files -n %{name}+v2_66-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_68-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_68-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_68" feature of the "%{crate}" crate.
%files -n %{name}+v2_68-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_70-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_70-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_70" feature of the "%{crate}" crate.
%files -n %{name}+v2_70-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_72-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_72-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_72" feature of the "%{crate}" crate.
%files -n %{name}+v2_72-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_74-devel
Summary: %{summary}
Group: Development/Rust
BuildArch: noarch
%description -n %{name}+v2_74-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_74" feature of the "%{crate}" crate.
%files -n %{name}+v2_74-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%build
%cargo_build
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%changelog
* Thu Jan 01 1970 Jane Jane <jane@jane.org> - 0.17.2-1
- Initial package

View file

@ -0,0 +1,236 @@
#
# spec file for package rust-glib-sys
#
# Copyright (c) XXXX Jane Jane <jane@jane.org>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Generated by rust2rpm NNN
# * tests are known to be broken upstream:
# https://github.com/gtk-rs/gtk-rs-core/issues/64
%bcond_with check
%global debug_package %{nil}
%global crate glib-sys
Name: rust-glib-sys
Version: 0.17.2
Release: 0
Summary: FFI bindings to libglib-2.0
Group: Development/Libraries/Rust
License: MIT
URL: https://crates.io/crates/glib-sys
Source: %{crates_source}
# Automatically generated patch to strip dependencies and normalize metadata
Patch: glib-sys-patch1.diff
# PATCH-FIX-OPENSUSE glib-sys-patch2.diff — Manually created patch for downstream crate metadata changes
Patch: glib-sys-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
BuildRequires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~)
BuildRequires: (crate(system-deps/default) >= 6.0.0 with crate(system-deps/default) < 7.0.0~)
BuildRequires: rust >= 1.64
%if %{with check}
BuildRequires: (crate(shell-words/default) >= 1.0.0 with crate(shell-words/default) < 2.0.0~)
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
%endif
BuildRequires: pkgconfig(glib-2.0) >= 2.56
%global _description %{expand:
FFI bindings to libglib-2.0.}
%description %{_description}
%package devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
Requires: pkgconfig(glib-2.0) >= 2.56
%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}+dox-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+dox-devel %{_description}
This package contains library source intended for building other packages which
use the "dox" feature of the "%{crate}" crate.
%files -n %{name}+dox-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_58-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_58-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_58" feature of the "%{crate}" crate.
%files -n %{name}+v2_58-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_60-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_60-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_60" feature of the "%{crate}" crate.
%files -n %{name}+v2_60-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_62-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_62-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_62" feature of the "%{crate}" crate.
%files -n %{name}+v2_62-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_64-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_64-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_64" feature of the "%{crate}" crate.
%files -n %{name}+v2_64-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_66-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_66-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_66" feature of the "%{crate}" crate.
%files -n %{name}+v2_66-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_68-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_68-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_68" feature of the "%{crate}" crate.
%files -n %{name}+v2_68-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_70-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_70-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_70" feature of the "%{crate}" crate.
%files -n %{name}+v2_70-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_72-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_72-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_72" feature of the "%{crate}" crate.
%files -n %{name}+v2_72-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_74-devel
Summary: %{summary}
Group: Development/Libraries/Rust
BuildArch: noarch
%description -n %{name}+v2_74-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_74" feature of the "%{crate}" crate.
%files -n %{name}+v2_74-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version} -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 <jane@jane.org>
- Version 0.17.2
- Initial package

View file

@ -0,0 +1,251 @@
# Generated by rust2rpm NNN
# * tests are known to be broken upstream:
# https://github.com/gtk-rs/gtk-rs-core/issues/64
%bcond_with check
%global debug_package %{nil}
%global crate glib-sys
Name: rust-glib-sys
Version: 0.17.2
Release: 1%{?dist}
Summary: FFI bindings to libglib-2.0
License: MIT
URL: https://crates.io/crates/glib-sys
Source: %{crates_source}
# Automatically generated patch to strip dependencies and normalize metadata
Patch: glib-sys-patch1.diff
# Manually created patch for downstream crate metadata changes
Patch: glib-sys-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
BuildRequires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~)
BuildRequires: (crate(system-deps/default) >= 6.0.0 with crate(system-deps/default) < 7.0.0~)
BuildRequires: rust >= 1.64
%if %{with check}
BuildRequires: (crate(shell-words/default) >= 1.0.0 with crate(shell-words/default) < 2.0.0~)
BuildRequires: (crate(tempfile/default) >= 3.0.0 with crate(tempfile/default) < 4.0.0~)
%endif
BuildRequires: pkgconfig(glib-2.0) >= 2.56
%global _description %{expand:
FFI bindings to libglib-2.0.}
%description %{_description}
%package devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys) = 0.17.2
Requires: (crate(libc/default) >= 0.2.0 with crate(libc/default) < 0.3.0~)
Requires: (crate(system-deps/default) >= 6.0.0 with crate(system-deps/default) < 7.0.0~)
Requires: cargo
Requires: rust >= 1.64
Requires: pkgconfig(glib-2.0) >= 2.56
%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(glib-sys/default) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.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}+dox-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/dox) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
%description -n %{name}+dox-devel %{_description}
This package contains library source intended for building other packages which
use the "dox" feature of the "%{crate}" crate.
%files -n %{name}+dox-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_58-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_58) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
%description -n %{name}+v2_58-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_58" feature of the "%{crate}" crate.
%files -n %{name}+v2_58-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_60-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_60) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_58) = 0.17.2
%description -n %{name}+v2_60-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_60" feature of the "%{crate}" crate.
%files -n %{name}+v2_60-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_62-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_62) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_60) = 0.17.2
%description -n %{name}+v2_62-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_62" feature of the "%{crate}" crate.
%files -n %{name}+v2_62-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_64-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_64) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_62) = 0.17.2
%description -n %{name}+v2_64-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_64" feature of the "%{crate}" crate.
%files -n %{name}+v2_64-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_66-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_66) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_64) = 0.17.2
%description -n %{name}+v2_66-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_66" feature of the "%{crate}" crate.
%files -n %{name}+v2_66-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_68-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_68) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_66) = 0.17.2
%description -n %{name}+v2_68-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_68" feature of the "%{crate}" crate.
%files -n %{name}+v2_68-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_70-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_70) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_68) = 0.17.2
%description -n %{name}+v2_70-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_70" feature of the "%{crate}" crate.
%files -n %{name}+v2_70-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_72-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_72) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_70) = 0.17.2
%description -n %{name}+v2_72-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_72" feature of the "%{crate}" crate.
%files -n %{name}+v2_72-devel
%ghost %{crate_instdir}/Cargo.toml
%package -n %{name}+v2_74-devel
Summary: %{summary}
BuildArch: noarch
Provides: crate(glib-sys/v2_74) = 0.17.2
Requires: cargo
Requires: crate(glib-sys) = 0.17.2
Requires: crate(glib-sys/v2_72) = 0.17.2
%description -n %{name}+v2_74-devel %{_description}
This package contains library source intended for building other packages which
use the "v2_74" feature of the "%{crate}" crate.
%files -n %{name}+v2_74-devel
%ghost %{crate_instdir}/Cargo.toml
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%build
%cargo_build
%install
%cargo_install
%if %{with check}
%check
%cargo_test
%endif
%changelog
* Thu Jan 01 1970 Jane Jane <jane@jane.org> - 0.17.2-1
- Initial package

View file

@ -1,3 +1,7 @@
[tests]
run = ["none"]
comments = ["tests are known to be broken upstream: https://github.com/gtk-rs/gtk-rs-core/issues/64"]
[features]
hide = ["v2_76"]

View file

@ -1,5 +1,6 @@
# Generated by rust2rpm NNN
%bcond_without check
# * tests are not reliable in containerized environments
%bcond_with check
%global debug_package %{nil}
%global crate nix

View file

@ -1,5 +1,6 @@
# Generated by rust2rpm NNN
%bcond_without check
# * tests are not reliable in containerized environments
%bcond_with check
%global debug_package %{nil}
%global crate nix

View file

@ -16,7 +16,8 @@
#
# Generated by rust2rpm NNN
%bcond_without check
# * tests are not reliable in containerized environments
%bcond_with check
%global debug_package %{nil}
%global crate nix

View file

@ -1,5 +1,6 @@
# Generated by rust2rpm NNN
%bcond_without check
# * tests are not reliable in containerized environments
%bcond_with check
%global debug_package %{nil}
%global crate nix

View file

@ -0,0 +1,3 @@
[tests]
run = ["none"]
comments = ["tests are not reliable in containerized environments"]

View file

@ -370,17 +370,17 @@ use the "winapi" feature of the "%{crate}" crate.
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%cargo_generate_buildrequires -a
%build
%cargo_build
%cargo_build -a
%install
%cargo_install
%cargo_install -a
%if %{with check}
%check
%cargo_test
%cargo_test -a
%endif
%changelog

View file

@ -21,13 +21,38 @@ Patch: tokio-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
BuildRequires: (crate(bytes/default) >= 1.0.0 with crate(bytes/default) < 2.0.0~)
BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~)
BuildRequires: (crate(memchr/default) >= 2.2.0 with crate(memchr/default) < 3.0.0~)
BuildRequires: (crate(mio/default) >= 0.8.1 with crate(mio/default) < 0.9.0~)
BuildRequires: (crate(mio/net) >= 0.8.1 with crate(mio/net) < 0.9.0~)
BuildRequires: (crate(mio/os-ext) >= 0.8.1 with crate(mio/os-ext) < 0.9.0~)
BuildRequires: (crate(mio/os-poll) >= 0.8.1 with crate(mio/os-poll) < 0.9.0~)
BuildRequires: (crate(num_cpus/default) >= 1.8.0 with crate(num_cpus/default) < 2.0.0~)
BuildRequires: (crate(once_cell/default) >= 1.5.2 with crate(once_cell/default) < 2.0.0~)
BuildRequires: (crate(parking_lot/default) >= 0.12.0 with crate(parking_lot/default) < 0.13.0~)
BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~)
BuildRequires: (crate(signal-hook-registry/default) >= 1.1.1 with crate(signal-hook-registry/default) < 2.0.0~)
BuildRequires: (crate(socket2/all) >= 0.4.4 with crate(socket2/all) < 0.5.0~)
BuildRequires: (crate(socket2/default) >= 0.4.4 with crate(socket2/default) < 0.5.0~)
BuildRequires: (crate(tokio-macros/default) >= 1.7.0 with crate(tokio-macros/default) < 2.0.0~)
BuildRequires: (crate(tracing) >= 0.1.25 with crate(tracing) < 0.2.0~)
BuildRequires: (crate(tracing/std) >= 0.1.25 with crate(tracing/std) < 0.2.0~)
BuildRequires: (crate(winapi) >= 0.3.8 with crate(winapi) < 0.4.0~)
BuildRequires: (crate(winapi/consoleapi) >= 0.3.8 with crate(winapi/consoleapi) < 0.4.0~)
BuildRequires: (crate(winapi/handleapi) >= 0.3.8 with crate(winapi/handleapi) < 0.4.0~)
BuildRequires: (crate(winapi/mswsock) >= 0.3.8 with crate(winapi/mswsock) < 0.4.0~)
BuildRequires: (crate(winapi/namedpipeapi) >= 0.3.8 with crate(winapi/namedpipeapi) < 0.4.0~)
BuildRequires: (crate(winapi/std) >= 0.3.8 with crate(winapi/std) < 0.4.0~)
BuildRequires: (crate(winapi/threadpoollegacyapiset) >= 0.3.8 with crate(winapi/threadpoollegacyapiset) < 0.4.0~)
BuildRequires: (crate(winapi/winsock2) >= 0.3.8 with crate(winapi/winsock2) < 0.4.0~)
BuildRequires: (crate(winapi/ws2ipdef) >= 0.3.8 with crate(winapi/ws2ipdef) < 0.4.0~)
BuildRequires: (crate(winapi/ws2tcpip) >= 0.3.8 with crate(winapi/ws2tcpip) < 0.4.0~)
BuildRequires: rust >= 1.49
%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~)
@ -40,6 +65,7 @@ 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/all) >= 0.4.0 with crate(socket2/all) < 0.5.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~)
@ -426,14 +452,14 @@ use the "winapi" feature of the "%{crate}" crate.
%cargo_prep
%build
%cargo_build
%cargo_build -a
%install
%cargo_install
%cargo_install -a
%if %{with check}
%check
%cargo_test
%cargo_test -a
%endif
%changelog

View file

@ -38,13 +38,38 @@ Patch: tokio-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
BuildRequires: (crate(bytes/default) >= 1.0.0 with crate(bytes/default) < 2.0.0~)
BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~)
BuildRequires: (crate(memchr/default) >= 2.2.0 with crate(memchr/default) < 3.0.0~)
BuildRequires: (crate(mio/default) >= 0.8.1 with crate(mio/default) < 0.9.0~)
BuildRequires: (crate(mio/net) >= 0.8.1 with crate(mio/net) < 0.9.0~)
BuildRequires: (crate(mio/os-ext) >= 0.8.1 with crate(mio/os-ext) < 0.9.0~)
BuildRequires: (crate(mio/os-poll) >= 0.8.1 with crate(mio/os-poll) < 0.9.0~)
BuildRequires: (crate(num_cpus/default) >= 1.8.0 with crate(num_cpus/default) < 2.0.0~)
BuildRequires: (crate(once_cell/default) >= 1.5.2 with crate(once_cell/default) < 2.0.0~)
BuildRequires: (crate(parking_lot/default) >= 0.12.0 with crate(parking_lot/default) < 0.13.0~)
BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~)
BuildRequires: (crate(signal-hook-registry/default) >= 1.1.1 with crate(signal-hook-registry/default) < 2.0.0~)
BuildRequires: (crate(socket2/all) >= 0.4.4 with crate(socket2/all) < 0.5.0~)
BuildRequires: (crate(socket2/default) >= 0.4.4 with crate(socket2/default) < 0.5.0~)
BuildRequires: (crate(tokio-macros/default) >= 1.7.0 with crate(tokio-macros/default) < 2.0.0~)
BuildRequires: (crate(tracing) >= 0.1.25 with crate(tracing) < 0.2.0~)
BuildRequires: (crate(tracing/std) >= 0.1.25 with crate(tracing/std) < 0.2.0~)
BuildRequires: (crate(winapi) >= 0.3.8 with crate(winapi) < 0.4.0~)
BuildRequires: (crate(winapi/consoleapi) >= 0.3.8 with crate(winapi/consoleapi) < 0.4.0~)
BuildRequires: (crate(winapi/handleapi) >= 0.3.8 with crate(winapi/handleapi) < 0.4.0~)
BuildRequires: (crate(winapi/mswsock) >= 0.3.8 with crate(winapi/mswsock) < 0.4.0~)
BuildRequires: (crate(winapi/namedpipeapi) >= 0.3.8 with crate(winapi/namedpipeapi) < 0.4.0~)
BuildRequires: (crate(winapi/std) >= 0.3.8 with crate(winapi/std) < 0.4.0~)
BuildRequires: (crate(winapi/threadpoollegacyapiset) >= 0.3.8 with crate(winapi/threadpoollegacyapiset) < 0.4.0~)
BuildRequires: (crate(winapi/winsock2) >= 0.3.8 with crate(winapi/winsock2) < 0.4.0~)
BuildRequires: (crate(winapi/ws2ipdef) >= 0.3.8 with crate(winapi/ws2ipdef) < 0.4.0~)
BuildRequires: (crate(winapi/ws2tcpip) >= 0.3.8 with crate(winapi/ws2tcpip) < 0.4.0~)
BuildRequires: rust >= 1.49
%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~)
@ -57,6 +82,7 @@ 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/all) >= 0.4.0 with crate(socket2/all) < 0.5.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~)
@ -443,14 +469,14 @@ use the "winapi" feature of the "%{crate}" crate.
%cargo_prep
%build
%cargo_build
%cargo_build -a
%install
%cargo_install
%cargo_install -a
%if %{with check}
%check
%cargo_test
%cargo_test -a
%endif
%changelog

View file

@ -20,13 +20,38 @@ Patch: tokio-patch2.diff
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging >= 21
BuildRequires: (crate(bytes/default) >= 1.0.0 with crate(bytes/default) < 2.0.0~)
BuildRequires: (crate(libc/default) >= 0.2.42 with crate(libc/default) < 0.3.0~)
BuildRequires: (crate(memchr/default) >= 2.2.0 with crate(memchr/default) < 3.0.0~)
BuildRequires: (crate(mio/default) >= 0.8.1 with crate(mio/default) < 0.9.0~)
BuildRequires: (crate(mio/net) >= 0.8.1 with crate(mio/net) < 0.9.0~)
BuildRequires: (crate(mio/os-ext) >= 0.8.1 with crate(mio/os-ext) < 0.9.0~)
BuildRequires: (crate(mio/os-poll) >= 0.8.1 with crate(mio/os-poll) < 0.9.0~)
BuildRequires: (crate(num_cpus/default) >= 1.8.0 with crate(num_cpus/default) < 2.0.0~)
BuildRequires: (crate(once_cell/default) >= 1.5.2 with crate(once_cell/default) < 2.0.0~)
BuildRequires: (crate(parking_lot/default) >= 0.12.0 with crate(parking_lot/default) < 0.13.0~)
BuildRequires: (crate(pin-project-lite/default) >= 0.2.0 with crate(pin-project-lite/default) < 0.3.0~)
BuildRequires: (crate(signal-hook-registry/default) >= 1.1.1 with crate(signal-hook-registry/default) < 2.0.0~)
BuildRequires: (crate(socket2/all) >= 0.4.4 with crate(socket2/all) < 0.5.0~)
BuildRequires: (crate(socket2/default) >= 0.4.4 with crate(socket2/default) < 0.5.0~)
BuildRequires: (crate(tokio-macros/default) >= 1.7.0 with crate(tokio-macros/default) < 2.0.0~)
BuildRequires: (crate(tracing) >= 0.1.25 with crate(tracing) < 0.2.0~)
BuildRequires: (crate(tracing/std) >= 0.1.25 with crate(tracing/std) < 0.2.0~)
BuildRequires: (crate(winapi) >= 0.3.8 with crate(winapi) < 0.4.0~)
BuildRequires: (crate(winapi/consoleapi) >= 0.3.8 with crate(winapi/consoleapi) < 0.4.0~)
BuildRequires: (crate(winapi/handleapi) >= 0.3.8 with crate(winapi/handleapi) < 0.4.0~)
BuildRequires: (crate(winapi/mswsock) >= 0.3.8 with crate(winapi/mswsock) < 0.4.0~)
BuildRequires: (crate(winapi/namedpipeapi) >= 0.3.8 with crate(winapi/namedpipeapi) < 0.4.0~)
BuildRequires: (crate(winapi/std) >= 0.3.8 with crate(winapi/std) < 0.4.0~)
BuildRequires: (crate(winapi/threadpoollegacyapiset) >= 0.3.8 with crate(winapi/threadpoollegacyapiset) < 0.4.0~)
BuildRequires: (crate(winapi/winsock2) >= 0.3.8 with crate(winapi/winsock2) < 0.4.0~)
BuildRequires: (crate(winapi/ws2ipdef) >= 0.3.8 with crate(winapi/ws2ipdef) < 0.4.0~)
BuildRequires: (crate(winapi/ws2tcpip) >= 0.3.8 with crate(winapi/ws2tcpip) < 0.4.0~)
BuildRequires: rust >= 1.49
%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~)
@ -39,6 +64,7 @@ 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/all) >= 0.4.0 with crate(socket2/all) < 0.5.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~)
@ -544,14 +570,14 @@ use the "winapi" feature of the "%{crate}" crate.
%cargo_prep
%build
%cargo_build
%cargo_build -a
%install
%cargo_install
%cargo_install -a
%if %{with check}
%check
%cargo_test
%cargo_test -a
%endif
%changelog

View file

@ -0,0 +1,2 @@
[features]
enable-all = true

View file

@ -2,7 +2,7 @@ from importlib import resources
import pytest
from rust2rpm.conf import IniConf, TomlConf, to_list
from rust2rpm.conf import IniConf, TomlConf, to_list, conf_to_test_comments, conf_to_cargo_test_args
@pytest.mark.parametrize(
@ -126,6 +126,12 @@ def test_ini_conf_load(
{"v2_58", "v2_60", "v2_62", "v2_64", "v2_66", "v2_68", "v2_70", "v2_72", "v2_74", "v2_76"},
TomlConf(
{
"tests": {
"run": ["none"],
"comments": [
"tests are known to be broken upstream: https://github.com/gtk-rs/gtk-rs-core/issues/64"
],
},
"features": {
"hide": ["v2_76"],
},
@ -173,6 +179,18 @@ def test_ini_conf_load(
},
),
),
(
"nix-0.24.1.rust2rpm.toml",
set(),
TomlConf(
{
"tests": {
"run": ["none"],
"comments": ["tests are not reliable in containerized environments"],
},
},
),
),
(
"reqwest-0.11.20.rust2rpm.toml",
set(),
@ -297,3 +315,47 @@ def test_conf_toml_from_ini(
conf = IniConf.load([path], "fedora", features)
toml = TomlConf.from_conf(conf)
assert toml == expected
@pytest.mark.parametrize(
"filename,features,expected",
[
(
"dotenvy-0.15.7.rust2rpm.toml",
set(),
["# * files required by doctests are not included in published crates"],
),
(
"reqwest-0.11.20.rust2rpm.toml",
set(),
["# * skip tests which require internet access"],
),
],
ids=repr,
)
def test_conf_to_test_comments(filename, features: set[str], expected: str):
path = str(resources.files("rust2rpm.tests.samples").joinpath(filename))
conf = TomlConf.load(path, features)
assert conf_to_test_comments(conf) == expected
@pytest.mark.parametrize(
"filename,features,expected",
[
(
"dotenvy-0.15.7.rust2rpm.toml",
set(),
[" -- --lib", " -- --tests"],
),
(
"reqwest-0.11.20.rust2rpm.toml",
set(),
[" -- -- --exact --skip test_allowed_methods --skip test_badssl_modern --skip test_badssl_self_signed"],
),
],
ids=repr,
)
def test_conf_to_cargo_test_args(filename, features: set[str], expected: str):
path = str(resources.files("rust2rpm.tests.samples").joinpath(filename))
conf = TomlConf.load(path, features)
assert conf_to_cargo_test_args(conf) == expected

View file

@ -3,7 +3,7 @@ import os
from pathlib import Path
import re
import time
import typing
from typing import Optional, cast
from cargo2rpm.metadata import Metadata, FeatureFlags
import pytest
@ -28,10 +28,17 @@ FIXED_DATE = time.gmtime(12345)
@pytest.mark.parametrize(
"filename", ["cxx-build-1.0.71.json", "dotenvy-0.15.6.json", "nix-0.24.1.json", "tokio-1.19.2.json"]
"filename,conf",
[
("cxx-build-1.0.71.json", None),
("dotenvy-0.15.6.json", "dotenvy-0.15.7.rust2rpm.toml"),
("glib-sys-0.17.2.json", "glib-sys-0.17.2.rust2rpm.toml"),
("nix-0.24.1.json", "nix-0.24.1.rust2rpm.toml"),
("tokio-1.19.2.json", "tokio-1.19.2.rust2rpm.toml"),
],
)
@pytest.mark.parametrize("target", ["plain", "fedora", "mageia", "opensuse"])
def test_spec_file_render_crate(filename: str, target: str):
def test_spec_file_render_crate(filename: str, conf: Optional[str], target: str):
crate_name_version = filename.removesuffix(".json")
crate = crate_name_version.rsplit("-", 1)[0]
version = crate_name_version.rsplit("-", 1)[1]
@ -42,6 +49,12 @@ def test_spec_file_render_crate(filename: str, target: str):
real_path = resources.files("rust2rpm.tests.samples").joinpath(filename)
metadata = Metadata.from_json(real_path.read_text())
if conf:
toml_path = resources.files("rust2rpm.tests.samples").joinpath(conf)
tomlconf = TomlConf.load(str(toml_path), metadata.packages[0].get_feature_names())
else:
tomlconf = TomlConf()
rendered = spec_render_crate(
target=target,
upstream_version=version,
@ -51,7 +64,7 @@ def test_spec_file_render_crate(filename: str, target: str):
patch_file_manual=f"{crate}-patch2.diff",
license_files=["LIC1", "LIC2"],
doc_files=["DOC1", "DOC2"],
tomlconf=TomlConf(),
tomlconf=tomlconf,
feature_flags=FeatureFlags(),
relative_license_paths=False,
rpmautospec=target == "fedora",
@ -67,7 +80,7 @@ def test_spec_file_render_crate(filename: str, target: str):
rendered = re.sub(rf"(Copyright \(c\)) {spec_copyright_year}", r"\1 XXXX", rendered)
fixture_path = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec")
fixture_path = typing.cast(Path, fixture_path)
fixture_path = cast(Path, fixture_path)
if os.getenv("UPDATE_FIXTURES") == "1": # pragma nocover
# helper mode to create test data
@ -112,7 +125,7 @@ def test_spec_file_render_project(filename: str, target: str):
rendered = re.sub(rf"(Copyright \(c\)) {spec_copyright_year}", r"\1 XXXX", rendered)
fixture_path = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec")
fixture_path = typing.cast(Path, fixture_path)
fixture_path = cast(Path, fixture_path)
if os.getenv("UPDATE_FIXTURES") == "1": # pragma nocover
# helper mode to create test data
@ -154,7 +167,7 @@ def test_spec_file_render_workspace(filename: str, target: str):
rendered = re.sub(rf"(Copyright \(c\)) {spec_copyright_year}", r"\1 XXXX", rendered)
fixture_path = resources.files("rust2rpm.tests.samples").joinpath(f"{crate_name_version}.{target}.spec")
fixture_path = typing.cast(Path, fixture_path)
fixture_path = cast(Path, fixture_path)
if os.getenv("UPDATE_FIXTURES") == "1": # pragma nocover
# helper mode to create test data
@ -240,9 +253,9 @@ def test_spec_file_render_workspace(filename: str, target: str):
)
def test_drop_foreign_dependencies(filename: str, features: set[str], expected: str):
before_path = resources.files("rust2rpm.tests.samples").joinpath(filename)
before_path = typing.cast(Path, before_path)
before_path = cast(Path, before_path)
after_path = resources.files("rust2rpm.tests.samples").joinpath(expected)
after_path = typing.cast(Path, after_path)
after_path = cast(Path, after_path)
toml_before = before_path.read_text()
patched = preprocess_cargo_toml(toml_before, features) or toml_before