summaryrefslogtreecommitdiff
path: root/libxml2.sh
diff options
context:
space:
mode:
Diffstat (limited to 'libxml2.sh')
-rwxr-xr-xlibxml2.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/libxml2.sh b/libxml2.sh
new file mode 100755
index 0000000..65e2736
--- /dev/null
+++ b/libxml2.sh
@@ -0,0 +1,66 @@
+. $(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
+}
+
+
+NEW_VERSION=$(latest $(curl ftp://xmlsoft.org/libxml2/ | grep "LATEST_LIBXML2" | cut -d'>' -f2 | sed -e 's,^ libxml2-,,' | sed -e "s/.tar.*//g"))
+
+if [ -z "$NEW_VERSION" ]; then
+ echo "Can't determine current version, probably the website has been edited."
+ echo "Please fix the $0 script."
+ exit 1
+fi
+echo "NEW_VERSION = $NEW_VERSION"
+
+
+checkout platform/external/libxml2
+
+cd $SRC/platform/external/libxml2
+
+if git branch -a | grep -q linaro-upstream-$NEW_VERSION; then
+ ok "libxml2 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 [ "$(vertonumber $NEW_VERSION)" -le "$(vertonumber $AOSPVER)" ]; then
+ notice "libxml2 is up to date in AOSP master, copying its work"
+else
+ notice "Updating libxml2 to $NEW_VERSION"
+
+ cd $SRC/platform/external
+ wget ftp://xmlsoft.org/libxml2/libxml2-$NEW_VERSION.tar.gz
+ tar -zxf libxml2-$NEW_VERSION.tar.gz
+
+ cd libxml2
+
+ for i in *; do
+ if [ -e ../libxml2-$NEW_VERSION/$i ]; then
+ cp -rf ../libxml2-$NEW_VERSION/$i .
+ fi
+ done
+
+ cd $SRC/platform/external
+ rm -rf libxml2-$NEW_VERSION.tar.gz libxml2-$NEW_VERSION
+
+ cd $SRC/platform/external/libxml2
+ sed -i -e 's/'$AOSPVER'/'$NEW_VERSION'/g' README.version
+
+ error "Couldn't auto-update libxml2 - patch failed to apply."
+ error "Please fix manually and commit to a branch called"
+ error "linaro-upstream-$NEW_VERSION."
+ exit 1
+
+fi \ No newline at end of file