jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright © 2017 Arm Ltd. All rights reserved. |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | CMD=$( basename $0 ) |
| 8 | |
| 9 | usage() { |
| 10 | echo "Usage: $CMD -g <GITHUB_USERNAME>" |
| 11 | exit 1 |
| 12 | } |
| 13 | |
| 14 | function AssertZeroExitCode { |
| 15 | EXITCODE=$? |
| 16 | if [ $EXITCODE -ne 0 ]; then |
| 17 | echo "$1" |
| 18 | echo "+++ Command exited with code $EXITCODE. Please fix the above errors and re-run" |
| 19 | exit 1 |
| 20 | fi |
| 21 | } |
| 22 | |
| 23 | # process the options given |
| 24 | while getopts "g:h" opt; do |
| 25 | case "$opt" in |
| 26 | g) GITHUB_USERNAME="$OPTARG";; |
| 27 | h|\?) usage;; |
| 28 | esac |
| 29 | done |
| 30 | shift $((OPTIND - 1)) |
| 31 | |
| 32 | # |
| 33 | # This script is designed to be called from anywhere |
| 34 | # so it will resolve where to checkout out the clframework |
| 35 | # relative to its own location in armnn/scripts |
| 36 | # |
| 37 | SRC="${BASH_SOURCE[0]}" |
| 38 | # resolve $SRC until it is no longer a symlink |
| 39 | while [ -h "$SRC" ]; do |
| 40 | DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )" |
| 41 | SRC="$(readlink "$SRC")" |
| 42 | # if $SRC was a relative symlink, we need to resolve it |
| 43 | # relative to the path where the symlink file originally was |
| 44 | [[ $SRC != /* ]] && SRC="$DIR/$SRC" |
| 45 | done |
| 46 | DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )" |
| 47 | pushd ${DIR} > /dev/null |
| 48 | cd ../.. |
jimfly01 | dea7286 | 2018-11-19 13:42:45 +0000 | [diff] [blame] | 49 | if [ -z "$USERNAME" ]; then |
| 50 | USERNAME=$USER |
| 51 | fi |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 52 | if [ -z "$GITHUB_USERNAME" ]; then |
| 53 | GITHUB_USERNAME=$USERNAME |
| 54 | echo "setting GITHUB_USERNAME: ${GITHUB_USERNAME} use -g command line option to change" |
| 55 | fi |
| 56 | |
| 57 | if [ ! -d clframework ]; then |
| 58 | echo "+++ Cloning clframework" |
Matthew Bentham | 6e2f606 | 2019-01-23 15:23:13 +0000 | [diff] [blame] | 59 | git clone https://review.mlplatform.org/ml/ComputeLibrary clframework |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 60 | AssertZeroExitCode "Cloning CL Framework failed" |
| 61 | fi |
| 62 | pushd clframework > /dev/null |
| 63 | |
| 64 | # Use the latest pinned version of the CL framework |
| 65 | |
| 66 | # For pinnning to a ref use this: |
Conor Kennedy | 1b4d7b1 | 2019-03-08 10:55:32 +0000 | [diff] [blame] | 67 | # CLFRAMEWORKREVISION="branches/arm_compute_19_02" # Release 19.02 |
| 68 | # git fetch https://review.mlplatform.org/ml/ComputeLibrary $CLFRAMEWORKREVISION && git checkout FETCH_HEAD |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 69 | |
| 70 | # For pinning to a revision use this: |
Jim Flynn | 2ab0bfa | 2019-04-01 13:22:21 +0100 | [diff] [blame^] | 71 | CLFRAMEWORKREVISION="b4a44ff3aa98d2b51f1621a7525db3f81108a1bd" # COMPMID-1995: Removed layout checks from Reduction ops |
Conor Kennedy | 1b4d7b1 | 2019-03-08 10:55:32 +0000 | [diff] [blame] | 72 | git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION} |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 73 | AssertZeroExitCode |
| 74 | |
| 75 | # Set commit hook so we can submit reviews to gerrit |
Matthew Bentham | 6e2f606 | 2019-01-23 15:23:13 +0000 | [diff] [blame] | 76 | (curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://review.mlplatform.org/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg) |
jimfly01 | 34d6dd7 | 2018-11-15 15:46:11 +0000 | [diff] [blame] | 77 | AssertZeroExitCode |
| 78 | |
| 79 | popd > /dev/null # out of clframework |
| 80 | popd > /dev/null # back to wherever we were when called |
| 81 | exit 0 |