blob: e24b7aff07709fb83baf9beee6c9e9b8763ee209 [file] [log] [blame]
Joakim Bech9940fb42018-04-04 14:58:15 +02001#!/usr/bin/env bash
2
3VERSION=
4OVERWRITE=false
5
6function help() {
7 echo " -r <revision> new revision for OP-TEE and linaro-swg gits"
8 echo " -o overwrite existing xml-files"
9 echo " -h help"
10 exit
11}
12
13while getopts "or:h" opt; do
14 case $opt in
15 o)
16 OVERWRITE=true
17 ;;
18 r)
19 VERSION=${OPTARG}
20 ;;
21 h)
22 help
23 ;;
24 \?)
25 echo "Invalid option: -${OPTARG}" >&2
26 exit 1
27 ;;
28 :)
29 echo "Option -${OPTARG} requires an argument." >&2
30 exit 1
31 ;;
32 esac
33done
34
35if [ -z "${VERSION}" ]; then
36 echo "No version provided, not doing any changes!"
37 exit
38fi
39
40for xml in *.xml
41do
42 FILE=$xml.${VERSION}
43 if [ ${OVERWRITE} == true ]; then
44 FILE=$xml
45 fi
46
47 cat $xml |
48 sed "s/\(OP-TEE\/.*\)revision.*/\1\/>/" | # Removes old revision
49 sed "s/\(OP-TEE.*\"\)/\1 revision=\"refs\/tags\/${VERSION}\" clone-depth=\"1\"/" |
50 sed "s/\(OP-TEE\/build.git.*\) \/>/\1>/" | # Strip away a forward slash from build.git only
51
52 sed "s/\(linaro-swg\/optee_examples.git\)revision.*/\1\/>/" | # Removes old revision
53 sed "s/\(linaro-swg\/optee_examples.git\"\)/\1 revision=\"refs\/tags\/${VERSION}\" clone-depth=\"1\"/" |
54 sed "s/\(linaro-swg\/optee_benchmark.git\)revision.*/\1\/>/" | # Removes old revision
55 sed "s/\(linaro-swg\/optee_benchmark.git\"\)/\1 revision=\"refs\/tags\/${VERSION}\" clone-depth=\"1\"/" |
56 tee ${FILE} 2>&1 > /dev/null
57done