add --tag option that causes to build from the tagged tree. Will

currently use tagname in about box only if there are no uncommitted
local revisions.  git stash might fix this.  Also need either to use
user-friendly tag names or provide them as alternatives here.
This commit is contained in:
Eric House 2010-06-05 10:17:53 -07:00
parent d3eb3233a3
commit e015bf81d1

View file

@ -1,7 +1,8 @@
#!/bin/bash
usage() {
echo "usage: $0 [<package-unsigned.apk>]" >&2
echo "Error: $*"
echo "usage: $0 [--tag <name>] [<package-unsigned.apk>]" >&2
exit 1
}
@ -16,7 +17,29 @@ do_build() {
cd $WD
}
FILES="$1"
while [ -n "$1" ]; do
case $1 in
--tag) TAGNAME=$2
git describe $TAGNAME || usage "$TAGNAME not a valid git tag"
shift
;;
*)
FILES="$1"
;;
esac
shift
done
if [ -n "$TAGNAME" ]; then
git branch 2>/dev/null | grep '\* android_branch' \
|| usage "not currently at android_branch"
git checkout $TAGNAME 2>/dev/null || usage "unable to checkout $TAGNAME"
HASH=$(git log -1 --pretty=format:%H)
CHECK_BRANCH=$(git describe $HASH 2>/dev/null)
if [ "$CHECK_BRANCH" != $TAGNAME ]; then
usage "tagname not found in repo or not as expected"
fi
fi
if [ -z "$FILES" ]; then
do_build
@ -39,3 +62,7 @@ for PACK_UNSIGNED in $FILES; do
zipalign -v 4 $PACK_UNSIGNED $PACK_SIGNED
[ -n "$XW_WWW_PATH" ] && cp $PACK_SIGNED $XW_WWW_PATH
done
if [ -n "$TAGNAME" ]; then
git checkout android_branch 2>/dev/null
fi