diff options
author | Philip P. Moltmann <moltmann@google.com> | 2016-12-15 12:20:53 -0800 |
---|---|---|
committer | Philip P. Moltmann <moltmann@google.com> | 2016-12-15 12:30:13 -0800 |
commit | 67c0db323f38ea8f61f9f734467edbcacd3c2279 (patch) | |
tree | 0171119aa59673ba0e9ddcfc9a8628bac588e9af | |
parent | 25aee82d491492e1fa3b005e5880e684dc081ffb (diff) | |
download | libcups-67c0db323f38ea8f61f9f734467edbcacd3c2279.tar.gz |
Add update script
Test: Ran script to update to v2.2.1
Change-Id: I663e0369508e0cc598157258f0a321b42a23fc45
-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 |