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

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

Issue 1545043: Retry N-1 times with the --jobs flag, then drop it (Closed)
Patch Set: Created 10 years, 8 months 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 | « no previous file | 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) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 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.
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 function die { 301 function die {
302 error "$1" 302 error "$1"
303 exit 1 303 exit 1
304 } 304 }
305 305
306 # Retry an emerge command according to $FLAGS_retries 306 # Retry an emerge command according to $FLAGS_retries
307 # The $EMERGE_JOBS flags will only be added the first time the command is run 307 # The $EMERGE_JOBS flags will only be added the first time the command is run
308 function eretry () { 308 function eretry () {
309 $* $EMERGE_JOBS && return 0
310 local i= 309 local i=
311 for i in $(seq $FLAGS_retries); do 310 for i in $(seq $FLAGS_retries); do
312 echo Retrying $* 311 echo Retrying $*
313 $* && return 0 312 $* $EMERGE_JOBS && return 0
314 done 313 done
314 $* && return 0
315 return 1 315 return 1
316 } 316 }
317 317
318 # Removes single quotes around parameter 318 # Removes single quotes around parameter
319 # Arguments: 319 # Arguments:
320 # $1 - string which optionally has surrounding quotes 320 # $1 - string which optionally has surrounding quotes
321 # Returns: 321 # Returns:
322 # None, but prints the string without quotes. 322 # None, but prints the string without quotes.
323 function remove_quotes() { 323 function remove_quotes() {
324 echo "$1" | sed -e "s/^'//; s/'$//" 324 echo "$1" | sed -e "s/^'//; s/'$//"
(...skipping 20 matching lines...) Expand all
345 path=${1:?} 345 path=${1:?}
346 shift 346 shift
347 347
348 if ! sudo umount -d "${path}"; then 348 if ! sudo umount -d "${path}"; then
349 warn "Failed to unmount ${path}" 349 warn "Failed to unmount ${path}"
350 warn "Doing a lazy unmount" 350 warn "Doing a lazy unmount"
351 351
352 sudo umount -d -l "${path}" || die "Failed to lazily unmount ${path}" 352 sudo umount -d -l "${path}" || die "Failed to lazily unmount ${path}"
353 fi 353 fi
354 } 354 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698