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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
#!/bin/sh
. `dirname $0`/common
if [ -z "$1" ]; then
echo "Usage: $0 newversion [newrevision] [manifest]"
exit 1
fi
lco platform/manifest
NEWVER="$1"
if [ -n "$2" ]; then
NEWREV="$2"
else
NEWREV=1
fi
if [ -n "$3" ]; then
MANIFEST=platform/manifest/$3.xml
else
MANIFEST=platform/manifest/default.xml
fi
defaultrev="`xmllint --format $MANIFEST |grep '<default' |sed -e 's,.* revision=\",,;s,\".*,,'`"
echo $defaultrev
rm -f /tmp/newbranch.list /tmp/merge.list /tmp/trouble.list /tmp/commit-id.list
xmllint --format $MANIFEST |grep '<project' | while read r; do
name="`echo $r |sed -e 's,.* name=\",,;s,\".*,,'`"
echo "========================================"
echo $name
echo "========================================"
rev=""
if echo $r |grep -q " revision=\""; then
rev="`echo $r |sed -e 's,.* revision=\",,;s,\".*,,'`"
else
rev="$defaultrev"
fi
if [ "$rev" = "linaro_mmwg" ]; then
echo "Nothing to do, the MMWG branch is completely independent of AOSP"
elif echo $rev |grep -qE "^[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$"; then
echo "Nothing to do for $name, checked out by commit ID"
echo $name >>/tmp/commit-id.list
elif echo $rev |grep -qE "^(refs/tags/|)android-"; then
echo "Nothing to do for $name, we don't touch it"
else
lco $name $rev
if ! cd $SRC/$name; then
echo "Nothing to do for $name, not on android.git.linaro.org"
continue
fi
if ! git remote |grep -qE '^aosp$'; then
echo "Nothing to do for $name, not part of AOSP"
continue
fi
if echo $rev |grep -qE "^linaro_android_$ANDROIDVERSION$"; then
if [ "$ANDROIDVERSION" != "$NEWVER" ]; then
echo "$name: Creating linaro_android_$NEWVER based on linaro_android_$ANDROIDVERSION and android-${NEWVER}_r$NEWREV"
echo "$name" >>/tmp/newbranch.list
git checkout -b linaro_android_$NEWVER origin/linaro_android_$ANDROIDVERSION
if git rebase android-${NEWVER}_r$NEWREV; then
git push gerrit linaro_android_$NEWVER
git fetch --all
git branch --set-upstream --track linaro_android_$NEWVER origin/linaro_android_$NEWVER
git pull
else
echo "$name" >>/tmp/trouble.list
fi
else
echo "$name: Merging changes from android-${NEWVER}_r$NEWREV into linaro_android_$ANDROIDVERSION"
echo "$name" >>/tmp/merge.list
if git merge --log -m "Merge android-${NEWVER}_r$NEWREV:" android-${NEWVER}_r$NEWREV; then
git push gerrit linaro_android_$NEWVER
git fetch --all
git pull
else
echo "$name" >>/tmp/trouble.list
fi
fi
else
if [ "$ANDROIDVERSION" != "$NEWVER" ]; then
echo "$name: Rebasing $rev to android-${NEWVER}_r$NEWREV"
echo "$name: $rev" >>/tmp/merge.list
if git rebase android-${NEWVER}_r$NEWREV; then
git push gerrit $rev
else
echo "$name" >>/tmp/trouble.list
fi
else
echo "$name: Merging changes from android-${NEWVER}_r$NEWREV into $rev"
echo "$name: $rev" >>/tmp/merge.list
if git merge --log -m "Merge android-${NEWVER}_r$NEWREV:" android-${NEWVER}_r$NEWREV; then
git push gerrit $rev
else
echo "$name" >>/tmp/trouble.list
fi
fi
fi
fi
done
# Lastly, let's update the manifest...
cd ${SRC}/platform/manifest
if [ "$ANDROIDVERSION" != "$NEWVER" ]; then
git checkout -b linaro_android_${NEWVER} origin/linaro_android_${ANDROIDVERSION}
sed -i -e "s,android-${ANDROIDVERSION}_r${ANDROIDREVISION},android-${NEWVER}_r${NEWREV},g;s,linaro_android_${ANDROIDVERSION},linaro_android_${NEWVER},g" *.xml
git commit -as -m "manifest: Update to Android ${NEWVER}_r${NEWREV}"
git push gerrit linaro_android_${NEWVER}
git fetch --all
git branch --set-upstream --track linaro_android_$NEWVER origin/linaro_android_$NEWVER
git pull
else
sed -i -e "s,android-${ANDROIDVERSION}_r${ANDROIDREVISION},android-${NEWVER}_r${NEWREV},g" *.xml
git commit -as -m "manifest: Pull from android-${NEWVER}_r${NEWREV}"
git push gerrit linaro_android_${ANDROIDVERSION}
fi
# And the script configs, given we've just moved to a new branch
[ "$ANDROIDVERSION" != "$NEWVER" ] && sed -i -e "s,^ANDROIDVERSION=.*,ANDROIDVERSION=$NEWVER," $SCRIPTS/settings
[ "$ANDROIDREVISION" != "$NEWREV" ] && sed -i -e "s,^ANDROIDVERSION=.*,ANDROIDVERSION=$NEWVER," $SCRIPTS/settings
# Done, now tell the user how it went
if [ -e /tmp/newbranch.list ]; then
echo "New linaro_android_$NEWVER branches created in:"
cat /tmp/newbranch.list
echo
fi
if [ -e /tmp/merge.list ]; then
echo "android-${NEWVER}_r$NEWREV merged into existing branches in:"
cat /tmp/merge.list
echo
fi
if [ -e /tmp/commit-id.list ]; then
echo "The following projects are checked out by commit ID, make sure the manifest"
echo "is updated with the commit IDs for ${NEWVER}_r${NEWREV}:"
cat /tmp/commit-id.list
echo
fi
if [ -e /tmp/trouble.list ]; then
echo "Automatic merges failed in:"
cat /tmp/trouble.list
fi
rm -f /tmp/newbranch.list /tmp/merge.list /tmp/trouble.list /tmp/commit-id.list
echo
echo "Don't forget to update the kernel revision for Nexus devices."
echo
echo "Don't forget to check for additions/removals in the manifest:"
echo "cd $SRC/platform/manifest"
echo "git diff android-${ANDROIDVERSION}_r${ANDROIDREVISION}..android-${NEWVER}_r${NEWREV} default.xml"
echo "(Those changes will typically have to be merged into each manifest file manually)"
|