diff options
Diffstat (limited to 'libopus.sh')
-rwxr-xr-x | libopus.sh | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/libopus.sh b/libopus.sh new file mode 100755 index 0000000..9ab0170 --- /dev/null +++ b/libopus.sh @@ -0,0 +1,97 @@ +. $(dirname $0)/functions + +vertonumber () { + local VERSIONID=$1 + local V1=$(echo $VERSIONID | cut -d. -f1) + local V2=$(echo $VERSIONID | cut -d. -f2) + local V3=$(echo $VERSIONID | cut -d. -f3) + local V="$V1$V2$V3" + echo -n $V +} + + +cd $SRC/platform/external +if [ -d libopus-upstream ]; then + cd libopus-upstream + git checkout master + git pull +else + git clone git://git.xiph.org/opus.git libopus-upstream + cd libopus-upstream +fi + +NEW_VERSION=$(latest $(git tag |grep -E '^v[0-9]+\.' |sed -e 's,^v,,' |grep -v '[a-z]')) +echo "NEW_VERSION = $NEW_VERSION" + +checkout platform/external/libopus + +cd $SRC/platform/external/libopus +if git branch -a |grep -q linaro-upstream-$NEW_VERSION; then + ok "libopus is up to date." + exit 0 +fi + +git checkout -b linaro-upstream-work-$TIMESTAMP aosp/master + +AOSPVER=$(grep "Version:" README.version | cut -d ' ' -f2) +echo "AOSPVER = $AOSPVER" + +if [ "$NEW_VERSION" = "$AOSPVER" ]; then + notice "libopus is up to date in AOSP master, copying its work" +else + LATEST_LINARO=$(latest $(git branch -a |grep origin/linaro-upstream |sed -e 's,.*-,,')) + if [ -n "$LATEST_LINARO" ]; then + if [ "$(latest $LATEST_LINARO $AOSPVER)" != "$AOSPVER" ]; then + git checkout linaro-upstream-$LATEST_LINARO || git checkout -b linaro-upstream-$LATEST_LINARO origin/linaro-upstream-$LATEST_LINARO + fi + fi + + notice "Updating libopus to $NEW_VERSION" + + rm -f Android.patch + cd ../libopus-upstream + git checkout -b linaro-upstream-work-$TIMESTAMP v$AOSPVER + cd ../libopus + for i in *; do + if [ -e ../libopus-upstream/$i ]; then + diff -ruN ../libopus-upstream/$i $i >>Android.patch + fi + done + cd ../libopus-upstream + git checkout master + git branch -D linaro-upstream-work-$TIMESTAMP + git checkout -b linaro-upstream-work-$TIMESTAMP v$NEW_VERSION + cd ../libopus + for i in *; do + if [ -e ../libopus-upstream/$i ]; then + cp -rf ../libopus-upstream/$i . + fi + done + if patch -p0 <Android.patch; then + rm Android.patch + notice "Auto-updated libopus to $NEW_VERSION." + sed -i -e 's/'$AOSPVER'/'$NEW_VERSION'/g' README.version + git commit -asm "Update to libopus $NEW_VERSION" + git clean -d -f -x + else + error "Couldn't auto-update libopus - patch failed to apply." + error "Please fix manually and commit to a branch called" + error "linaro-upstream-$NEW_VERSION." + exit 1 + fi + cd ../libopus-upstream + git checkout master + git branch -D linaro-upstream-work-$TIMESTAMP + cd ../libopus + + +fi + + + +git push origin linaro-upstream-work-$TIMESTAMP:linaro-upstream-$NEW_VERSION +git pull +git checkout -b linaro-upstream-$NEW_VERSION origin/linaro-upstream-$NEW_VERSION +git branch -D linaro-upstream-work-$TIMESTAMP + +pwd
\ No newline at end of file |