From 8be575a81101d7dfab399b2fbf90b4757428ec33 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Wed, 12 Feb 2025 11:56:30 -0800 Subject: [PATCH] Feat: uutils-coreutils-replace (#3056) (#3298) --------- Signed-off-by: Gil Signed-off-by: Gilver Co-authored-by: sadlerm4 (cherry picked from commit 0c32e18af7ac30ffb8e3f588dc36e382481b4f30) Co-authored-by: Gilver --- .../.gitignore | 0 anda/system/uutils-coreutils-replace/anda.hcl | 8 + .../coreutils-colorls.csh | 63 +++++++ .../coreutils-colorls.sh | 53 ++++++ .../coreutils-fix-metadata.diff | 40 +++++ .../coreutils-fix-seq-neg-num-tests.diff | 134 +++++++++++++++ .../update.rhai | 0 .../uutils-coreutils-replace.spec | 118 +++++++++++++ anda/system/uutils-coreutils/anda.hcl | 5 - .../uutils-coreutils/uutils-coreutils.spec | 160 ------------------ 10 files changed, 416 insertions(+), 165 deletions(-) rename anda/system/{uutils-coreutils => uutils-coreutils-replace}/.gitignore (100%) create mode 100644 anda/system/uutils-coreutils-replace/anda.hcl create mode 100644 anda/system/uutils-coreutils-replace/coreutils-colorls.csh create mode 100644 anda/system/uutils-coreutils-replace/coreutils-colorls.sh create mode 100644 anda/system/uutils-coreutils-replace/coreutils-fix-metadata.diff create mode 100644 anda/system/uutils-coreutils-replace/coreutils-fix-seq-neg-num-tests.diff rename anda/system/{uutils-coreutils => uutils-coreutils-replace}/update.rhai (100%) create mode 100644 anda/system/uutils-coreutils-replace/uutils-coreutils-replace.spec delete mode 100644 anda/system/uutils-coreutils/anda.hcl delete mode 100644 anda/system/uutils-coreutils/uutils-coreutils.spec diff --git a/anda/system/uutils-coreutils/.gitignore b/anda/system/uutils-coreutils-replace/.gitignore similarity index 100% rename from anda/system/uutils-coreutils/.gitignore rename to anda/system/uutils-coreutils-replace/.gitignore diff --git a/anda/system/uutils-coreutils-replace/anda.hcl b/anda/system/uutils-coreutils-replace/anda.hcl new file mode 100644 index 0000000000..b19312cdcf --- /dev/null +++ b/anda/system/uutils-coreutils-replace/anda.hcl @@ -0,0 +1,8 @@ +project pkg { + rpm { + spec = "uutils-coreutils-replace.spec" + } + labels { + subrepo = "extras" + } +} diff --git a/anda/system/uutils-coreutils-replace/coreutils-colorls.csh b/anda/system/uutils-coreutils-replace/coreutils-colorls.csh new file mode 100644 index 0000000000..66ec2fa8d2 --- /dev/null +++ b/anda/system/uutils-coreutils-replace/coreutils-colorls.csh @@ -0,0 +1,63 @@ +# skip everything for non-interactive shells +if (! $?prompt) exit + +# color-ls initialization +if ( $?USER_LS_COLORS ) then + if ( "$USER_LS_COLORS" != "" ) then + #when USER_LS_COLORS defined do not override user + #specified LS_COLORS and use them + goto finish + endif +endif + +alias ll 'ls -l' +alias l. 'ls -d .*' +set COLORS=/etc/DIR_COLORS + +if ($?TERM) then + if ( -e "/etc/DIR_COLORS.$TERM" ) then + set COLORS="/etc/DIR_COLORS.$TERM" + endif +endif +if ( -f ~/.dircolors ) set COLORS=~/.dircolors +if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors +if ($?TERM) then + if ( -f ~/.dircolors."$TERM" ) set COLORS=~/.dircolors."$TERM" + if ( -f ~/.dir_colors."$TERM" ) set COLORS=~/.dir_colors."$TERM" +endif +set INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`" + +if ( ! -e "$COLORS" ) exit + +set _tmp="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`" +#if mktemp fails, exit when include was active, otherwise use $COLORS file +if ( "$_tmp" == '' ) then + if ( "$INCLUDE" == '' ) then + eval "`/usr/bin/dircolors -c $COLORS`" + endif + goto cleanup +endif + +if ( "$INCLUDE" != '' ) /usr/bin/cat "$INCLUDE" >> $_tmp +/usr/bin/grep -v '^INCLUDE' "$COLORS" >> $_tmp + +eval "`/usr/bin/dircolors -c $_tmp`" + +/usr/bin/rm -f $_tmp + +if ( "$LS_COLORS" == '' ) exit +cleanup: +set color_none=`/usr/bin/sed -n '/^COLOR.*none/Ip' < $COLORS` +if ( "$color_none" != '' ) then + unset color_none + exit +endif +unset color_none +unset _tmp +unset INCLUDE +unset COLORS + +finish: +alias ll 'ls -l --color=auto' +alias l. 'ls -d .* --color=auto' +alias ls 'ls --color=auto' diff --git a/anda/system/uutils-coreutils-replace/coreutils-colorls.sh b/anda/system/uutils-coreutils-replace/coreutils-colorls.sh new file mode 100644 index 0000000000..5162f1e39c --- /dev/null +++ b/anda/system/uutils-coreutils-replace/coreutils-colorls.sh @@ -0,0 +1,53 @@ +# color-ls initialization + +# Skip all for noninteractive shells. +[ ! -t 0 ] && return + +#when USER_LS_COLORS defined do not override user LS_COLORS, but use them. +if [ -z "$USER_LS_COLORS" ]; then + + alias ll='ls -l' 2>/dev/null + alias l.='ls -d .*' 2>/dev/null + + INCLUDE= + COLORS= + + for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \ + "$HOME/.dir_colors" "$HOME/.dircolors"; do + [ -e "$colors" ] && COLORS="$colors" && \ + INCLUDE="`/usr/bin/cat "$COLORS" | /usr/bin/grep '^INCLUDE' | /usr/bin/cut -d ' ' -f2-`" && \ + break + done + + [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.$TERM" ] && \ + COLORS="/etc/DIR_COLORS.$TERM" + + [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS" ] && \ + COLORS="/etc/DIR_COLORS" + + # Existence of $COLORS already checked above. + [ -n "$COLORS" ] || return + + if [ -e "$INCLUDE" ]; + then + TMP="`/usr/bin/mktemp .colorlsXXX -q --tmpdir=/tmp`" + [ -z "$TMP" ] && return + + /usr/bin/cat "$INCLUDE" >> $TMP + /usr/bin/grep -v '^INCLUDE' "$COLORS" >> $TMP + + eval "`/usr/bin/dircolors --sh $TMP 2>/dev/null`" + /usr/bin/rm -f $TMP + else + eval "`/usr/bin/dircolors --sh $COLORS 2>/dev/null`" + fi + + [ -z "$LS_COLORS" ] && return + /usr/bin/grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return +fi + +unset TMP COLORS INCLUDE + +alias ll='ls -l --color=auto' 2>/dev/null +alias l.='ls -d .* --color=auto' 2>/dev/null +alias ls='ls --color=auto' 2>/dev/null diff --git a/anda/system/uutils-coreutils-replace/coreutils-fix-metadata.diff b/anda/system/uutils-coreutils-replace/coreutils-fix-metadata.diff new file mode 100644 index 0000000000..2ae3d7b2f0 --- /dev/null +++ b/anda/system/uutils-coreutils-replace/coreutils-fix-metadata.diff @@ -0,0 +1,40 @@ +--- coreutils-*/Cargo.toml ++++ coreutils-*/Cargo.toml +@@ -18,6 +18,7 @@ + categories = ["command-line-utilities"] + rust-version = "1.79.0" + edition = "2021" ++autobins = false + + build = "build.rs" + +@@ -325,7 +326,7 @@ + rand_core = "0.6.4" + rayon = "1.10" + regex = "1.10.4" +-rstest = "0.24.0" ++rstest = ">=0.24" + rust-ini = "0.21.0" + same-file = "1.0.6" + self_cell = "1.0.4" +@@ -514,7 +515,7 @@ + rstest = { workspace = true } + + [target.'cfg(any(target_os = "linux", target_os = "android"))'.dev-dependencies] +-procfs = { version = "0.17", default-features = false } ++procfs = { version = ">=0.16, <0.18", default-features = false } + + [target.'cfg(unix)'.dev-dependencies] + nix = { workspace = true, features = ["process", "signal", "user", "term"] } +@@ -537,11 +538,6 @@ + name = "coreutils" + path = "src/bin/coreutils.rs" +- +-[[bin]] +-name = "uudoc" +-path = "src/bin/uudoc.rs" +-required-features = ["uudoc"] + + # The default release profile. It contains all optimizations, without + # sacrificing debug info. With this profile (like in the standard + # release profile), the debug info and the stack traces will still be available. diff --git a/anda/system/uutils-coreutils-replace/coreutils-fix-seq-neg-num-tests.diff b/anda/system/uutils-coreutils-replace/coreutils-fix-seq-neg-num-tests.diff new file mode 100644 index 0000000000..dbb164e778 --- /dev/null +++ b/anda/system/uutils-coreutils-replace/coreutils-fix-seq-neg-num-tests.diff @@ -0,0 +1,134 @@ +--- a/tests/by-util/test_seq.rs ++++ b/tests/by-util/test_seq.rs +@@ -381,80 +381,80 @@ + #[test] + fn test_width_negative_zero_scientific_notation() { + new_ucmd!() +- .args(&["-w", "-0e0", "1"]) ++ .args(&["-w", "--", "-0e0", "1"]) + .succeeds() + .stdout_only("-0\n01\n"); + new_ucmd!() +- .args(&["-w", "-0e0", "1", "2"]) ++ .args(&["-w", "--", "-0e0", "1", "2"]) + .succeeds() + .stdout_only("-0\n01\n02\n"); + new_ucmd!() +- .args(&["-w", "-0e0", "1", "2.0"]) ++ .args(&["-w", "--", "-0e0", "1", "2.0"]) + .succeeds() + .stdout_only("-0\n01\n02\n"); + + new_ucmd!() +- .args(&["-w", "-0e+1", "1"]) ++ .args(&["-w", "--", "-0e+1", "1"]) + .succeeds() + .stdout_only("-00\n001\n"); + new_ucmd!() +- .args(&["-w", "-0e+1", "1", "2"]) ++ .args(&["-w", "--", "-0e+1", "1", "2"]) + .succeeds() + .stdout_only("-00\n001\n002\n"); + new_ucmd!() +- .args(&["-w", "-0e+1", "1", "2.0"]) ++ .args(&["-w", "--", "-0e+1", "1", "2.0"]) + .succeeds() + .stdout_only("-00\n001\n002\n"); + + new_ucmd!() +- .args(&["-w", "-0.000e0", "1"]) ++ .args(&["-w", "--", "-0.000e0", "1"]) + .succeeds() + .stdout_only("-0.000\n01.000\n"); + new_ucmd!() +- .args(&["-w", "-0.000e0", "1", "2"]) ++ .args(&["-w", "--", "-0.000e0", "1", "2"]) + .succeeds() + .stdout_only("-0.000\n01.000\n02.000\n"); + new_ucmd!() +- .args(&["-w", "-0.000e0", "1", "2.0"]) ++ .args(&["-w", "--", "-0.000e0", "1", "2.0"]) + .succeeds() + .stdout_only("-0.000\n01.000\n02.000\n"); + + new_ucmd!() +- .args(&["-w", "-0.000e-2", "1"]) ++ .args(&["-w", "--", "-0.000e-2", "1"]) + .succeeds() + .stdout_only("-0.00000\n01.00000\n"); + new_ucmd!() +- .args(&["-w", "-0.000e-2", "1", "2"]) ++ .args(&["-w", "--", "-0.000e-2", "1", "2"]) + .succeeds() + .stdout_only("-0.00000\n01.00000\n02.00000\n"); + new_ucmd!() +- .args(&["-w", "-0.000e-2", "1", "2.0"]) ++ .args(&["-w", "--", "-0.000e-2", "1", "2.0"]) + .succeeds() + .stdout_only("-0.00000\n01.00000\n02.00000\n"); + + new_ucmd!() +- .args(&["-w", "-0.000e5", "1"]) ++ .args(&["-w", "--", "-0.000e5", "1"]) + .succeeds() + .stdout_only("-000000\n0000001\n"); + new_ucmd!() +- .args(&["-w", "-0.000e5", "1", "2"]) ++ .args(&["-w", "--", "-0.000e5", "1", "2"]) + .succeeds() + .stdout_only("-000000\n0000001\n0000002\n"); + new_ucmd!() +- .args(&["-w", "-0.000e5", "1", "2.0"]) ++ .args(&["-w", "--", "-0.000e5", "1", "2.0"]) + .succeeds() + .stdout_only("-000000\n0000001\n0000002\n"); + + new_ucmd!() +- .args(&["-w", "-0.000e5", "1"]) ++ .args(&["-w", "--", "-0.000e5", "1"]) + .succeeds() + .stdout_only("-000000\n0000001\n"); + new_ucmd!() +- .args(&["-w", "-0.000e5", "1", "2"]) ++ .args(&["-w", "--", "-0.000e5", "1", "2"]) + .succeeds() + .stdout_only("-000000\n0000001\n0000002\n"); + new_ucmd!() +- .args(&["-w", "-0.000e5", "1", "2.0"]) ++ .args(&["-w", "--", "-0.000e5", "1", "2.0"]) + .succeeds() + .stdout_only("-000000\n0000001\n0000002\n"); + } +@@ -493,7 +493,7 @@ + #[test] + fn test_width_negative_decimal_notation() { + new_ucmd!() +- .args(&["-w", "-.1", ".1", ".11"]) ++ .args(&["-w", "--", "-.1", ".1", ".11"]) + .succeeds() + .stdout_only("-0.1\n00.0\n00.1\n"); + } +@@ -501,19 +501,19 @@ + #[test] + fn test_width_negative_scientific_notation() { + new_ucmd!() +- .args(&["-w", "-1e-3", "1"]) ++ .args(&["-w", "--", "-1e-3", "1"]) + .succeeds() + .stdout_only("-0.001\n00.999\n"); + new_ucmd!() +- .args(&["-w", "-1.e-3", "1"]) ++ .args(&["-w", "--", "-1.e-3", "1"]) + .succeeds() + .stdout_only("-0.001\n00.999\n"); + new_ucmd!() +- .args(&["-w", "-1.0e-4", "1"]) ++ .args(&["-w", "--", "-1.0e-4", "1"]) + .succeeds() + .stdout_only("-0.00010\n00.99990\n"); + new_ucmd!() +- .args(&["-w", "-.1e2", "10", "100"]) ++ .args(&["-w", "--", "-.1e2", "10", "100"]) + .succeeds() + .stdout_only( + "-010 diff --git a/anda/system/uutils-coreutils/update.rhai b/anda/system/uutils-coreutils-replace/update.rhai similarity index 100% rename from anda/system/uutils-coreutils/update.rhai rename to anda/system/uutils-coreutils-replace/update.rhai diff --git a/anda/system/uutils-coreutils-replace/uutils-coreutils-replace.spec b/anda/system/uutils-coreutils-replace/uutils-coreutils-replace.spec new file mode 100644 index 0000000000..5a86590f55 --- /dev/null +++ b/anda/system/uutils-coreutils-replace/uutils-coreutils-replace.spec @@ -0,0 +1,118 @@ +%global coreutils_ver 9.3 +%if 0%{?fedora} >= 42 +### Temporary solution, will be fixed on newer Oniguruma releases. +%global build_cflags %{__build_flags_lang_c} %{?_distro_extra_cflags} -std=c18 -std=gnu18 +%endif + +Name: uutils-coreutils-replace +Version: 0.0.29 +Release: 1%?dist +Summary: Cross-platform Rust rewrite of the GNU coreutils +License: MIT +URL: https://github.com/uutils/coreutils +Source0: %url/archive/refs/tags/%version.tar.gz +Source1: https://src.fedoraproject.org/rpms/coreutils/raw/rawhide/f/coreutils-colorls.sh +Source2: https://src.fedoraproject.org/rpms/coreutils/raw/rawhide/f/coreutils-colorls.csh +Source3: https://raw.githubusercontent.com/coreutils/coreutils/refs/heads/master/src/dircolors.hin +Patch0: coreutils-fix-metadata.diff +Patch1: coreutils-fix-seq-neg-num-tests.diff +Patch3: https://src.fedoraproject.org/rpms/coreutils/raw/rawhide/f/coreutils-8.32-DIR_COLORS.patch +BuildRequires: anda-srpm-macros +BuildRequires: cargo +BuildRequires: clang-devel +BuildRequires: gcc-c++ +BuildRequires: libselinux-devel +BuildRequires: make +BuildRequires: rustfmt +BuildRequires: selinux-policy-devel +Requires: glibc +Provides: coreutils +Provides: coreutils-common +Conflicts: uutils-coreutils + +%description +uutils coreutils is a cross-platform reimplementation of the GNU coreutils in Rust. +While all programs have been implemented, some options might be missing or different +behavior might be experienced. + +This package replaces the GNU coreutils commands. + + +%prep +%setup -q -n coreutils-%version +%cargo_prep_online +cp %{SOURCE3} . +sed dircolors.hin \ + -e 's| 00;36$| 01;36|' \ + > DIR_COLORS +sed dircolors.hin \ + -e 's| 01;31$| 00;31|' \ + -e 's| 01;35$| 00;35|' \ + > DIR_COLORS.lightbgcolor +%autopatch -p1 + +%build + +%install +export CARGOFLAGS="-vv --verbose" +install -p -c -Dm644 %{SOURCE1} %{buildroot}%{_sysconfdir}/profile.d/colorls.sh +install -p -c -Dm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/colorls.csh +install -p -c -Dm644 DIR_COLORS{,.lightbgcolor} %{buildroot}%{_sysconfdir} +/usr/bin/rm dircolors.hin DIR_COLORS DIR_COLORS.lightbgcolor +%make_install PROFILE_CMD='--profile=rpm' MULTICALL=n DESTDIR=%buildroot BUILDDIR=target/rpm PREFIX=%_prefix SELINUX_ENABLED=1 SKIP_UTILS='hostname kill more uptime' & +wait +ln -sr hashsum %{buildroot}%{_bindir}/sha1sum +ln -sr hashsum %{buildroot}%{_bindir}/sha224sum +ln -sr hashsum %{buildroot}%{_bindir}/sha256sum +ln -sr hashsum %{buildroot}%{_bindir}/sha384sum +ln -sr hashsum %{buildroot}%{_bindir}/sha512sum +ln -sr hashsum %{buildroot}%{_bindir}/sha3-224sum +ln -sr hashsum %{buildroot}%{_bindir}/sha3-256sum +ln -sr hashsum %{buildroot}%{_bindir}/sha3-384sum +ln -sr hashsum %{buildroot}%{_bindir}/sha3-512sum +ln -sr hashsum %{buildroot}%{_bindir}/sha3sum +ln -sr hashsum %{buildroot}%{_bindir}/shake128sum +ln -sr hashsum %{buildroot}%{_bindir}/shake256sum + +%define cmds() $(echo %1{runcon,arch,base{32,64,name,nc},cat,ch{grp,mod,own,root,con},cksum,comm,cp,csplit,cut,date,dd,df,dir{,colors,name},du,echo,env,expand,expr,factor,false,fmt,fold,groups,hashsum,head,host{id},id,install,join,link,ln,logname,ls,mk{dir,fifo,nod,temp},mv,nice,nl,nohup,nproc,numfmt,od,paste,pathchk,pinky,pr,printenv,printf,ptx,pwd,readlink,realpath,rm{,dir},seq,shred,shuf,sleep,sort,split,stat,stdbuf,sum,sync,tac,tail,tee,test,timeout,touch,tr,true,truncate,tsort,tty,uname,un{expand,iq,link},users,vdir,wc,who{,ami},yes}%2) +cat < files.txt +%cmds %_bindir/ "" +%_bindir/[ +%cmds %_datadir/bash-completion/completions/ "" +%cmds %_datadir/fish/vendor_completions.d/ .fish +%cmds %_mandir/man1/ .1.gz +%cmds %_datadir/zsh/site-functions/_ "" +EOF +sed -i 's@ @\n@g' files.txt + +# remove buildroot from paths in files.txt +sed -i "s@%buildroot@/@g" files.txt + + +echo "=== Files ===" +cat files.txt + +%files -f files.txt +%doc README.md +%license LICENSE +%{_bindir}/sha1sum +%{_bindir}/sha224sum +%{_bindir}/sha256sum +%{_bindir}/sha384sum +%{_bindir}/sha512sum +%{_bindir}/sha3-224sum +%{_bindir}/sha3-256sum +%{_bindir}/sha3-384sum +%{_bindir}/sha3-512sum +%{_bindir}/sha3sum +%{_bindir}/shake128sum +%{_bindir}/shake256sum +%config(noreplace) %{_sysconfdir}/DIR_COLORS +%config(noreplace) %{_sysconfdir}/DIR_COLORS.lightbgcolor +%{_sysconfdir}/profile.d/colorls.sh +%{_sysconfdir}/profile.d/colorls.csh + + + +%changelog +%autochangelog diff --git a/anda/system/uutils-coreutils/anda.hcl b/anda/system/uutils-coreutils/anda.hcl deleted file mode 100644 index 71536c0fc6..0000000000 --- a/anda/system/uutils-coreutils/anda.hcl +++ /dev/null @@ -1,5 +0,0 @@ -project pkg { - rpm { - spec = "uutils-coreutils.spec" - } -} diff --git a/anda/system/uutils-coreutils/uutils-coreutils.spec b/anda/system/uutils-coreutils/uutils-coreutils.spec deleted file mode 100644 index fe6f7f9a78..0000000000 --- a/anda/system/uutils-coreutils/uutils-coreutils.spec +++ /dev/null @@ -1,160 +0,0 @@ -%global coreutils_ver 9.3 - -Name: uutils-coreutils -Version: 0.0.29 -Release: 1%?dist -Summary: Cross-platform Rust rewrite of the GNU coreutils -License: MIT -URL: https://github.com/uutils/coreutils -Source0: %url/archive/refs/tags/%version.tar.gz -Requires: glibc -BuildRequires: cargo make gcc-c++ -Conflicts: uutils-coreutils-replace -BuildRequires: libselinux-devel -BuildRequires: selinux-policy-devel -BuildRequires: clang-devel - -%description -uutils coreutils is a cross-platform reimplementation of the GNU coreutils in Rust. -While all programs have been implemented, some options might be missing or different -behavior might be experienced. - -%package replace -Summary: Cross-platform Rust replacement of the GNU coreutils -Provides: coreutils = %coreutils_ver -Provides: coreutils(%arch) -Provides: coreutils-full - -%description replace -uutils coreutils is a cross-platform reimplementation of the GNU coreutils in Rust. -While all programs have been implemented, some options might be missing or different -behavior might be experienced. - -This package removes the `uu-` prefixes. - -%package util-linux -Summary: uutil-coreutils single binary, with util-linux commands -Requires: uutils-coreutils - -%description util-linux -uutils coreutils is a cross-platform reimplementation of the GNU coreutils in Rust. -While all programs have been implemented, some options might be missing or different -behavior might be experienced. - -This package provides a single binary with commands for util-linux with the `uu-` prefix. - -%package util-linux-replace -Summary: uutils-coreutils single-binary, replaces coreutils and util-linux -Provides: util-linux - -%description util-linux-replace -uutils coreutils is a cross-platform reimplementation of the GNU coreutils in Rust. -While all programs have been implemented, some options might be missing or different -behavior might be experienced. - -This package provides a single binary with all commands, and replaces the GNU coreutils and util-linux commands. - - -%prep -%autosetup -n coreutils-%version - -%build -export CARGOFLAGS="-vv --verbose" -%make_build PROFILE=release SELINUX_ENABLED=1 - -%install -%make_install PROFILE=release MULTICALL=n DESTDIR=%buildroot PREFIX=%_prefix SELINUX_ENABLED=1 PROG_PREFIX=uu- & -%make_install PROFILE=release MULTICALL=n DESTDIR=%buildroot PREFIX=%_prefix SELINUX_ENABLED=1 & -wait - -# function to remove files from a file list (used below for excludes) - -rm_filelist() { - local filelist=$1 - - for file in $(cat $filelist); do - echo ":: --> $file" - if [ -f "$file" ]; then - rm -vf "$file" - fi - if [ -f "%buildroot/$file" ]; then - rm -vf "%buildroot/$file" - fi - done -} - -%define cmds() $(echo %1{runcon,arch,base{32,64,name,nc},cat,ch{grp,mod,own,root,con},cksum,comm,cp,csplit,cut,date,dd,df,dir{,colors,name},du,echo,env,expand,expr,factor,false,fmt,fold,groups,hashsum,head,host{id},id,install,join,link,ln,logname,ls,mk{dir,fifo,nod,temp},mv,nice,nl,nohup,nproc,numfmt,od,paste,pathchk,pinky,pr,printenv,printf,ptx,pwd,readlink,realpath,rm{,dir},seq,shred,shuf,sleep,sort,split,stat,stdbuf,sum,sync,tac,tail,tee,test,timeout,touch,tr,true,truncate,tsort,tty,uname,un{expand,iq,link},users,vdir,wc,who{,ami},yes}%2) -%define excludes() $(echo %1{hostname,kill,more,uptime}%2) -cat < files.txt -%cmds %_bindir/uu- "" -%_bindir/uu-[ -%cmds %_datadir/bash-completion/completions/uu- "" -%cmds %_datadir/fish/vendor_completions.d/uu- .fish -%cmds %_mandir/man1/uu- .1.gz -%cmds %_datadir/zsh/site-functions/_uu- "" -EOF -sed -i 's@ @\n@g' files.txt - -cat < files-exclude.txt -%excludes %_datadir/bash-completion/completions/uu- "" -%excludes %_datadir/fish/vendor_completions.d/uu- .fish -%excludes %_mandir/man1/uu- .1.gz -%excludes %_datadir/zsh/site-functions/_uu- "" -%excludes %_bindir/uu- "" -EOF - -sed -i 's@ @\n@g' files-exclude.txt - -# remove buildroot from paths in files.txt -sed -i "s@%buildroot@/@g" files.txt - -### files-replace - -cat < files-replace.txt -%cmds %_bindir/ "" -%_bindir/[ -%cmds %_datadir/bash-completion/completions/ "" -%cmds %_datadir/fish/vendor_completions.d/ .fish -%cmds %_mandir/man1/ .1.gz -%cmds %_datadir/zsh/site-functions/_ "" -EOF -sed -i 's@ @\n@g' files-replace.txt - -cat < files-replace-exclude.txt -%excludes %_datadir/bash-completion/completions/ "" -%excludes %_datadir/fish/vendor_completions.d/ .fish -%excludes %_mandir/man1/ .1.gz -%excludes %_datadir/zsh/site-functions/_ "" -%excludes %_bindir/ "" -EOF - -sed -i 's@ @\n@g' files-replace-exclude.txt - -# remove buildroot from paths in files.txt -sed -i "s@%buildroot@/@g" files-replace.txt - - -echo "=== Files ===" -cat files.txt -echo "=== Files (Replace) ===" -cat files-replace.txt - -#echo "=== Removing files ===" - -#rm_filelist files-exclude.txt -#rm_filelist files-replace-exclude.txt - -%files -f files.txt -%doc README.md -%license LICENSE - -%files replace -f files-replace.txt -%doc README.md -%license LICENSE - -%files util-linux -f files-exclude.txt - -%files util-linux-replace -f files-replace-exclude.txt - -%changelog -%autochangelog