diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-01-27 10:04:08 +1100 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-01-27 10:04:08 +1100 |
commit | 53c5f38366e6d41ca0823f7d3c1457563b4390f5 (patch) | |
tree | eec0e2c8a7432b28a0d86fae9bd0c75ef36b40a9 | |
parent | d3f0af2aaa9ae0b624193ee314287f1b2490bb71 (diff) | |
parent | 18060bf8d4b7c395336dd2062779c0519d41636b (diff) | |
download | mongo-53c5f38366e6d41ca0823f7d3c1457563b4390f5.tar.gz |
Merge pull request #2462 from wiredtiger/WT-2348
WT-2348: xargs -P isn't portable
-rwxr-xr-x | dist/s_all | 8 | ||||
-rwxr-xr-x | dist/s_copyright | 9 | ||||
-rwxr-xr-x | dist/s_style | 9 |
3 files changed, 23 insertions, 3 deletions
diff --git a/dist/s_all b/dist/s_all index 8e3f265e79b..46a68864906 100755 --- a/dist/s_all +++ b/dist/s_all @@ -88,7 +88,13 @@ COMMANDS=" 2>&1 ./s_win > ${t_pfx}s_win 2>&1 ./s_docs > ${t_pfx}s_docs" -echo "$COMMANDS" | xargs -P 20 -I{} /bin/sh -c {} +# Parallelize if possible. +xp="" +echo date | xargs -P 20 >/dev/null 2>&1 +if test $? -eq 0; then + xp="-P 20" +fi +echo "$COMMANDS" | xargs $xp -I{} /bin/sh -c {} for f in `find . -name ${t_pfx}\*`; do if ! `test -s $f`; then diff --git a/dist/s_copyright b/dist/s_copyright index 915b0f8855a..cfada71a839 100755 --- a/dist/s_copyright +++ b/dist/s_copyright @@ -98,6 +98,13 @@ cat > $c5 <<ENDOFTEXT * are met: ENDOFTEXT +# Parallelize if possible. +xp="" +echo date | xargs -P 20 >/dev/null 2>&1 +if test $? -eq 0; then + xp="-P 20" +fi + # Search for files, skipping some well-known 3rd party directories. (cd .. && find [a-z]* -name '*.[chi]' \ -o -name '*.cxx' \ @@ -114,7 +121,7 @@ ENDOFTEXT -e '/\/node_modules\//d' \ -e '/dist\/__/d' \ -e 's/^\.\///' | - xargs -P 20 -n 1 -I{} sh dist/s_copyright {}) + xargs $xp -n 1 -I{} sh dist/s_copyright {}) # A few special cases: LICENSE, documentation, wt utility, some of which have # more than one copyright notice in the file. For files that have only a single diff --git a/dist/s_style b/dist/s_style index 0e013852914..44a5bdda741 100755 --- a/dist/s_style +++ b/dist/s_style @@ -4,6 +4,13 @@ t=__wt.$$ trap 'rm -f $t; exit 0' 0 1 2 3 13 15 +# Parallelize if possible. +xp="" +echo date | xargs -P 20 >/dev/null 2>&1 +if test $? -eq 0; then + xp="-P 20" +fi + # s_style is re-entrant, when run with no parameters it calls itself # again for each file that needs checking. if [ $# -ne 1 ]; then @@ -12,7 +19,7 @@ if [ $# -ne 1 ]; then find bench examples ext src test \ -name '*.[chisy]' -o -name '*.in' -o -name '*.dox' | sed -e '/Makefile.in/d' -e '/build_win\/wiredtiger_config.h/d' | - xargs -P 20 -n 1 -I{} sh ./dist/s_style {} + xargs $xp -n 1 -I{} sh ./dist/s_style {} else # General style correction and cleanup for a single file f=$1 |