# Generated by rust2rpm 21 %bcond_without check %global crate tree-sitter-cli Name: rust-%{crate} Version: 0.20.6 Release: %autorelease Summary: CLI tool for developing, testing, and using Tree-sitter parsers # Upstream license specification: MIT License: MIT URL: https://crates.io/crates/tree-sitter-cli Source: %{crates_source} # Upstream license file - tree-sitter/tree-sitter#1520 Source1: https://github.com/tree-sitter/tree-sitter/raw/v%{version}/LICENSE#/LICENSE.upstream # The data required for running tests (multiple sources, MIT with license files) # Generated with get-test-fixtures.sh Source2: tree-sitter-fixtures-%{version}.tar.xz Source3: get-test-fixtures.sh # Fix tests on non-x86 architectures - https://github.com/tree-sitter/tree-sitter#1692 Patch0: test-use-platform-independent-c_char-instead-of-i8.patch ExclusiveArch: %{rust_arches} BuildRequires: rust-packaging >= 21 %if %{with check} %ifarch %{nodejs_arches} # Required by tests::corpus_test::test_feature_corpus_files BuildRequires: /usr/bin/node %endif %endif %global _description %{expand: CLI tool for developing, testing, and using Tree-sitter parsers.} %description %{_description} %package -n %{crate} Summary: %{summary} # ASL 2.0 # ASL 2.0 or Boost # ASL 2.0 or MIT # BSD # ISC # MIT # MIT and Unicode # MIT or ASL 2.0 or zlib # Unlicense or MIT # See LICENSE.dependencies for a full list of buildroot crates and licenses # The commands to generate the list (replace %% -> %): # $ mock --no-cleanup-after --without-check # $ mock --dnf-cmd repoquery --cacheonly "rust-*-devel" --installed --qf "# %%{LICENSE}: %%{source_name} %%{version}" | \ # dos2unix | tee LICENSE.dependencies | cut -d: -f1 | sort -u License: MIT and ASL 2.0 and BSD and ISC and Unicode %description -n %{crate} %{_description} %files -n %{crate} %license LICENSE %doc README.md %{_bindir}/tree-sitter %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 LICENSE %doc %{crate_instdir}/README.md %{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 %prep %autosetup -n %{crate}-%{version_no_tilde} -p2 %{?with_check:-b2} %cargo_prep cp %{SOURCE1} LICENSE # Provide symlink for the C library headers. Test suite requires that # to compile parsers without libtree-sitter-devel. # See cli/src/tests/helpers/{dirs,fixtures}.rs ln -sf %{cargo_registry}/tree-sitter-0.* ../lib # Delete unwanted files rm -rf npm %generate_buildrequires %cargo_generate_buildrequires %build %cargo_build %install %cargo_install %if %{with check} %check TEST_ARGS=( -- # forbid parallel execution; tests may attempt to compile and load the same parser library --test-threads=1 %ifarch s390x # https://github.com/tree-sitter/tree-sitter/issues/1693 --skip tests::query_test::test_query_is_pattern_guaranteed_at_step %endif %ifnarch %{nodejs_arches} # requres /usr/bin/node --skip tests::corpus_test::test_feature_corpus_files %endif ) %cargo_test -- "${TEST_ARGS[@]}" %endif %changelog %autochangelog