OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Script to upload all debug symbols required for crash reporting | 6 # Script to upload all debug symbols required for crash reporting |
7 # purposes. This script need only be used to upload release builds | 7 # purposes. This script need only be used to upload release builds |
8 # symbols or to debug crashes on non-release builds (in which case try | 8 # symbols or to debug crashes on non-release builds (in which case try |
9 # to only upload the symbols for those executables involved). | 9 # to only upload the symbols for those executables involved). |
10 # | |
11 # NOTE: This script must be run from the chromeos build chroot environment. | |
12 # | |
13 | 10 |
14 # Load common constants. This should be the first executable line. | 11 # --- BEGIN COMMON.SH BOILERPLATE --- |
15 # The path to common.sh should be relative to your script's location. | 12 # Load common CrOS utilities. Inside the chroot this file is installed in |
16 . "$(dirname "$0")/common.sh" | 13 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 14 # location. |
| 15 find_common_sh() { |
| 16 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 17 local path |
| 18 |
| 19 SCRIPT_ROOT= |
| 20 for path in "${common_paths[@]}"; do |
| 21 if [ -r "${path}/common.sh" ]; then |
| 22 SCRIPT_ROOT=${path} |
| 23 break |
| 24 fi |
| 25 done |
| 26 } |
| 27 |
| 28 find_common_sh |
| 29 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 30 # --- END COMMON.SH BOILERPLATE --- |
17 | 31 |
18 # Script must be run inside the chroot | 32 # Script must be run inside the chroot |
19 restart_in_chroot_if_needed $* | 33 restart_in_chroot_if_needed "$@" |
20 | 34 |
21 get_default_board | 35 get_default_board |
22 | 36 |
23 # Flags | 37 # Flags |
24 DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for." | 38 DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for." |
25 DEFINE_string breakpad_root "" "Root directory for breakpad symbols." | 39 DEFINE_string breakpad_root "" "Root directory for breakpad symbols." |
26 DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." | 40 DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." |
27 DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." | 41 DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." |
28 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." | 42 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." |
29 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." | 43 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 fi | 125 fi |
112 fi | 126 fi |
113 | 127 |
114 if [ -z "${FLAGS_ARGV}" ]; then | 128 if [ -z "${FLAGS_ARGV}" ]; then |
115 if [ ${FLAGS_regenerate} -eq ${FLAGS_TRUE} ]; then | 129 if [ ${FLAGS_regenerate} -eq ${FLAGS_TRUE} ]; then |
116 really_upload || exit 1 | 130 really_upload || exit 1 |
117 info "Clearing ${DEFAULT_BREAKPAD_ROOT}" | 131 info "Clearing ${DEFAULT_BREAKPAD_ROOT}" |
118 sudo rm -rf "${DEFAULT_BREAKPAD_ROOT}" | 132 sudo rm -rf "${DEFAULT_BREAKPAD_ROOT}" |
119 info "Generating all breakpad symbol files." | 133 info "Generating all breakpad symbol files." |
120 local verbosity="" | 134 local verbosity="" |
121 local generate_script="$(dirname $0)/cros_generate_breakpad_symbols" | 135 local generate_script="${SCRIPTS_DIR}/cros_generate_breakpad_symbols" |
122 [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ] && verbosity="--verbose" | 136 [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ] && verbosity="--verbose" |
123 if ! "${generate_script}" --board=${FLAGS_board} ${verbosity}; then | 137 if ! "${generate_script}" --board=${FLAGS_board} ${verbosity}; then |
124 error "Some errors while generating symbols; uploading anyway" | 138 error "Some errors while generating symbols; uploading anyway" |
125 ANY_ERRORS=1 | 139 ANY_ERRORS=1 |
126 fi | 140 fi |
127 fi | 141 fi |
128 | 142 |
129 info "Uploading all breakpad symbol files." | 143 info "Uploading all breakpad symbol files." |
130 for sym_file in $(find "${FLAGS_breakpad_root}" -name \*.sym); do | 144 for sym_file in $(find "${FLAGS_breakpad_root}" -name \*.sym); do |
131 ! upload_file "${sym_file}" "${upload_url}" | 145 ! upload_file "${sym_file}" "${upload_url}" |
132 done | 146 done |
133 else | 147 else |
134 error "Unexpected args ${FLAGS_ARGV}" | 148 error "Unexpected args ${FLAGS_ARGV}" |
135 fi | 149 fi |
136 | 150 |
137 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" | 151 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" |
138 return 0 | 152 return 0 |
139 } | 153 } |
140 | 154 |
141 main "$@" | 155 main "$@" |
OLD | NEW |