Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1102)

Side by Side Diff: src/scripts/common.sh

Issue 501153: Simplified counting CPUs. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scripts/build_platform_packages.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Common constants for build scripts 5 # Common constants for build scripts
6 # This must evaluate properly for both /bin/bash and /bin/sh 6 # This must evaluate properly for both /bin/bash and /bin/sh
7 7
8 # All scripts should die on error unless commands are specifically excepted 8 # All scripts should die on error unless commands are specifically excepted
9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'.
10 # TODO: Re-enable this once shflags is less prone to dying. 10 # TODO: Re-enable this once shflags is less prone to dying.
11 #set -e 11 #set -e
12 12
13 # The number of jobs to pass to tools that can run in parallel (such as make 13 # The number of jobs to pass to tools that can run in parallel (such as make
14 # and dpkg-buildpackage 14 # and dpkg-buildpackage
15 NUM_JOBS=`cat /proc/cpuinfo | grep processor | awk '{a++} END {print a}'` 15 NUM_JOBS=`grep -c "^processor" /proc/cpuinfo`
16 16
17 # Store location of the calling script. 17 # Store location of the calling script.
18 TOP_SCRIPT_DIR="${TOP_SCRIPT_DIR:-$(dirname $0)}" 18 TOP_SCRIPT_DIR="${TOP_SCRIPT_DIR:-$(dirname $0)}"
19 19
20 # Find root of source tree 20 # Find root of source tree
21 if [ "x$GCLIENT_ROOT" != "x" ] 21 if [ "x$GCLIENT_ROOT" != "x" ]
22 then 22 then
23 # GCLIENT_ROOT already set, so we're done 23 # GCLIENT_ROOT already set, so we're done
24 true 24 true
25 elif [ "x$COMMON_SH" != "x" ] 25 elif [ "x$COMMON_SH" != "x" ]
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 # Positional parameters from calling script. :? means "fail if unset". 183 # Positional parameters from calling script. :? means "fail if unset".
184 PKG_NAME=${1:?} 184 PKG_NAME=${1:?}
185 shift 185 shift
186 186
187 if [ -z `which $PKG_NAME` ] 187 if [ -z `which $PKG_NAME` ]
188 then 188 then
189 echo "Can't find $PKG_NAME; attempting to install it." 189 echo "Can't find $PKG_NAME; attempting to install it."
190 sudo apt-get --yes --force-yes install $PKG_NAME 190 sudo apt-get --yes --force-yes install $PKG_NAME
191 fi 191 fi
192 } 192 }
OLDNEW
« no previous file with comments | « src/scripts/build_platform_packages.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698