Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash -p | 1 #!/bin/bash -p |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # usage: dirdiffer.sh old_dir new_dir patch_dir | 7 # usage: dirdiffer.sh old_dir new_dir patch_dir |
| 8 # | 8 # |
| 9 # dirdiffer creates a patch directory patch_dir that represents the difference | 9 # dirdiffer creates a patch directory patch_dir that represents the difference |
| 10 # between old_dir and new_dir. patch_dir can be used with dirpatcher to | 10 # between old_dir and new_dir. patch_dir can be used with dirpatcher to |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 # unset, only unexported. | 99 # unset, only unexported. |
| 100 export PATH="/usr/bin:/bin:/usr/sbin:/sbin" | 100 export PATH="/usr/bin:/bin:/usr/sbin:/sbin" |
| 101 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT | 101 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT |
| 102 export -n SHELLOPTS | 102 export -n SHELLOPTS |
| 103 | 103 |
| 104 shopt -s dotglob nullglob | 104 shopt -s dotglob nullglob |
| 105 | 105 |
| 106 # find_tool looks for an executable file named |tool_name|: | 106 # find_tool looks for an executable file named |tool_name|: |
| 107 # - in the same directory as this script, | 107 # - in the same directory as this script, |
| 108 # - if this script is located in a Chromium source tree, at the expected | 108 # - if this script is located in a Chromium source tree, at the expected |
| 109 # Release output location in the Mac xcodebuild directory, | 109 # Release output location in the Mac out directory, |
| 110 # - as above, but in the Debug output location | 110 # - as above, but in the Debug output location |
| 111 # If found in any of the above locations, the script's path is output. | 111 # If found in any of the above locations, the script's path is output. |
| 112 # Otherwise, this function outputs |tool_name| as a fallback, allowing it to | 112 # Otherwise, this function outputs |tool_name| as a fallback, allowing it to |
| 113 # be found (or not) by an ordinary ${PATH} search. | 113 # be found (or not) by an ordinary ${PATH} search. |
| 114 find_tool() { | 114 find_tool() { |
| 115 local tool_name="${1}" | 115 local tool_name="${1}" |
| 116 | 116 |
| 117 local script_dir | 117 local script_dir |
| 118 script_dir="$(dirname "${0}")" | 118 script_dir="$(dirname "${0}")" |
| 119 | 119 |
| 120 local tool="${script_dir}/${tool_name}" | 120 local tool="${script_dir}/${tool_name}" |
| 121 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then | 121 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then |
| 122 echo "${tool}" | 122 echo "${tool}" |
| 123 return | 123 return |
| 124 fi | 124 fi |
| 125 | 125 |
| 126 local script_dir_phys | 126 local script_dir_phys |
| 127 script_dir_phys="$(cd "${script_dir}" && pwd -P)" | 127 script_dir_phys="$(cd "${script_dir}" && pwd -P)" |
| 128 if [[ "${script_dir_phys}" =~ ^(.*)/src/chrome/installer/mac$ ]]; then | 128 if [[ "${script_dir_phys}" =~ ^(.*)/src/chrome/installer/mac$ ]]; then |
| 129 tool="${BASH_REMATCH[1]}/src/xcodebuild/Release/${tool_name}" | 129 tool="${BASH_REMATCH[1]}/src/out/Release/${tool_name}" |
|
Mark Mentovai
2013/10/25 12:58:19
You can make this check the ninja locations, and i
Nico
2013/10/25 14:14:45
I had this at first (see diff from patch set 1 to
| |
| 130 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then | 130 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then |
| 131 echo "${tool}" | 131 echo "${tool}" |
| 132 return | 132 return |
| 133 fi | 133 fi |
| 134 | 134 |
| 135 tool="${BASH_REMATCH[1]}/src/xcodebuild/Debug/${tool_name}" | 135 tool="${BASH_REMATCH[1]}/src/out/Debug/${tool_name}" |
| 136 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then | 136 if [[ -f "${tool}" ]] && [[ -x "${tool}" ]]; then |
| 137 echo "${tool}" | 137 echo "${tool}" |
| 138 return | 138 return |
| 139 fi | 139 fi |
| 140 fi | 140 fi |
| 141 | 141 |
| 142 echo "${tool_name}" | 142 echo "${tool_name}" |
| 143 } | 143 } |
| 144 | 144 |
| 145 ME="$(basename "${0}")" | 145 ME="$(basename "${0}")" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 trap - EXIT | 536 trap - EXIT |
| 537 } | 537 } |
| 538 | 538 |
| 539 if [[ ${#} -ne 3 ]]; then | 539 if [[ ${#} -ne 3 ]]; then |
| 540 usage | 540 usage |
| 541 exit 2 | 541 exit 2 |
| 542 fi | 542 fi |
| 543 | 543 |
| 544 main "${@}" | 544 main "${@}" |
| 545 exit ${?} | 545 exit ${?} |
| OLD | NEW |