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