summaryrefslogtreecommitdiff
path: root/libusb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'libusb.sh')
-rwxr-xr-xlibusb.sh31
1 files changed, 24 insertions, 7 deletions
diff --git a/libusb.sh b/libusb.sh
index 98941e6..eb9c9e8 100755
--- a/libusb.sh
+++ b/libusb.sh
@@ -24,12 +24,19 @@ if [ -d libusb-upstream ]; then
git checkout master
git pull
else
- git clone git://git.libusb.org/libusb.git libusb-upstream
+ #git clone git://git.libusb.org/libusb.git libusb-upstream
+ git clone git://github.com/libusb/libusb.git libusb-upstream
cd libusb-upstream
fi
-NEW_VERSION=$(latest $(git tag | grep ^v | cut -c 2-))
+#NEW_VERSION=$(latest $(git tag | grep ^v | cut -c 2-))
+#NEW_VERSION=$(latest $(git tag | grep ^v | cut -d '-' -f1 | cut -c2-))
+NEW_VERSION=$(grep 'define LIBUSB_MAJOR' libusb/version.h |cut -d' ' -f3).$(grep 'define LIBUSB_MINOR' libusb/version.h |cut -d' ' -f3).$(grep 'define LIBUSB_MICRO' libusb/version.h |cut -d' ' -f3)
+NEW_VERSION_LIBUSB_NANO=$(grep 'define LIBUSB_NANO' libusb/version_nano.h |cut -d' ' -f3)
+NEW_VERSION_LIBUSB_RC=$(grep 'define LIBUSB_RC' libusb/version.h |cut -d' ' -f3 | cut -d \" -f2)
echo "NEW_VERSION = $NEW_VERSION"
+echo "NEW_VERSION_LIBUSB_RC = $NEW_VERSION_LIBUSB_RC"
+echo "NEW_VERSION_LIBUSB_NANO = $NEW_VERSION_LIBUSB_NANO"
checkout platform/external/libusb
@@ -41,12 +48,22 @@ fi
git checkout -b linaro-upstream-work-$TIMESTAMP aosp/master
-AOSPVER=$(grep PACKAGE_VERSION config.h | cut -d \" -f2)
+#AOSPVER=$(grep PACKAGE_VERSION config.h | cut -d \" -f2)
+AOSPVER=$(grep 'define LIBUSB_MAJOR' libusb/version.h |cut -d' ' -f3).$(grep 'define LIBUSB_MINOR' libusb/version.h |cut -d' ' -f3).$(grep 'define LIBUSB_MICRO' libusb/version.h |cut -d' ' -f3)
+AOSPVER_LIBUSB_NANO=$(grep 'define LIBUSB_NANO' libusb/version_nano.h |cut -d' ' -f3)
+AOSPVER_LIBUSB_RC=$(grep 'define LIBUSB_RC' libusb/version.h |cut -d' ' -f3 | cut -d \" -f2)
echo "AOSPVER = $AOSPVER"
+echo "AOSPVER_LIBUSB_RC = $AOSPVER_LIBUSB_RC"
+echo "AOSPVER_LIBUSB_NANO = $AOSPVER_LIBUSB_NANO"
-if [ "$(vertonumber $NEW_VERSION)" -le "$(vertonumber $AOSPVER)" ]; then
+if [ "$(vertonumber $NEW_VERSION)" -lt "$(vertonumber $AOSPVER)" ]; then
notice "libusb is up to date in AOSP master, copying its work"
else
+ if [[ "$(vertonumber $NEW_VERSION)" -eq "$(vertonumber $AOSPVER)" ]] && [[ "$NEW_VERSION_LIBUSB_NANO" -le "$AOSPVER_LIBUSB_NANO" ]]; then
+ notice "libusb is up to date in AOSP master, copying its work"
+ exit 0
+ fi
+
LATEST_LINARO=$(latest $(git branch -a |grep origin/linaro-upstream |sed -e 's,.*-,,'))
echo "LATEST_LINARO = $LATEST_LINARO"
if [ -n "$LATEST_LINARO" ]; then
@@ -58,7 +75,7 @@ else
rm -f Android.patch
cd ../libusb-upstream
- git checkout -b linaro-upstream-work-$TIMESTAMP $(numbertover $AOSPVER)
+ git checkout -b linaro-upstream-work-$TIMESTAMP $(numbertover $AOSPVER$AOSPVER_LIBUSB_RC)
cd ../libusb
diff -ruN ../libusb-upstream/libusb libusb > Android.patch
@@ -66,14 +83,14 @@ else
cd ../libusb-upstream
git checkout master
git branch -D linaro-upstream-work-$TIMESTAMP
- git checkout -b linaro-upstream-work-$TIMESTAMP $(numbertover $NEW_VERSION)
+ git checkout -b linaro-upstream-work-$TIMESTAMP $(numbertover $NEW_VERSION$NEW_VERSION_LIBUSB_RC)
cd ../libusb
rm -rf libusb
cp -rf ../libusb-upstream/libusb .
if patch -p0 < Android.patch; then
- notice "Auto-updated libusb to $NEW_VERSION."
+ notice "Auto-updated libusb to $NEW_VERSION$NEW_VERSION_LIBUSB_RC."
git commit -asm "Update to libusb $NEW_VERSION"
git clean -d -f -x
else