OLD | NEW |
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 return $do_shift | 313 return $do_shift |
314 } | 314 } |
315 | 315 |
316 V_RED="\e[31m" | 316 V_RED="\e[31m" |
317 V_YELLOW="\e[33m" | 317 V_YELLOW="\e[33m" |
318 V_BOLD_GREEN="\e[1;32m" | 318 V_BOLD_GREEN="\e[1;32m" |
319 V_BOLD_RED="\e[1;31m" | 319 V_BOLD_RED="\e[1;31m" |
320 V_BOLD_YELLOW="\e[1;33m" | 320 V_BOLD_YELLOW="\e[1;33m" |
321 | 321 |
322 function info { | 322 function info { |
323 echo -e "${V_BOLD_GREEN}INFO : $1${V_VIDOFF}" | 323 echo -e >&2 "${V_BOLD_GREEN}INFO : $1${V_VIDOFF}" |
324 } | 324 } |
325 | 325 |
326 function warn { | 326 function warn { |
327 echo -e "${V_BOLD_YELLOW}WARNING: $1${V_VIDOFF}" | 327 echo -e >&2 "${V_BOLD_YELLOW}WARNING: $1${V_VIDOFF}" |
328 } | 328 } |
329 | 329 |
330 function error { | 330 function error { |
331 echo -e "${V_BOLD_RED}ERROR : $1${V_VIDOFF}" | 331 echo -e >&2 "${V_BOLD_RED}ERROR : $1${V_VIDOFF}" |
332 } | 332 } |
333 | 333 |
334 function die { | 334 function die { |
335 error "$1" | 335 error "$1" |
336 exit 1 | 336 exit 1 |
337 } | 337 } |
338 | 338 |
339 # Retry an emerge command according to $FLAGS_retries | 339 # Retry an emerge command according to $FLAGS_retries |
340 # The $EMERGE_JOBS flags will only be added the first time the command is run | 340 # The $EMERGE_JOBS flags will only be added the first time the command is run |
341 function eretry () { | 341 function eretry () { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 start_time=$(date +%s) | 451 start_time=$(date +%s) |
452 | 452 |
453 # Print time elsapsed since start_time. | 453 # Print time elsapsed since start_time. |
454 print_time_elapsed() { | 454 print_time_elapsed() { |
455 end_time=$(date +%s) | 455 end_time=$(date +%s) |
456 elapsed_seconds="$(( $end_time - $start_time ))" | 456 elapsed_seconds="$(( $end_time - $start_time ))" |
457 minutes="$(( $elapsed_seconds / 60 ))" | 457 minutes="$(( $elapsed_seconds / 60 ))" |
458 seconds="$(( $elapsed_seconds % 60 ))" | 458 seconds="$(( $elapsed_seconds % 60 ))" |
459 echo "Elapsed time: ${minutes}m${seconds}s" | 459 echo "Elapsed time: ${minutes}m${seconds}s" |
460 } | 460 } |
OLD | NEW |