blob: 60e4d7eebe176bcf3de6d036317ef0756e9cdd07 [file] [log] [blame]
jimfly0134d6dd72018-11-15 15:46:11 +00001#!/bin/bash
2#
3# Copyright © 2017 Arm Ltd. All rights reserved.
4# SPDX-License-Identifier: MIT
5#
6
7CMD=$( basename $0 )
8
9usage() {
10 echo "Usage: $CMD -g <GITHUB_USERNAME>"
11 exit 1
12}
13
14function 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
24while getopts "g:h" opt; do
25 case "$opt" in
26 g) GITHUB_USERNAME="$OPTARG";;
27 h|\?) usage;;
28 esac
29done
30shift $((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#
37SRC="${BASH_SOURCE[0]}"
38# resolve $SRC until it is no longer a symlink
39while [ -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"
45done
46DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
47pushd ${DIR} > /dev/null
48cd ../..
jimfly01dea72862018-11-19 13:42:45 +000049if [ -z "$USERNAME" ]; then
50 USERNAME=$USER
51fi
jimfly0134d6dd72018-11-15 15:46:11 +000052if [ -z "$GITHUB_USERNAME" ]; then
53 GITHUB_USERNAME=$USERNAME
54 echo "setting GITHUB_USERNAME: ${GITHUB_USERNAME} use -g command line option to change"
55fi
56
57if [ ! -d clframework ]; then
58echo "+++ Cloning clframework"
Matthew Bentham6e2f6062019-01-23 15:23:13 +000059 git clone https://review.mlplatform.org/ml/ComputeLibrary clframework
jimfly0134d6dd72018-11-15 15:46:11 +000060 AssertZeroExitCode "Cloning CL Framework failed"
61fi
62pushd clframework > /dev/null
63
64# Use the latest pinned version of the CL framework
65
66# For pinnning to a ref use this:
Aron Virginas-Tar17cf71f2019-02-22 10:53:49 +000067CLFRAMEWORKREVISION="branches/arm_compute_19_02" # Release 19.02
68git fetch https://review.mlplatform.org/ml/ComputeLibrary $CLFRAMEWORKREVISION && git checkout FETCH_HEAD
jimfly0134d6dd72018-11-15 15:46:11 +000069
70# For pinning to a revision use this:
Aron Virginas-Tar17cf71f2019-02-22 10:53:49 +000071# CLFRAMEWORKREVISION="6eb90d7d8ef73decf6e3973a89c2b2badd0b9635" # Master towards 19.02
72# git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION}
jimfly0134d6dd72018-11-15 15:46:11 +000073AssertZeroExitCode
74
75# Set commit hook so we can submit reviews to gerrit
Matthew Bentham6e2f6062019-01-23 15:23:13 +000076(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)
jimfly0134d6dd72018-11-15 15:46:11 +000077AssertZeroExitCode
78
79popd > /dev/null # out of clframework
80popd > /dev/null # back to wherever we were when called
81exit 0