]> git.ozlabs.org Git - next-scripts/commitdiff
Add helpers for reverting and adding patches
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Nov 2008 03:01:22 +0000 (14:01 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Nov 2008 03:01:22 +0000 (14:01 +1100)
do_patch [new file with mode: 0755]
do_revert [new file with mode: 0755]

diff --git a/do_patch b/do_patch
new file mode 100755 (executable)
index 0000000..3fe1df8
--- /dev/null
+++ b/do_patch
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+LOG_FILE="../merge.log"
+build_host="sprygo"
+build_dir="/scratch/sfr/next"
+build_cmd="bin/build_next"
+
+no_build=false
+[ "$1" = "-n" ] && {
+       shift
+       no_build=true
+}
+
+patch="$1"
+shift
+
+[ -n "$1" ] && build_host="$1"
+
+log()
+{
+       echo "$@" | tee -a $LOG_FILE
+}
+
+execute()
+{
+       log "$" $@
+       $@ 2>&1 | tee -a $LOG_FILE
+       return ${PIPESTATUS[0]}
+}
+
+GIT_EDITOR=: execute git am -3 "$patch" || exit 1
+
+$no_build && exit 0
+
+rsync -avH --exclude .git --delete . "$build_host":"$build_dir"/. || {
+       echo Rsync failed 1>&2
+       bash -i || exit
+}
+ssh "$build_host" "$build_cmd" || {
+       echo Build failed 1>&2
+       bash -i || exit
+}
+
+exit 0
diff --git a/do_revert b/do_revert
new file mode 100755 (executable)
index 0000000..e8844e7
--- /dev/null
+++ b/do_revert
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+LOG_FILE="../merge.log"
+build_host="sprygo"
+build_dir="/scratch/sfr/next"
+build_cmd="bin/build_next"
+
+no_build=false
+[ "$1" = "-n" ] && {
+       shift
+       no_build=true
+}
+
+rev=$1
+shift
+
+[ -n "$1" ] && build_host="$1"
+
+log()
+{
+       echo "$@" | tee -a $LOG_FILE
+}
+
+execute()
+{
+       log "$" $@
+       $@ 2>&1 | tee -a $LOG_FILE
+       return ${PIPESTATUS[0]}
+}
+
+GIT_EDITOR=: execute git revert $rev || exit 1
+
+$no_build && exit 0
+
+rsync -avH --exclude .git --delete . "$build_host":"$build_dir"/. || {
+       echo Rsync failed 1>&2
+       bash -i || exit
+}
+ssh "$build_host" "$build_cmd" || {
+       echo Build failed 1>&2
+       bash -i || exit
+}
+
+exit 0