]> git.ozlabs.org Git - next-scripts/commitdiff
add import-cpuinit and merge_cpuinit
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 07:12:50 +0000 (17:12 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 07:12:50 +0000 (17:12 +1000)
import-cpuinit [new file with mode: 0755]
merge_cpuinit [new file with mode: 0755]

diff --git a/import-cpuinit b/import-cpuinit
new file mode 100755 (executable)
index 0000000..74facbd
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+log_file=../cpuinit-import.log
+
+log()
+{
+       echo "$@" | tee -a $log_file
+}
+
+execute()
+{
+       log "$" $@
+       "$@" 2>&1 | tee -a $log_file
+       [ ${PIPESTATUS[0]} -eq 0 ] || $SHELL -i || exit 1
+}
+
+cpuinit="$(cd ../cpuinit;pwd)"
+sfile="$cpuinit/series"
+cpwd=$(pwd)
+
+base=$1
+log "Importing cpuinit based on $base"
+
+[ -d "../quilt-tmp" ] ||
+       execute git clone -s -l -n -q . ../quilt-tmp
+
+log '$' cd ../quilt-tmp
+cd ../quilt-tmp
+execute git checkout -b cpuinit/master "$base"
+git branch cpuinit/master-base
+
+patches=$(sed -e '/^#/d' -e '/^[ \t]*$/d' "$sfile")
+
+for f in $patches; do
+       execute git am --patch-format=mbox "$cpuinit/$f"
+done
+
+log '$' cd $cpwd
+cd $cpwd
+
+execute git fetch -f ../quilt-tmp cpuinit/master-base:cpuinit/master-base
+execute git fetch -f ../quilt-tmp cpuinit/master:cpuinit/master
+
+rm -rf ../quilt-tmp
+
+exit 0
diff --git a/merge_cpuinit b/merge_cpuinit
new file mode 100755 (executable)
index 0000000..999bca9
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+no_build=false
+
+[ "$1" = "-n" ] && {
+       shift
+       no_build=true
+}
+
+. "$(dirname $0)/common.sh"
+
+log()
+{
+       echo "$@" | tee -a $LOG_FILE
+}
+
+execute()
+{
+       log "$" $@
+       $@ 2>&1 | tee -a $LOG_FILE
+       return ${PIPESTATUS[0]}
+}
+
+cpwd=../next
+
+execute git clone -s -l -n -q . ../rebase-tmp || {
+       echo Clone failed 1>&2
+       bash -i || exit
+}
+log '$' cd ../rebase-tmp
+cd ../rebase-tmp
+execute git checkout -b cpuinit remotes/origin/cpuinit/master || {
+       echo Checkout of remotes/origin/cpuinit/master failed 1>&2
+       bash -i || exit
+}
+execute git rebase --onto master remotes/origin/cpuinit/master-base || {
+       echo Rebase failed 1>&2
+       bash -i || exit
+}
+echo "fix up?"
+bash -i
+log '$' cd $cpwd
+cd $cpwd
+execute git fetch -f ../rebase-tmp cpuinit:cpuinit/master || {
+       echo Fetch of cpuinit/master failed 1>&2
+       bash -i || exit
+}
+execute rm -rf ../rebase-tmp
+
+git branch -f cpuinit/master-base HEAD
+
+old_head=$(git rev-parse HEAD)
+log Merging cpuinit/master '('$(git log -1 --oneline cpuinit/master)')'
+execute git merge --no-ff cpuinit/master || {
+       echo Merge failed 1>&2
+       bash -i || exit
+}
+printf "%s\t\t%s\n" cpuinit $(git show-ref --hash cpuinit/master) >> $SHA1_FILE
+
+[ -f "../merge-fixes/cpuinit" ] && {
+       for p in $(cat "../merge-fixes/cpuinit"); do
+               $(dirname $0)/merge_fix -n "$p" || {
+                       bash -i || exit
+               }
+       done
+}
+
+new_head=$(git rev-parse HEAD)
+
+$no_build ||
+       [ "$old_head" = "$new_head" ] ||
+       [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] || {
+
+       git push -f "$build_host":"$build_dir" master:refs/heads/next || {
+               echo git push failed 1>&2
+               bash -i || exit
+       }
+       "$bin_dir/do_build" || {
+               echo Build failed 1>&2
+               bash -i || exit
+       }
+}
+
+exit 0