diff options
author | Philip P. Moltmann <moltmann@google.com> | 2016-12-15 23:34:34 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-12-15 23:34:34 +0000 |
commit | 3492a3447f903926b41dfd7ca7e4a80131964cd1 (patch) | |
tree | 0171119aa59673ba0e9ddcfc9a8628bac588e9af | |
parent | 8ddc494f4848f8eca85a0af3f48822a6f7c29616 (diff) | |
parent | 40ca6e7d8fe440cc9d99416b72b55840b8e2b376 (diff) | |
download | platform_external_libcups-3492a3447f903926b41dfd7ca7e4a80131964cd1.tar.gz platform_external_libcups-3492a3447f903926b41dfd7ca7e4a80131964cd1.tar.bz2 platform_external_libcups-3492a3447f903926b41dfd7ca7e4a80131964cd1.zip |
Add update script am: 67c0db323f am: 195a1f0027
am: 40ca6e7d8f
Change-Id: I0228b51d93cd021fa3516266b0c205f42d96bd09
-rwxr-xr-x | update_libcups.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/update_libcups.sh b/update_libcups.sh new file mode 100755 index 00000000..d289b617 --- /dev/null +++ b/update_libcups.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +if [ "$1" -eq "" ]; then + echo "Please provide the source repo" + exit -1 +else + SRC_REPO=$1 +fi + +TARGET_DIR=$(realpath $(dirname "$0")) +echo "== Updating $TARGET_DIR from $SRC_REPO ==" + +echo +echo "== get current rev ==" +cd $TARGET_DIR + +CURRENT_REV=$(git tag -l | grep -v "release" | grep -v "b" | grep -v "rc" | sort | tail -n1) +echo "Current rev is $CURRENT_REV" + +echo +echo "== create tmp dir ==" +TMP_DIR=$(mktemp -d) +echo "Created temporary dir $TMP_DIR" + +echo +echo "== clone repo ==" +cd $TMP_DIR + +git clone $SRC_REPO . + +echo +echo "== find new stable rev ==" +NEW_REV=$(git tag -l | grep -v "release" | grep -v "b" | grep -v "rc" | sort | tail -n1) +echo "Stable rev is $NEW_REV" + +if [ "$CURRENT_REV" == "$NEW_REV" ] ; then + echo + echo ">>> Rev $CURRENT_REV is already the newest stable rev" +else + echo + echo "== create diff in between rev $CURRENT_REV and rev $NEW_REV ==" + TMP_DIFF=$(mktemp) + git diff $CURRENT_REV $NEW_REV -- cups/ filter/ LICENSE.txt > $TMP_DIFF + echo "Diff in $TMP_DIFF" + + echo + echo "== Apply diff ==" + cd $TARGET_DIR + + patch -p1 < $TMP_DIFF + if [ $? -ne 0 ] ; then + exit 1 + fi + + git add -A + git commit -m "Update libcups to $NEW_REV" + + git tag $NEW_REV + + echo + echo ">>> Updated libcups from $CURRENT_REV to $NEW_REV" +fi + +echo +echo "== Cleaning up ==" +rm -f $TMP_DIFF +rm -rf $TMP_DIR |