diff --git a/coreutils-fix-metadata.diff b/coreutils-fix-metadata.diff index 90edc62..52df756 100644 --- a/coreutils-fix-metadata.diff +++ b/coreutils-fix-metadata.diff @@ -1,5 +1,5 @@ --- coreutils-0.0.27/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ coreutils-0.0.27/Cargo.toml 2026-01-05T09:34:07.355658+00:00 ++++ coreutils-0.0.27/Cargo.toml 2024-10-11T09:06:58.472078+00:00 @@ -30,6 +30,7 @@ categories = ["command-line-utilities"] license = "MIT" @@ -20,21 +20,12 @@ [dependencies.arch] version = "0.0.27" -@@ -620,7 +616,7 @@ - version = "0.3.1" - - [dev-dependencies.hex-literal] --version = "0.4.1" -+version = ">=0.4.1, <2.0" - - [dev-dependencies.libc] - version = "0.2.153" @@ -639,7 +635,7 @@ version = "1.10.4" [dev-dependencies.rstest] -version = "0.21.0" -+version = "0.26.0" ++version = ">=0.18,<0.24" [dev-dependencies.sha1] version = "0.10.6" @@ -51,12 +42,3 @@ feat_Tier1 = [ "feat_common_core", "arch", -@@ -878,7 +878,7 @@ - version = "0.5.1" - - [target."cfg(any(target_os = \"linux\", target_os = \"android\"))".dev-dependencies.procfs] --version = "0.16" -+version = ">=0.16, <0.19" - default-features = false - - [target."cfg(unix)".dev-dependencies.nix] diff --git a/coreutils-wrapper.sh b/coreutils-wrapper.sh new file mode 100755 index 0000000..88ee673 --- /dev/null +++ b/coreutils-wrapper.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Wrapper to invoke coreutils multicall via individual libexec symlink +# +# To use: +# - symlink this to /usr/bin/uu_$utility +# - it will invoke /usr/libexec/uutils-coreutils/$utility +# - that is in turn a symlink to /usr/bin/uutils-coreutils, which is a +# multicall binary that behaves like $utility when that is argv[0] + +CALLED_AS=$(basename "$0") + +UTILITY=${CALLED_AS#uu_} + +CMD="/usr/libexec/uutils-coreutils/$UTILITY" + +if [ -L "$CMD" ]; then + # we want the argv to be passed as-is here + # shellcheck disable=SC2068 + "$CMD" $@ +else + echo "Error: $CMD not found" >&2 + exit 1 +fi diff --git a/rust-coreutils.spec b/rust-coreutils.spec index 310bc69..4977699 100644 --- a/rust-coreutils.spec +++ b/rust-coreutils.spec @@ -1,5 +1,5 @@ -# Generated by rust2rpm 28 -%bcond check 1 +# Generated by rust2rpm 26 +%bcond_without check %global crate coreutils @@ -11,20 +11,18 @@ Summary: coreutils ~ GNU coreutils reimplementation in Rust License: MIT URL: https://crates.io/crates/coreutils Source: %{crates_source} +# * Wrapper to invoke coreutils multicall via individual libexec symlink +Source: coreutils-wrapper.sh # * Script to list available coreutils commands -Source1: coreutils-ls-commands.sh +Source: coreutils-ls-commands.sh # Manually created patch for downstream crate metadata changes # * drop uudoc, unneeded -# * update rstest to 0.26: -# https://github.com/uutils/coreutils/commit/001a91fbe6adea29a566326df3fcda30f89e97ab +# * temporarily lower rstest from 0.21.0 to 0.18.0 # * enable feat_acl # * TODO: enable unix -# * allow procfs 0.17, 0.18 -# * allow hex-literal 1.0: -# https://github.com/uutils/coreutils/commit/944cd4f72ca7d6e87d06d0a0a5b9e8dafedfba4b Patch: coreutils-fix-metadata.diff # * Fix seq tests that pass negative numbers -Patch2: coreutils-fix-seq-neg-num-tests.diff +Patch: coreutils-fix-seq-neg-num-tests.diff # leaf package, SIGABRT on compile ExcludeArch: %{ix86} @@ -153,6 +151,7 @@ Obsoletes: uu_yes < %{obsolete_uu_nvr} %doc README.md %{_bindir}/uutils-coreutils %{_bindir}/uu_* +%{_libexecdir}/uutils-coreutils/* %{_mandir}/man1/* %{bash_completions_dir}/* %{fish_completions_dir}/* @@ -161,8 +160,10 @@ Obsoletes: uu_yes < %{obsolete_uu_nvr} %prep %autosetup -n %{crate}-%{version} -p1 %cargo_prep -# coreutils-ls-commands.sh script +# coreutils-wrapper.sh script cp -p %{SOURCE1} . +# coreutils-ls-commands.sh script +cp -p %{SOURCE2} . %generate_buildrequires %cargo_generate_buildrequires @@ -191,8 +192,11 @@ target/rpm/coreutils completion coreutils fish > data/completions/fish/uutils-co %install %cargo_install mv %{buildroot}/%{_bindir}/coreutils %{buildroot}/%{_bindir}/uutils-coreutils +mkdir -p %{buildroot}%{_libexecdir}/uutils-coreutils/misc +cp -p coreutils-wrapper.sh %{buildroot}%{_libexecdir}/uutils-coreutils/misc/ for utility in $(./coreutils-ls-commands.sh target/rpm/coreutils); do - ln -sr %{buildroot}%{_bindir}/uutils-coreutils %{buildroot}%{_bindir}/uu_$utility + ln -sr %{buildroot}%{_bindir}/uutils-coreutils %{buildroot}%{_libexecdir}/uutils-coreutils/$utility + ln -sr %{buildroot}%{_libexecdir}/uutils-coreutils/misc/coreutils-wrapper.sh %{buildroot}%{_bindir}/uu_$utility done mkdir -p %{buildroot}%{_mandir}/man1 cp -p data/man/man1/* %{buildroot}%{_mandir}/man1/ @@ -218,58 +222,13 @@ cp -p data/completions/zsh/* %{buildroot}%{zsh_completions_dir}/ # * test_sort: formatting differences with recent unicode-width versions %ifarch s390x # * test_od::test_suppress_duplicates: likely endianness issue -%endif -%{cargo_test -- -- %{shrink: - --skip common::util::tests::test_compare_xattrs - --skip test_chcon:: - --skip test_runcon:: - --skip test_cp::test_copy_dir_preserve_permissions - --skip test_cp::test_copy_dir_preserve_permissions_inaccessible_file - --skip test_cp::test_copy_through_dangling_symlink_no_dereference_permissions - --skip test_cp::test_cp_debug_reflink_auto_sparse_always_non_sparse_file_with_long_zero_sequence - --skip test_cp::test_cp_parents_2_dirs - --skip test_cp::test_cp_parents_with_permissions_copy_dir - --skip test_cp::test_cp_parents_with_permissions_copy_file - --skip test_cp::test_cp_preserve_xattr - --skip test_cp::test_cp_sparse_always_empty - --skip test_cp::test_cp_sparse_always_non_empty - --skip test_cp::test_preserve_hardlink_attributes_in_directory - --skip test_cp::test_preserve_mode - --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_ls::test_ls_allocation_size - --skip test_ls::test_ls_inode - --skip test_ls::test_ls_long_format - --skip test_ls::test_ls_long_formats - --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 -%ifarch s390x - --skip test_od::test_suppress_duplicates -%endif - --skip test_sort::test_keys_closed_range - --skip test_sort::test_keys_multiple_ranges - --skip test_sort::test_keys_no_field_match - --skip test_sort::test_keys_open_ended -}} +%cargo_test -- -- --skip common::util::tests::test_compare_xattrs --skip test_chcon:: --skip test_runcon:: --skip test_cp::test_copy_dir_preserve_permissions --skip test_cp::test_copy_dir_preserve_permissions_inaccessible_file --skip test_cp::test_copy_through_dangling_symlink_no_dereference_permissions --skip test_cp::test_cp_debug_reflink_auto_sparse_always_non_sparse_file_with_long_zero_sequence --skip test_cp::test_cp_parents_2_dirs --skip test_cp::test_cp_parents_with_permissions_copy_dir --skip test_cp::test_cp_parents_with_permissions_copy_file --skip test_cp::test_cp_preserve_xattr --skip test_cp::test_cp_sparse_always_empty --skip test_cp::test_cp_sparse_always_non_empty --skip test_cp::test_preserve_hardlink_attributes_in_directory --skip test_cp::test_preserve_mode --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_ls::test_ls_allocation_size --skip test_ls::test_ls_inode --skip test_ls::test_ls_long_format --skip test_ls::test_ls_long_formats --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 --skip test_sort::test_keys_closed_range --skip test_sort::test_keys_multiple_ranges --skip test_sort::test_keys_no_field_match --skip test_sort::test_keys_open_ended +%else +%cargo_test -- -- --skip common::util::tests::test_compare_xattrs --skip test_chcon:: --skip test_runcon:: --skip test_cp::test_copy_dir_preserve_permissions --skip test_cp::test_copy_dir_preserve_permissions_inaccessible_file --skip test_cp::test_copy_through_dangling_symlink_no_dereference_permissions --skip test_cp::test_cp_debug_reflink_auto_sparse_always_non_sparse_file_with_long_zero_sequence --skip test_cp::test_cp_parents_2_dirs --skip test_cp::test_cp_parents_with_permissions_copy_dir --skip test_cp::test_cp_parents_with_permissions_copy_file --skip test_cp::test_cp_preserve_xattr --skip test_cp::test_cp_sparse_always_empty --skip test_cp::test_cp_sparse_always_non_empty --skip test_cp::test_preserve_hardlink_attributes_in_directory --skip test_cp::test_preserve_mode --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_ls::test_ls_allocation_size --skip test_ls::test_ls_inode --skip test_ls::test_ls_long_format --skip test_ls::test_ls_long_formats --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_sort::test_keys_closed_range --skip test_sort::test_keys_multiple_ranges --skip test_sort::test_keys_no_field_match --skip test_sort::test_keys_open_ended +# non-s390x %endif # check +%endif %changelog %autochangelog diff --git a/rust2rpm.toml b/rust2rpm.toml index 0548894..924ca68 100644 --- a/rust2rpm.toml +++ b/rust2rpm.toml @@ -4,14 +4,13 @@ description = "coreutils ~ GNU coreutils (updated); implemented as universal (cr cargo-toml-patch-comments = [ "drop uudoc, unneeded", - "update rstest to 0.26: https://github.com/uutils/coreutils/commit/001a91fbe6adea29a566326df3fcda30f89e97ab", + "temporarily lower rstest from 0.21.0 to 0.18.0", "enable feat_acl", "TODO: enable unix", - "allow procfs 0.17, 0.18", - "allow hex-literal 1.0: https://github.com/uutils/coreutils/commit/944cd4f72ca7d6e87d06d0a0a5b9e8dafedfba4b", ] extra-sources = [ - { "number" = 1, "file" = "coreutils-ls-commands.sh", "comments" = ["Script to list available coreutils commands"] }, + { "number" = 1, "file" = "coreutils-wrapper.sh", "comments" = ["Wrapper to invoke coreutils multicall via individual libexec symlink"] }, + { "number" = 2, "file" = "coreutils-ls-commands.sh", "comments" = ["Script to list available coreutils commands"] }, ] extra-patches = [ { "number" = 2, "file" = "coreutils-fix-seq-neg-num-tests.diff", "comments" = ["Fix seq tests that pass negative numbers"] }, @@ -21,6 +20,7 @@ bin-package-name = "uutils-coreutils" extra-files = [ "%{_bindir}/uu_*", + "%{_libexecdir}/uutils-coreutils/*", "%{_mandir}/man1/*", "%{bash_completions_dir}/*", "%{fish_completions_dir}/*", @@ -32,8 +32,10 @@ coreutils = "uutils-coreutils" [scripts] prep.post = ["""\ +# coreutils-wrapper.sh script +cp -p %{SOURCE1} . # coreutils-ls-commands.sh script -cp -p %{SOURCE1} ."""] +cp -p %{SOURCE2} ."""] build.post = ["""\ mkdir -p data/man/man1 @@ -54,8 +56,11 @@ target/rpm/coreutils completion coreutils fish > data/completions/fish/uutils-co """] install.post = ["""\ +mkdir -p %{buildroot}%{_libexecdir}/uutils-coreutils/misc +cp -p coreutils-wrapper.sh %{buildroot}%{_libexecdir}/uutils-coreutils/misc/ for utility in $(./coreutils-ls-commands.sh target/rpm/coreutils); do - ln -sr %{buildroot}%{_bindir}/uutils-coreutils %{buildroot}%{_bindir}/uu_$utility + ln -sr %{buildroot}%{_bindir}/uutils-coreutils %{buildroot}%{_libexecdir}/uutils-coreutils/$utility + ln -sr %{buildroot}%{_libexecdir}/uutils-coreutils/misc/coreutils-wrapper.sh %{buildroot}%{_bindir}/uu_$utility done mkdir -p %{buildroot}%{_mandir}/man1 cp -p data/man/man1/* %{buildroot}%{_mandir}/man1/