| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client 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 ###################################################################### | 6 ###################################################################### |
| 7 # | 7 # |
| 8 # This script facilitates merging changes from the LLVM subversion | 8 # This script facilitates merging changes from the LLVM subversion |
| 9 # repository into the PNaCl Mercurial repository. | 9 # repository into the PNaCl Mercurial repository. |
| 10 # | 10 # |
| 11 ###################################################################### | 11 ###################################################################### |
| 12 set -o nounset | 12 set -o nounset |
| 13 set -o errexit | 13 set -o errexit |
| 14 | 14 |
| 15 # Make sure this script is run from the right place | 15 # The script is located in "native_client/pnacl/scripts". |
| 16 if [[ $(basename $(pwd)) != "native_client" ]] ; then | 16 # Set pwd to native_client/ |
| 17 echo "ERROR: run this script from the native_client/ dir" | 17 cd "$(dirname "$0")"/../.. |
| 18 if [[ $(basename "$(pwd)") != "native_client" ]] ; then |
| 19 echo "ERROR: cannot find native_client/ directory" |
| 18 exit -1 | 20 exit -1 |
| 19 fi | 21 fi |
| 20 | 22 |
| 21 source tools/llvm/common-tools.sh | 23 source pnacl/scripts/common-tools.sh |
| 22 readonly NACL_ROOT="$(pwd)" | 24 readonly NACL_ROOT="$(pwd)" |
| 23 SetScriptPath "${NACL_ROOT}/tools/llvm/merge-tool.sh" | 25 SetScriptPath "${NACL_ROOT}/pnacl/scripts/merge-tool.sh" |
| 24 SetLogDirectory "${NACL_ROOT}/toolchain/hg-log" | 26 SetLogDirectory "${NACL_ROOT}/toolchain/hg-log" |
| 25 readonly SCRIPT_PATH="$0" | 27 readonly SCRIPT_PATH="$0" |
| 26 readonly MERGE_LOG_FILE="${NACL_ROOT}/merge.log" | 28 readonly MERGE_LOG_FILE="${NACL_ROOT}/merge.log" |
| 27 ###################################################################### | 29 ###################################################################### |
| 28 | 30 |
| 29 # Location of the sources | 31 # Location of the sources |
| 30 # These should match the values in utman.sh | 32 # These should match the values in build.sh |
| 31 readonly TC_SRC="$(pwd)/hg" | 33 readonly TC_SRC="$(pwd)/hg" |
| 32 readonly TC_SRC_UPSTREAM="${TC_SRC}/upstream" | 34 readonly TC_SRC_UPSTREAM="${TC_SRC}/upstream" |
| 33 readonly TC_SRC_LLVM_MASTER="${TC_SRC}/llvm-master" | 35 readonly TC_SRC_LLVM_MASTER="${TC_SRC}/llvm-master" |
| 34 readonly TC_SRC_LLVM_GCC_MASTER="${TC_SRC}/llvm-gcc-master" | 36 readonly TC_SRC_LLVM_GCC_MASTER="${TC_SRC}/llvm-gcc-master" |
| 35 | 37 |
| 36 readonly PREDIFF="${TC_SRC}/prediff" | 38 readonly PREDIFF="${TC_SRC}/prediff" |
| 37 readonly POSTDIFF="${TC_SRC}/postdiff" | 39 readonly POSTDIFF="${TC_SRC}/postdiff" |
| 38 | 40 |
| 39 readonly UPSTREAM_BRANCH=pnacl-sfi | 41 readonly UPSTREAM_BRANCH=pnacl-sfi |
| 40 | 42 |
| 41 readonly HG_CONFIG_AUTO=(--config ui.merge=internal:merge | 43 readonly HG_CONFIG_AUTO=(--config ui.merge=internal:merge |
| 42 --config ui.username=chromebot1@gmail.com) | 44 --config ui.username=chromebot1@gmail.com) |
| 43 | 45 |
| 44 readonly HG_CONFIG_MANUAL=( | 46 readonly HG_CONFIG_MANUAL=( |
| 45 --config kdiff3.executable=/usr/bin/diff3 | 47 --config kdiff3.executable=/usr/bin/diff3 |
| 46 --config kdiff3.args="--auto --base \$base \$local \$other -o \$output") | 48 --config kdiff3.args="--auto --base \$base \$local \$other -o \$output") |
| 47 | 49 |
| 48 # TODO(pdox): Refactor repository checkout into a separate script | 50 # TODO(pdox): Refactor repository checkout into a separate script |
| 49 # so that we don't need to invoke utman. | 51 # so that we don't need to invoke build.sh. |
| 50 utman() { | 52 pnacl-build() { |
| 51 "${NACL_ROOT}"/tools/llvm/utman.sh "$@" | 53 "${NACL_ROOT}"/pnacl/build.sh "$@" |
| 52 } | 54 } |
| 53 | 55 |
| 54 #@ auto [rev] - Non-interactive merge | 56 #@ auto [rev] - Non-interactive merge |
| 55 auto() { | 57 auto() { |
| 56 INTERACTIVE_MERGE=false | 58 INTERACTIVE_MERGE=false |
| 57 export DISPLAY="" | 59 export DISPLAY="" |
| 58 HG_CONFIG=("${HG_CONFIG_AUTO[@]}") | 60 HG_CONFIG=("${HG_CONFIG_AUTO[@]}") |
| 59 merge-all "$@" | 61 merge-all "$@" |
| 60 } | 62 } |
| 61 | 63 |
| 62 #@ manual [rev] - Interactive merge | 64 #@ manual [rev] - Interactive merge |
| 63 manual() { | 65 manual() { |
| 64 INTERACTIVE_MERGE=true | 66 INTERACTIVE_MERGE=true |
| 65 HG_CONFIG=("${HG_CONFIG_MANUAL[@]}") | 67 HG_CONFIG=("${HG_CONFIG_MANUAL[@]}") |
| 66 merge-all "$@" | 68 merge-all "$@" |
| 67 } | 69 } |
| 68 | 70 |
| 69 get-tip-revision() { | 71 get-tip-revision() { |
| 70 svn info "http://llvm.org/svn/llvm-project/" \ | 72 svn info "http://llvm.org/svn/llvm-project/" \ |
| 71 | grep Revision \ | 73 | grep Revision \ |
| 72 | awk '{print $2}' | 74 | awk '{print $2}' |
| 73 } | 75 } |
| 74 | 76 |
| 75 set-master-revision() { | 77 set-master-revision() { |
| 76 echo "@@@BUILD_STEP Set LLVM revision: ${MERGE_REVISION}@@@" | 78 echo "@@@BUILD_STEP Set LLVM revision: ${MERGE_REVISION}@@@" |
| 77 echo "MERGE REVISION: ${MERGE_REVISION}" | 79 echo "MERGE REVISION: ${MERGE_REVISION}" |
| 78 | 80 |
| 79 # Set environmental variable for utman | 81 # Set environmental variable for build.sh |
| 80 export LLVM_PROJECT_REV=${MERGE_REVISION} | 82 export LLVM_PROJECT_REV=${MERGE_REVISION} |
| 81 utman svn-checkout-llvm-master | 83 pnacl-build svn-checkout-llvm-master |
| 82 utman svn-update-llvm-master | 84 pnacl-build svn-update-llvm-master |
| 83 utman svn-checkout-llvm-gcc-master | 85 pnacl-build svn-checkout-llvm-gcc-master |
| 84 utman svn-update-llvm-gcc-master | 86 pnacl-build svn-update-llvm-gcc-master |
| 85 } | 87 } |
| 86 | 88 |
| 87 get-upstream() { | 89 get-upstream() { |
| 88 echo "@@@BUILD_STEP Get mercurial source@@@" | 90 echo "@@@BUILD_STEP Get mercurial source@@@" |
| 89 export UPSTREAM_REV=${UPSTREAM_BRANCH} | 91 export UPSTREAM_REV=${UPSTREAM_BRANCH} |
| 90 utman hg-checkout-upstream | 92 pnacl-build hg-checkout-upstream |
| 91 utman hg-pull-upstream | 93 pnacl-build hg-pull-upstream |
| 92 utman hg-update-upstream | 94 pnacl-build hg-update-upstream |
| 93 } | 95 } |
| 94 | 96 |
| 95 #+ merge-all - Merge everything | 97 #+ merge-all - Merge everything |
| 96 merge-all() { | 98 merge-all() { |
| 97 if [ $# -ne 1 ]; then | 99 if [ $# -ne 1 ]; then |
| 98 Fatal "Please specify revision or 'tip'" | 100 Fatal "Please specify revision or 'tip'" |
| 99 fi | 101 fi |
| 100 if [ "$1" == "tip" ]; then | 102 if [ "$1" == "tip" ]; then |
| 101 MERGE_REVISION=$(get-tip-revision) | 103 MERGE_REVISION=$(get-tip-revision) |
| 102 else | 104 else |
| (...skipping 22 matching lines...) Expand all Loading... |
| 125 fi | 127 fi |
| 126 | 128 |
| 127 final-banner | 129 final-banner |
| 128 } | 130 } |
| 129 | 131 |
| 130 final-banner() { | 132 final-banner() { |
| 131 echo "********************************************************************" | 133 echo "********************************************************************" |
| 132 echo "The hg/upstream working directory is now in a merged state." | 134 echo "The hg/upstream working directory is now in a merged state." |
| 133 echo "Before you commit and push, you should build PNaCl and run all tests." | 135 echo "Before you commit and push, you should build PNaCl and run all tests." |
| 134 echo "" | 136 echo "" |
| 135 echo "1) Set the default LLVM_PROJECT_REV to ${MERGE_REVISION} (in utman.sh)" | 137 echo "1) Set the default LLVM_PROJECT_REV to ${MERGE_REVISION} (in build.sh)" |
| 136 echo "" | 138 echo "" |
| 137 echo "2) Build PNaCl:" | 139 echo "2) Build PNaCl:" |
| 138 echo " UTMAN_MERGE_TESTING=true tools/llvm/utman.sh everything-translator" | 140 echo " PNACL_MERGE_TESTING=true pnacl/build.sh everything-translator" |
| 139 echo "" | 141 echo "" |
| 140 echo "3) Run all tests:" | 142 echo "3) Run all tests:" |
| 141 echo " tools/llvm/utman-test.sh test-all" | 143 echo " pnacl/test.sh test-all" |
| 142 echo "" | 144 echo "" |
| 143 echo "Depending on the size of the merge, there may be lots of bugs. You may" | 145 echo "Depending on the size of the merge, there may be lots of bugs. You may" |
| 144 echo "need to fix and rebuild several times. When you are confident all tests" | 146 echo "need to fix and rebuild several times. When you are confident all tests" |
| 145 echo "are passing, you can commit and push." | 147 echo "are passing, you can commit and push." |
| 146 echo "********************************************************************" | 148 echo "********************************************************************" |
| 147 } | 149 } |
| 148 | 150 |
| 149 assert-clean() { | 151 assert-clean() { |
| 150 svn-assert-no-changes "${TC_SRC_LLVM_MASTER}" | 152 svn-assert-no-changes "${TC_SRC_LLVM_MASTER}" |
| 151 svn-assert-no-changes "${TC_SRC_LLVM_GCC_MASTER}" | 153 svn-assert-no-changes "${TC_SRC_LLVM_GCC_MASTER}" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 301 |
| 300 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. | 302 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. |
| 301 if [ "$(type -t $1)" != "function" ]; then | 303 if [ "$(type -t $1)" != "function" ]; then |
| 302 echo "ERROR: unknown function '$1'." >&2 | 304 echo "ERROR: unknown function '$1'." >&2 |
| 303 echo "For help, try:" | 305 echo "For help, try:" |
| 304 echo " $0 help" | 306 echo " $0 help" |
| 305 exit 1 | 307 exit 1 |
| 306 fi | 308 fi |
| 307 | 309 |
| 308 "$@" | 310 "$@" |
| OLD | NEW |