diff options
author | Philip P. Moltmann <moltmann@google.com> | 2016-12-16 21:44:23 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-12-16 21:44:23 +0000 |
commit | 3c6225c99b4491902c25be8170c3415b5e256224 (patch) | |
tree | 0171119aa59673ba0e9ddcfc9a8628bac588e9af | |
parent | d267a0efa5d283c02913aca88d695239ece795ba (diff) | |
parent | 3492a3447f903926b41dfd7ca7e4a80131964cd1 (diff) | |
download | libcups-3c6225c99b4491902c25be8170c3415b5e256224.tar.gz |
Add update script am: 67c0db323f am: 195a1f0027 am: 40ca6e7d8f
am: 3492a3447f
Change-Id: I7c4df7d5936e26c25991db8d88ac9b6a909189e9
-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 |