3 # Copyright © 2017 Arm Ltd. All rights reserved.
4 # SPDX-License-Identifier: MIT
9 # For pinnning to a ref use this:
10 #DEFAULT_CLFRAMEWORKREVISION="branches/arm_compute_19_05" # Release 19.05
12 # For pinning to a revision use this:
13 DEFAULT_CLFRAMEWORKREVISION="1c29ffc7fe02de68cf2e82709a3bc3e210cb0ba4" #COMPMID-2336: Fix build issues
16 echo "Usage: $CMD (Use the default clframework SHA)"
17 echo "Usage: $CMD -s <CLFRAMEWORK_SHA>"
18 echo "Usage: $CMD -p (Print current default clframework SHA)"
22 PrintDefaultClframeworkSha() {
23 echo $DEFAULT_CLFRAMEWORKREVISION
27 function AssertZeroExitCode {
29 if [ $EXITCODE -ne 0 ]; then
31 echo "+++ Command exited with code $EXITCODE. Please fix the above errors and re-run"
36 # process the options given
37 while getopts "s:phg:" opt; do
39 s) CLFRAMEWORK_SHA="$OPTARG";;
40 p) PrintDefaultClframeworkSha;;
41 g) DUMMY="$OPTARG";; # continue to accept -g for backward compatibility
48 # This script is designed to be called from anywhere
49 # so it will resolve where to checkout out the clframework
50 # relative to its own location in armnn/scripts
52 SRC="${BASH_SOURCE[0]}"
53 # resolve $SRC until it is no longer a symlink
54 while [ -h "$SRC" ]; do
55 DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
56 SRC="$(readlink "$SRC")"
57 # if $SRC was a relative symlink, we need to resolve it
58 # relative to the path where the symlink file originally was
59 [[ $SRC != /* ]] && SRC="$DIR/$SRC"
61 DIR="$( cd -P "$( dirname "$SRC" )" >/dev/null && pwd )"
62 pushd ${DIR} > /dev/null
65 if [ ! -d clframework ]; then
66 git clone https://review.mlplatform.org/ml/ComputeLibrary clframework
67 AssertZeroExitCode "Cloning CL Framework failed"
69 pushd clframework > /dev/null
71 CLFRAMEWORKREVISION=$DEFAULT_CLFRAMEWORKREVISION
72 if [ ! -z "$CLFRAMEWORK_SHA" ]; then
73 CLFRAMEWORKREVISION=$CLFRAMEWORK_SHA
76 git fetch && git fetch https://review.mlplatform.org/ml/ComputeLibrary && git checkout ${CLFRAMEWORKREVISION}
77 AssertZeroExitCode "Fetching and checking out ${CLFRAMEWORKREVISION} failed"
79 # Set commit hook so we can submit reviews to gerrit
80 (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)
81 AssertZeroExitCode "Setting commit hooks failed"
83 popd > /dev/null # out of clframework
84 popd > /dev/null # back to wherever we were when called
85 # Make sure the SHA of the revision that was checked out is the last line
86 # of output from the script... just in case we ever need it.
87 echo $CLFRAMEWORKREVISION