| OLD | NEW |
| 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. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 is_whitelisted() { | 217 is_whitelisted() { |
| 218 local file=$1 | 218 local file=$1 |
| 219 local whitelist="$FLAGS_whitelist" | 219 local whitelist="$FLAGS_whitelist" |
| 220 test -f "$whitelist" || (echo "Whitelist file missing ($whitelist)" && exit 1) | 220 test -f "$whitelist" || (echo "Whitelist file missing ($whitelist)" && exit 1) |
| 221 | 221 |
| 222 local checksum=$(md5sum "$file" | awk '{ print $1 }') | 222 local checksum=$(md5sum "$file" | awk '{ print $1 }') |
| 223 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \ | 223 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \ |
| 224 || /bin/true) | 224 || /bin/true) |
| 225 test $count -ne 0 | 225 test $count -ne 0 |
| 226 } | 226 } |
| 227 |
| 228 V_RED="\e[31m" |
| 229 V_YELLOW="\e[33m" |
| 230 |
| 231 function warn { |
| 232 echo -e "${V_YELLOW}Warning..: $1${V_VIDOFF}" |
| 233 } |
| 234 |
| 235 function error { |
| 236 echo -e "${V_RED}Error....: $1${V_VIDOFF}" |
| 237 } |
| OLD | NEW |