diff --git a/srcpkgs/uutils-coreutils/patches/zsh-completion-fix.patch b/srcpkgs/uutils-coreutils/patches/zsh-completion-fix.patch new file mode 100644 index 00000000000000..4ac6a5d8fe2c65 --- /dev/null +++ b/srcpkgs/uutils-coreutils/patches/zsh-completion-fix.patch @@ -0,0 +1,20 @@ +Fix Zsh completion "bad pattern: [" error. + +--- a/src/bin/uudoc.rs ++++ b/src/bin/uudoc.rs +@@ -203,7 +203,14 @@ + }; + let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility; + +- clap_complete::generate(shell, &mut command, bin_name, &mut io::stdout()); ++ let mut buffer = Vec::new(); ++ clap_complete::generate(shell, &mut command, bin_name, &mut buffer); ++ let mut completion = String::from_utf8(buffer).unwrap(); ++ if shell == Shell::Zsh { ++ completion = completion.replace("([)", "(\\[)") ++ .replace("[_commands", "_bracket_commands"); ++ } ++ io::stdout().write_all(completion.as_bytes()).unwrap(); + io::stdout().flush().unwrap(); + process::exit(0); + } diff --git a/srcpkgs/uutils-coreutils/template b/srcpkgs/uutils-coreutils/template new file mode 100644 index 00000000000000..fad1652203f81f --- /dev/null +++ b/srcpkgs/uutils-coreutils/template @@ -0,0 +1,89 @@ +# Template file for 'uutils-coreutils' +pkgname=uutils-coreutils +version=0.8.0 +revision=1 +build_style=gnu-makefile +build_helper="rust" +make_build_args="MULTICALL=y PROFILE=release" +make_install_args="MULTICALL=y PROFILE=release" +hostmakedepends="cargo pkg-config" +makedepends="oniguruma-devel rust-std" +short_desc="Cross-platform Rust rewrite of the GNU coreutils" +maintainer="Nafis " +license="MIT" +homepage="https://github.com/uutils/coreutils" +distfiles="https://github.com/uutils/coreutils/archive/refs/tags/${version}.tar.gz" +checksum=03f765fd23e9cc66f8789edc6928644d8eae5e5a7962d83795739d0a8a85eaef +alternatives=" + hostname:hostname:/usr/bin/hostname-coreutils + hostname:hostname.1:/usr/share/man/man1/hostname-coreutils.1" +conflicts="coreutils" +replaces="coreutils>=0" + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" oniguruma-devel" +fi + +make_check=no # tests fail in chroot + +# Failed tests: +# test_chgrp::basic_succeeds +# test_chgrp::test_big_p +# test_chgrp::test_from_option +# test_chgrp::test_from_with_invalid_group +# test_chgrp::test_from_with_reference +# test_chgrp::test_numeric_group_formats +# test_chgrp::test_reference +# test_chgrp::test_subdir_permission_denied +# test_chgrp::test_traverse_symlinks +# test_chown::test_big_p +# test_cp::test_cp_r_symlink +# 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_groups::test_groups +# test_hostname::test_hostname_ip +# test_id::test_id_default_format +# test_id::test_id_ignore +# test_id::test_id_name +# test_id::test_id_no_specified_user +# test_id::test_id_no_specified_user_posixly +# test_id::test_id_real +# test_id::test_id_zero +# test_ls::test_ls_allocation_size +# test_stat::test_mount_point_basic +# test_stat::test_mount_point_combined_with_other_specifiers +# test_stat::test_multi_files +# test_stat::test_normal_format +# test_stat::test_percent_escaping +# test_stat::test_printf +# test_stat::test_symlinks +# test_stdbuf::test_libstdbuf_preload +# test_stdbuf::test_stdbuf_line_buffered_stdout +# test_stdbuf::test_stdbuf_no_fork_regression +# test_stdbuf::test_stdbuf_non_utf8_paths +# test_stdbuf::test_stdbuf_trailing_var_arg +# test_stdbuf::test_stdbuf_unbuffered_stdout +# test_test::test_file_not_owned_by_egid +# test_test::test_file_not_owned_by_euid +# test_touch::test_touch_system_fails +# test_who::test_boot + +export SKIP_UTILS="more kill uptime" # conflict with util-linux and procps-ng + +pre_build() { + # Remove cargo config target overrides + rm .cargo/config.toml + # Prevent cross-sysroot poisoning when building host tools for documentation + vsed -i 's/@unset CARGO_BUILD_TARGET/& \&\& unset RUSTFLAGS CFLAGS CXXFLAGS LDFLAGS CPPFLAGS/' GNUmakefile +} + +post_install() { + mv ${DESTDIR}/usr/bin/hostname ${DESTDIR}/usr/bin/hostname-coreutils + mv ${DESTDIR}/usr/share/man/man1/hostname.1 ${DESTDIR}/usr/share/man/man1/hostname-coreutils.1 + vlicense LICENSE +}