[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4fa3b0b 3/3: Use long options for 'xargs' thr
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4fa3b0b 3/3: Use long options for 'xargs' throughout lmi |
Date: |
Mon, 30 Sep 2019 17:31:24 -0400 (EDT) |
branch: master
commit 4fa3b0b9a66ef1bba9d5fbb6e22bb3921d4e50b7
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Use long options for 'xargs' throughout lmi
Although it is "deprecated", '--replace' is preferable to '-I'. An '-I'
option is always confusing, because it looks like either '-l' or '-1' in
too many fonts. '--replace', meaning '-i', is deprecated by POSIX only
because "-i" has an implicit "'{}'" argument; but "-i '{}'" and thus
"--replace='{}'" are perfectly okay. If the GNU project had defined a
long option for '-I', that would be perfect.
Incidentally replaced '-P 0' by '--max-procs="$(nproc)"', because:
$xargs --show-limits
Maximum parallelism (--max-procs must be no greater): 2147483647
and, given enough arguments, '-P 2147483647' might do something insane.
The imperfect portability of 'nproc' is preferable to insanity.
---
GNUmakefile | 2 +-
check_git_setup.sh | 2 +-
gwc/develop1.txt | 2 +-
install_msw.sh | 4 ++--
lmi_setup_43.sh | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index e427099..b65d018 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -475,7 +475,7 @@ check_concinnity: source_clean custom_tools
-not -name 'commit-msg' -not -name 'pre-commit' \
| $(SED) -e's/^/Improperly executable: /'
@find $(prefascicle_dir) -executable -type f -print0 \
- | xargs -0 -n 1 -P 0 ./check_script.sh
+ | xargs --null --max-args=1 --max-procs="$(shell nproc)"
./check_script.sh
@$(ECHO) " Problems detected by xmllint:"
@for z in $(xml_files); \
do \
diff --git a/check_git_setup.sh b/check_git_setup.sh
index 0e35098..189a3aa 100755
--- a/check_git_setup.sh
+++ b/check_git_setup.sh
@@ -44,7 +44,7 @@ case "$lmi_build_type" in
printf '%s...' "$d" \
&& find ./$d -maxdepth 1 -type f \
-not -name '*.sh' -not -name '*.sed' -print0 \
- | xargs -0 chmod -x \
+ | xargs --null chmod -x \
)done; \
printf 'all incorrect execute permissions removed\n'
git config core.filemode false
diff --git a/gwc/develop1.txt b/gwc/develop1.txt
index 0c18c26..264d5a5 100644
--- a/gwc/develop1.txt
+++ b/gwc/develop1.txt
@@ -180,7 +180,7 @@ for z in $(git diff HEAD@{1} --name-only) ; do touch
--reference=/opt/lmi/src/lm
for z in *(m-1) ; do touch --reference=$z /opt/lmi/free/src/lmi/$z; done
# Alternatively:
-find . -path ./.git -prune -o -type f -print0 | xargs -0 -n 1 -P 0 -i '{}'
touch '--reference=/opt/lmi/src/lmi/{}' '{}'
+find . -path ./.git -prune -o -type f -print0 | xargs --null --max-args=1
--max-procs="$(nproc)" --replace='{}' touch '--reference=/opt/lmi/src/lmi/{}'
'{}'
# Third screen: only for building and testing
diff --git a/install_msw.sh b/install_msw.sh
index ca56c5f..646a02d 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -233,7 +233,7 @@ mkdir --parents /cache_for_lmi/downloads
mount
md5sum "$0"
-find /cache_for_lmi/downloads -type f -print0 | xargs -0 md5sum
+find /cache_for_lmi/downloads -type f -print0 | xargs --null md5sum
make "$coefficiency" --output-sync=recurse -f install_miscellanea.make clobber
make "$coefficiency" --output-sync=recurse -f install_miscellanea.make
@@ -269,7 +269,7 @@ do
./install_wx.sh
./install_wxpdfdoc.sh
- find /cache_for_lmi/downloads -type f -print0 | xargs -0 md5sum
+ find /cache_for_lmi/downloads -type f -print0 | xargs --null md5sum
# Source this script only for commands that depend upon it.
. ./set_toolchain.sh
diff --git a/lmi_setup_43.sh b/lmi_setup_43.sh
index b717e15..38d48e4 100755
--- a/lmi_setup_43.sh
+++ b/lmi_setup_43.sh
@@ -92,4 +92,4 @@ cd free/src || { printf 'failed: cd\n'; exit 3; }
git clone git://git.savannah.nongnu.org/lmi.git
cd lmi || { printf 'failed: cd\n'; exit 3; }
find . -path ./.git -prune -o -type f -print0 \
- | xargs -0 -n 1 -P 0 -i '{}' touch '--reference=/opt/lmi/src/lmi/{}' '{}'
+ | xargs --null --max-args=1 --max-procs="$(nproc)" --replace='{}' touch
'--reference=/opt/lmi/src/lmi/{}' '{}'