From: Stephen Rothwell Date: Fri, 28 Jun 2013 07:12:50 +0000 (+1000) Subject: add import-cpuinit and merge_cpuinit X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=5ade5b8313e76ba0df652c8744dfdbca92b0093d;p=next-scripts add import-cpuinit and merge_cpuinit --- diff --git a/import-cpuinit b/import-cpuinit new file mode 100755 index 0000000..74facbd --- /dev/null +++ b/import-cpuinit @@ -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 index 0000000..999bca9 --- /dev/null +++ b/merge_cpuinit @@ -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