rust-coreutils/rust-coreutils.spec
Michel Lind cc91c146d3
Initial package (rhbz#2260598)
Signed-off-by: Michel Lind <salimma@fedoraproject.org>
2024-05-31 16:56:57 -05:00

156 lines
5.6 KiB
RPMSpec

# Generated by rust2rpm 25
%bcond_without check
# cargo run manpage requires a lot of the optional crates
# we don't have yet
%bcond_with man
%global crate coreutils
Name: rust-coreutils
Version: 0.0.23
Release: %autorelease
Summary: coreutils ~ GNU coreutils reimplementation in Rust
License: MIT
URL: https://crates.io/crates/coreutils
Source: %{crates_source}
# Manually created patch for downstream crate metadata changes
# * don't use conv, unmaintained
# * drop uudoc, unneeded
# * TODO: enable feat_selinux
# * TODO: enable unix
Patch: coreutils-fix-metadata.diff
# Fix finding uu_factor, need to look in registry rather than relative path
Patch: coreutils-fix-finding-uu_factor.diff
# Fix test that uses conv
Patch: coreutils-drop-conv.diff
# Fix seq tests that pass negative numbers
Patch: coreutils-fix-seq-neg-num-tests.diff
BuildRequires: cargo-rpm-macros >= 24
%global _description %{expand:
coreutils ~ GNU coreutils (updated); implemented as universal (cross-
platform) utils, written in Rust.}
%description %{_description}
%package -n uutils-%{crate}
Summary: %{summary}
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# Apache-2.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-2-Clause
# CC0-1.0
# ISC
# MIT
# MIT OR Apache-2.0
# MIT-0 OR Apache-2.0
# Unlicense OR MIT
License: MIT AND (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND CC0-1.0 AND ISC AND (MIT-0 OR Apache-2.0) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown
%description -n uutils-%{crate} %{_description}
%files -n uutils-%{crate}
%license LICENSE
%license LICENSE.dependencies
%doc CODE_OF_CONDUCT.md
%doc CONTRIBUTING.md
%doc DEVELOPMENT.md
%doc README.md
%{_bindir}/uutils-%{crate}
%if %{with man}
%{_mandir}/man1/uu_*
%endif
%prep
%autosetup -n %{crate}-%{version} -p1
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%if %{with man}
mkdir -p data/man/man1
for utility in \
base32 \
base64 \
basename \
basenc \
cat \
cksum \
comm \
cp \
csplit \
cut \
date \
df \
dir \
dircolors \
dirname \
dd \
du \
echo \
env \
expand \
expr \
factor \
false \
fmt \
fold \
hashsum \
head \
join \
link \
ln \
ls \
mkdir \
mktemp \
more \
mv \
nl \
numfmt \
od \
paste \
pr \
printenv \
printf \
; do
target/rpm/coreutils manpage $utility > data/man/man1/uu_${utility}.1
done
%endif
%install
%cargo_install
mv %{buildroot}%{_bindir}/%{crate} %{buildroot}%{_bindir}/uutils-%{crate}
%if %{with man}
mkdir -p %{buildroot}%{_mandir}/man1
cp -p data/man/man1/uu_* %{buildroot}%{_mandir}/man1/
%endif
%if %{with check}
%check
# * --test-threads 1: tests fail with permission denied error if run with too many threads
# * test_df: needs an actual filesystem to test
# * test_du: expected sublink/symlink in output
# * test_ls: need block/char device
# * test_od: endianness issue on s390x
# * test_seq: tolerances too tight
%ifarch s390x
%cargo_test -- -- --test-threads 1 --skip test_df::test_file_column_width_if_filename_contains_unicode_chars --skip test_df::test_nonexistent_file --skip test_df::test_output_file_specific_files --skip test_df::test_output_mp_repeat --skip test_df::test_output_option_without_equals_sign --skip test_df::test_total_label_in_correct_column --skip test_df::test_type_option_with_file --skip test_du::test_du_dereference_args --skip test_du::test_du_no_dereference --skip test_ls::test_device_number --skip test_tail::test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same_size --skip test_seq::test_count_down_floats --skip test_seq::test_float_precision_increment --skip test_seq::test_inf_width --skip test_seq::test_neg_inf_width --skip test_seq::test_separator_and_terminator_floats --skip test_seq::test_width_decimal_scientific_notation_increment --skip test_seq::test_width_decimal_scientific_notation_trailing_zeros_end --skip test_seq::test_width_decimal_scientific_notation_trailing_zeros_increment --skip test_seq::test_width_floats --skip test_seq::test_width_negative_zero_decimal_notation --skip test_seq::test_width_negative_zero_scientific_notation --skip test_od::test_suppress_duplicates
%else
%cargo_test -- -- --test-threads 1 --skip test_df::test_file_column_width_if_filename_contains_unicode_chars --skip test_df::test_nonexistent_file --skip test_df::test_output_file_specific_files --skip test_df::test_output_mp_repeat --skip test_df::test_output_option_without_equals_sign --skip test_df::test_total_label_in_correct_column --skip test_df::test_type_option_with_file --skip test_du::test_du_dereference_args --skip test_du::test_du_no_dereference --skip test_ls::test_device_number --skip test_tail::test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same_size --skip test_seq::test_count_down_floats --skip test_seq::test_float_precision_increment --skip test_seq::test_inf_width --skip test_seq::test_neg_inf_width --skip test_seq::test_separator_and_terminator_floats --skip test_seq::test_width_decimal_scientific_notation_increment --skip test_seq::test_width_decimal_scientific_notation_trailing_zeros_end --skip test_seq::test_width_decimal_scientific_notation_trailing_zeros_increment --skip test_seq::test_width_floats --skip test_seq::test_width_negative_zero_decimal_notation --skip test_seq::test_width_negative_zero_scientific_notation
%endif
%endif
%changelog
%autochangelog