Initial package (rhbz#2260598)

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
This commit is contained in:
Michel Lind 2024-05-31 16:56:57 -05:00
commit cc91c146d3
No known key found for this signature in database
GPG key ID: 8B229D2F7CCC04F2
9 changed files with 418 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/coreutils-0.0.23.crate

13
coreutils-drop-conv.diff Normal file
View file

@ -0,0 +1,13 @@
--- a/tests/by-util/test_factor.rs
+++ b/tests/by-util/test_factor.rs
@@ -146,9 +146,7 @@ fn test_cli_args() {
#[test]
fn test_random() {
- use conv::prelude::ValueFrom;
-
- let log_num_primes = f64::value_from(NUM_PRIMES).unwrap().log2().ceil();
+ let log_num_primes = (NUM_PRIMES as f64).log2().ceil();
let primes = Sieve::primes().take(NUM_PRIMES).collect::<Vec<u64>>();
let rng_seed = SystemTime::now()

View file

@ -0,0 +1,11 @@
--- a/tests/by-util/test_factor.rs
+++ b/tests/by-util/test_factor.rs
@@ -10,7 +10,7 @@ use crate::common::util::TestScenario;
use std::time::{Duration, SystemTime};
-#[path = "../../src/uu/factor/sieve.rs"]
+#[path = "/usr/share/cargo/registry/uu_factor-0.0.23/sieve.rs"]
mod sieve;
use self::sieve::Sieve;

View file

@ -0,0 +1,45 @@
--- coreutils-0.0.23/Cargo.toml 1970-01-01T00:00:01+00:00
+++ coreutils-0.0.23/Cargo.toml 2024-02-27T21:32:15.020011+00:00
@@ -30,6 +30,7 @@
categories = ["command-line-utilities"]
license = "MIT"
repository = "https://github.com/uutils/coreutils"
+autobins = false
[profile.release]
lto = true
@@ -47,11 +48,6 @@
[[bin]]
name = "coreutils"
path = "src/bin/coreutils.rs"
-
-[[bin]]
-name = "uudoc"
-path = "src/bin/uudoc.rs"
-required-features = ["uudoc"]
[dependencies.arch]
version = "0.0.23"
@@ -613,9 +609,6 @@
]
default-features = false
-[dev-dependencies.conv]
-version = "0.3"
-
[dev-dependencies.filetime]
version = "0.2"
@@ -671,7 +664,11 @@
version = "0.11.2"
[features]
-default = ["feat_common_core"]
+default = [
+ "feat_common_core",
+ # "feat_selinux",
+ # "unix",
+]
feat_Tier1 = [
"feat_common_core",
"arch",

View file

@ -0,0 +1,154 @@
--- a/tests/by-util/test_seq.rs
+++ b/tests/by-util/test_seq.rs
@@ -391,97 +391,97 @@ fn test_width_negative_zero_decimal_nota
#[test]
fn test_width_negative_zero_scientific_notation() {
new_ucmd!()
- .args(&["-w", "-0e0", "1"])
+ .args(&["-w", "--", "-0e0", "1"])
.succeeds()
.stdout_is("-0\n01\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0e0", "1", "2"])
+ .args(&["-w", "--", "-0e0", "1", "2"])
.succeeds()
.stdout_is("-0\n01\n02\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0e0", "1", "2.0"])
+ .args(&["-w", "--", "-0e0", "1", "2.0"])
.succeeds()
.stdout_is("-0\n01\n02\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0e+1", "1"])
+ .args(&["-w", "--", "-0e+1", "1"])
.succeeds()
.stdout_is("-00\n001\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0e+1", "1", "2"])
+ .args(&["-w", "--", "-0e+1", "1", "2"])
.succeeds()
.stdout_is("-00\n001\n002\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0e+1", "1", "2.0"])
+ .args(&["-w", "--", "-0e+1", "1", "2.0"])
.succeeds()
.stdout_is("-00\n001\n002\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e0", "1"])
+ .args(&["-w", "--", "-0.000e0", "1"])
.succeeds()
.stdout_is("-0.000\n01.000\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e0", "1", "2"])
+ .args(&["-w", "--", "-0.000e0", "1", "2"])
.succeeds()
.stdout_is("-0.000\n01.000\n02.000\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e0", "1", "2.0"])
+ .args(&["-w", "--", "-0.000e0", "1", "2.0"])
.succeeds()
.stdout_is("-0.000\n01.000\n02.000\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e-2", "1"])
+ .args(&["-w", "--", "-0.000e-2", "1"])
.succeeds()
.stdout_is("-0.00000\n01.00000\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e-2", "1", "2"])
+ .args(&["-w", "--", "-0.000e-2", "1", "2"])
.succeeds()
.stdout_is("-0.00000\n01.00000\n02.00000\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e-2", "1", "2.0"])
+ .args(&["-w", "--", "-0.000e-2", "1", "2.0"])
.succeeds()
.stdout_is("-0.00000\n01.00000\n02.00000\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e5", "1"])
+ .args(&["-w", "--", "-0.000e5", "1"])
.succeeds()
.stdout_is("-000000\n0000001\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e5", "1", "2"])
+ .args(&["-w", "--", "-0.000e5", "1", "2"])
.succeeds()
.stdout_is("-000000\n0000001\n0000002\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e5", "1", "2.0"])
+ .args(&["-w", "--", "-0.000e5", "1", "2.0"])
.succeeds()
.stdout_is("-000000\n0000001\n0000002\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e5", "1"])
+ .args(&["-w", "--", "-0.000e5", "1"])
.succeeds()
.stdout_is("-000000\n0000001\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e5", "1", "2"])
+ .args(&["-w", "--", "-0.000e5", "1", "2"])
.succeeds()
.stdout_is("-000000\n0000001\n0000002\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-0.000e5", "1", "2.0"])
+ .args(&["-w", "--", "-0.000e5", "1", "2.0"])
.succeeds()
.stdout_is("-000000\n0000001\n0000002\n")
.no_stderr();
@@ -525,7 +525,7 @@ fn test_width_decimal_scientific_notatio
#[test]
fn test_width_negative_decimal_notation() {
new_ucmd!()
- .args(&["-w", "-.1", ".1", ".11"])
+ .args(&["-w", "--", "-.1", ".1", ".11"])
.succeeds()
.stdout_is("-0.1\n00.0\n00.1\n")
.no_stderr();
@@ -534,22 +534,22 @@ fn test_width_negative_decimal_notation(
#[test]
fn test_width_negative_scientific_notation() {
new_ucmd!()
- .args(&["-w", "-1e-3", "1"])
+ .args(&["-w", "--", "-1e-3", "1"])
.succeeds()
.stdout_is("-0.001\n00.999\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-1.e-3", "1"])
+ .args(&["-w", "--", "-1.e-3", "1"])
.succeeds()
.stdout_is("-0.001\n00.999\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-1.0e-4", "1"])
+ .args(&["-w", "--", "-1.0e-4", "1"])
.succeeds()
.stdout_is("-0.00010\n00.99990\n")
.no_stderr();
new_ucmd!()
- .args(&["-w", "-.1e2", "10", "100"])
+ .args(&["-w", "--", "-.1e2", "10", "100"])
.succeeds()
.stdout_is(
"-010

156
rust-coreutils.spec Normal file
View file

@ -0,0 +1,156 @@
# 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

34
rust2rpm.toml Normal file
View file

@ -0,0 +1,34 @@
[package]
summary = "coreutils ~ GNU coreutils reimplementation in Rust"
[tests]
comments = [
"--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_seq: tolerances too tight",
]
skip = [
"test_df::test_file_column_width_if_filename_contains_unicode_chars",
"test_df::test_nonexistent_file",
"test_df::test_output_file_specific_files",
"test_df::test_output_mp_repeat",
"test_df::test_output_option_without_equals_sign",
"test_df::test_total_label_in_correct_column",
"test_df::test_type_option_with_file",
"test_du::test_du_dereference_args",
"test_du::test_du_no_dereference",
"test_ls::test_device_number",
"test_seq::test_count_down_floats",
"test_seq::test_float_precision_increment",
"test_seq::test_inf_width",
"test_seq::test_neg_inf_width",
"test_seq::test_separator_and_terminator_floats",
"test_seq::test_width_decimal_scientific_notation_increment",
"test_seq::test_width_decimal_scientific_notation_trailing_zeros_end",
"test_seq::test_width_decimal_scientific_notation_trailing_zeros_increment",
"test_seq::test_width_floats",
"test_seq::test_width_negative_zero_decimal_notation",
"test_seq::test_width_negative_zero_scientific_notation",
]

3
series Normal file
View file

@ -0,0 +1,3 @@
coreutils-fix-finding-uu_factor.diff
coreutils-drop-conv.diff
coreutils-fix-seq-neg-num-tests.diff

1
sources Normal file
View file

@ -0,0 +1 @@
SHA512 (coreutils-0.0.23.crate) = 216aa4acfe92867aea7bd9d11e8239c0adf1b7bc308c226d310f7f872c5353282837172e8096dda645905b084eadaae942f88084a7968ee989ec0fc47c8f7f1b