#!/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 '>/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)"