[Bf-blender-cvs] [554eca1] master: Avoid UUOC in install_deps.sh
Lawrence D'Oliveiro
noreply at git.blender.org
Sat Feb 22 14:33:01 CET 2014
Commit: 554eca1c288ea5b6c02b7fb174bf20238918b809
Author: Lawrence D'Oliveiro
Date: Sat Feb 22 14:31:43 2014 +0100
https://developer.blender.org/rB554eca1c288ea5b6c02b7fb174bf20238918b809
Avoid UUOC in install_deps.sh
The file ##build_files/build_environment/install_deps.sh## contains the following line:
THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
The command within the backticks is a [[ http://catb.org/jargon/html/U/UUOC.html | Useless Use Of Cat ]].
A more compact way of writing the same thing (saving two subprocesses) is
THREADS=`grep -c processor /proc/cpuinfo`
or (using POSIX-preferred command-substitution parentheses instead of backticks)
THREADS=$(grep -c processor /proc/cpuinfo)
But the most compact, and least Linux-specific, way is to use the ##nproc##(1) command from the [[ http://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html | GNU coreutils package ]]:
THREADS=$(nproc)
Reviewers: sergey, mont29
Reviewed by: mont29
Differential Revision: https://developer.blender.org/D255
===================================================================
M build_files/build_environment/prepare_release_env.sh
===================================================================
diff --git a/build_files/build_environment/prepare_release_env.sh b/build_files/build_environment/prepare_release_env.sh
index 9889fea..f003507 100755
--- a/build_files/build_environment/prepare_release_env.sh
+++ b/build_files/build_environment/prepare_release_env.sh
@@ -60,7 +60,7 @@ AMD64_PATH="$ENV_PATH/buildbot_${DEBIAN_BRANCH}_x86_64"
I686_PATH="$ENV_PATH/buildbot_${DEBIAN_BRANCH}_i686"
SOURCES_PATH="$ENV_PATH/sources"
-THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"`
+THREADS=$(nproc)
# Force vpx be installed from the backports
VPX_V="1.0.0-2~bpo60+1"
More information about the Bf-blender-cvs
mailing list