OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 # This script will try to sync the bootstrap directories and then defer control. |
| 7 |
| 8 base_dir=$(dirname "$0") |
| 9 |
| 10 # Test git and git --version. |
| 11 function test_git { |
| 12 local GITV="$(git --version)" || { |
| 13 echo "git isn't installed, please install it" |
| 14 exit 1 |
| 15 } |
| 16 |
| 17 GITV="${GITV##* }" # Only examine last word (i.e. version number) |
| 18 local GITD=( ${GITV//./ } ) # Split version number into decimals |
| 19 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then |
| 20 echo "git version is ${GITV}, please update to a version later than 1.6" |
| 21 exit 1 |
| 22 fi |
| 23 } |
| 24 |
| 25 # Test git svn and git svn --version. |
| 26 function test_git_svn { |
| 27 local GITV="$(git svn --version)" || { |
| 28 echo "git-svn isn't installed, please install it" |
| 29 exit 1 |
| 30 } |
| 31 |
| 32 GITV="${GITV#* version }" # git svn --version has extra output to remove. |
| 33 GITV="${GITV% (svn*}" |
| 34 local GITD=( ${GITV//./ } ) # Split version number into decimals |
| 35 if ((GITD[0] < 1 || (GITD[0] == 1 && GITD[1] < 6) )); then |
| 36 echo "git version is ${GITV}, please update to a version later than 1.6" |
| 37 exit 1 |
| 38 fi |
| 39 } |
| 40 |
| 41 |
| 42 # Update git checkouts prior the cygwin check, we don't want to use msysgit. |
| 43 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.git" ] |
| 44 then |
| 45 cd $base_dir |
| 46 test_git_svn |
| 47 # work around a git-svn --quiet bug |
| 48 OUTPUT=`git svn rebase -q -q` |
| 49 if [[ ! "$OUTPUT" =~ Current.branch ]]; then |
| 50 echo $OUTPUT |
| 51 fi |
| 52 cd - > /dev/null |
| 53 fi |
| 54 |
| 55 # Use the batch file as an entry point if on cygwin. |
| 56 if [ "${OSTYPE}" = "cygwin" -a "${TERM}" != "xterm" ]; then |
| 57 ${base_dir}/gclient.bat "$@" |
| 58 exit |
| 59 fi |
| 60 |
| 61 |
| 62 # We're on POSIX (not cygwin). We can now safely look for svn checkout. |
| 63 if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/.svn" ] |
| 64 then |
| 65 # Update the bootstrap directory to stay up-to-date with the latest |
| 66 # depot_tools. |
| 67 svn -q up "$base_dir" |
| 68 fi |
OLD | NEW |