blob: a609cfd663a418651816be57ccd3badb403766ca (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${SCRIPT_DIR}/platforms-common.sh
WORKSPACE=$PWD
YYMM=${1:-`date +%y`.`date +%m`}
REV=${2:-1}
function check_params
{
if [[ $YYMM == [0-9][0-9].[0-9][0-9] ]]; then
if [[ $REV != [0-9] ]]; then
echo "ERROR: you need to specify a number as the second arg, but you did \"$REV\""
exit 1
fi
else
echo "ERROR: you need to specify YY.MM as the first arg, but you did \"$YYMM\""
exit 1
fi
}
function update_tarball
{
pushd recovery
# there should be a marker file named juno-${YY}.${MM}-linaro${REL}
# if not we should create it
local pattern="juno-[0-9][0-9].[0-9][0-9]-linaro[0-9]"
local count=0
local markerfile=juno-${YYMM}-linaro${REV}
if [ -e ${pattern} ]; then
# if a marker file exists, but it has the wrong version, abort
if [ ${pattern} != ${markerfile} ]; then
echo "ERROR: a marker file exists, but has the wrong version"
echo "ERROR: I expected: ${markerfile}"
echo "ERROR: but found: `ls $pattern`"
exit 1
fi
count=`ls ${pattern} | wc -l`
fi
if [[ "$count" == "0" ]]; then
# the marker file doesn't exist, so create it
echo "Creating marker file ${markerfile}"
find . -name "*" -type f | \
grep -v -e .git -e ${markerfile} | \
sort | \
xargs md5sum > ${markerfile}
# check the marker file in
git add ${markerfile}
git commit -s -a -m "${markerfile}"
# tag it
git tag ${markerfile}
git push working ${markerfile}
# update the juno, junor1 and junor2 branches
git branch -f juno
git branch -f junor1
git branch -f junor2
git push working
git push working juno
git push working junor1
git push working junor2
count=1
fi
if [[ "$count" != "1" ]]; then
echo "ERROR: There should only be one marker file, but I see ${count}"
exit 1
fi
local ver=${YYMM}-linaro${REV}
echo "Tarball version: $ver"
# generate the recovery tarball
tar jcvf ${WORKSPACE}/board_recovery_image.tar.bz2 *
# save current branch
local initial_branch=`echo $(git branch | grep "*" | sed "s/* //")`
# swap to recovery branch
git checkout juno-recovery-tarball
# copy in the recovery tarball
cp ${WORKSPACE}/board_recovery_image.tar.bz2 .
git commit -s -a -m "board_recovery_image (version ${ver})"
local tag=tarball-${ver}
git tag $tag
git push working $tag
git push working juno-recovery-tarball
# now we're finished, checkout the branch where we started
git checkout $initial_branch
popd
}
check_params
check_workspace
update_tarball
|