reworked cactus merge scripts

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
This commit is contained in:
Gaetan Semet 2013-12-09 10:52:42 +01:00
commit 4d9b06d3bc

View file

@ -15,116 +15,133 @@ alias cjm='cactus jump metacactus'
function bb_env() function bb_env()
{ {
BBDIR=$1 BBDIR=$1
shift shift
if [[ -z $BBDIR ]]; then local BASE
BASE=$BUILDBOT_PROJECT_PATH/main
else
BASE=$BBDIR
fi
export __PATHBKP=$PATH
export PYTHONPATH=$BASE/buildbot/master:$BASE/txwebservices/install:$BASE/cactus/install:$BASE/config/tools
export PATH=$HOME/bin:$BASE/buildbot/master/bin:$BASE/txwebservices/install:$PATH
#export format_warnings_path=$BASE/config
#export warning_path=$BASE/config/latests_warnings
#export __PS1BKP=$PS1
fg_blue=%{$'\e[0;34m'%} if [[ -z $BBDIR ]]; then
fg_cyan=%{$'\e[0;36m'%} BASE=$BUILDBOT_PROJECT_PATH/main-new/
fg_lgreen=%{$'\e[1;32m'%} else
# export PS1=${fg_lgreen}BBENV${fg_cyan}:$PS1 BASE=$BBDIR
fi
#export __PATHBKP=$PATH
#export PYTHONPATH=$BASE/buildbot/master:$BASE/txwebservices/install:$BASE/cactus/install:$BASE/config/tools
#export PATH=$HOME/bin:$BASE/buildbot/master/bin:$BASE/txwebservices/install:$PATH
#export format_warnings_path=$BASE/config
#export warning_path=$BASE/config/latests_warnings
#export __PS1BKP=$PS1
cd $BASE/config fg_blue=%{$'\e[0;34m'%}
. ../tosource fg_cyan=%{$'\e[0;36m'%}
fg_lgreen=%{$'\e[1;32m'%}
# export PS1=${fg_lgreen}BBENV${fg_cyan}:$PS1
cd $BASE/config
. ../tosource
} }
function bb_envrestore() function bb_envrestore()
{ {
unset BASE unset BASE
unset PYTHONPATH unset PYTHONPATH
unset warning_path unset warning_path
unset format_warnings_path unset format_warnings_path
export PATH=$__PATHBKP export PATH=$__PATHBKP
export PS1=$__PS1BKP export PS1=$__PS1BKP
} }
alias autopep8_cur_directory='autopep8 --ignore=E501 -i **/*.py' alias autopep8_cur_directory='autopep8 --ignore=E501 -i **/*.py'
function bb_repo_upload() function bb_repo_upload()
{ {
REVIEWERS=(ion.alberdi@intel.com\ local REVIEWERS
vincentx.besanceney@intel.com\ local A
vincentx.dardel@intel.com\
christophex.letessier@intel.com\ declare -a REVIEWERS
olivier.monnier@intel.com\
remy.protat@intel.com\ REVIEWERS=(ion.alberdi@intel.com\
gaetan.semet@intel.com\ vincentx.besanceney@intel.com\
pierre.tardy@intel.com) vincentx.dardel@intel.com\
A=$(printf -- '%s,' ${REVIEWERS[@]}) christophex.letessier@intel.com\
A=${A%,} olivier.monnier@intel.com\
echo "Reviewers: $A" remy.protat@intel.com\
echo "Cmd: repo upload --cbr --re=$A ." gaetan.semet@intel.com\
yes | repo upload --cbr --re=$A . pierre.tardy@intel.com)
A=$(printf -- '%s,' ${REVIEWERS[@]})
A=${A%,}
echo "Reviewers: $A"
echo "Cmd: repo upload --cbr --re=$A ."
yes | repo upload --cbr --re=$A .
} }
function bb_merge_staging_main() function bb_merge_bottom_branch_to_here()
{ {
git merge umg/platform/buildbot/staging --m "Manual merge branch 'platform/buildbot/staging' into 'platform/buildbot/main'" local branch
git mergetool --no-prompt --tool=kdiff3
branch=$(git branches | grep "remotes/m/" | cut -d'/' -f5 | cut -d' ' -f1)
case $branch in
main)
bottom_branch="staging"
;;
staging)
bottom_branch="prod"
;;
*)
echo "Error: unable to findout current branch!"
return 1
esac
echo "Merging branch $bottom_branch to $branch..."
git merge umg/platform/buildbot/$bottom_branch --m "Manual merge of branch 'platform/buildbot/$bottom_branch' into 'platform/buildbot/$branch'"
git mergetool --no-prompt --tool=kdiff3
} }
function bb_merge_prod_staging()
{
git merge umg/platform/buildbot/prod --m "Manual merge branch 'platform/buildbot/prod' into 'platform/buildbot/staging'"
git mergetool --no-prompt --tool=kdiff3
}
function bb_push_with_care() function bb_push_with_care()
{ {
branch=$(git branches | grep "remotes/m/" | cut -d'/' -f5 | cut -d' ' -f1) local branch
project=$(git remote -v | grep umg | tail -n 1 | cut -d'/' -f6 | cut -d' ' -f1) local project
if [[ -z $project || -z $branch ]]; then branch=$(git branches | grep "remotes/m/" | cut -d'/' -f5 | cut -d' ' -f1)
echo "Unable to findout branches or project name :(" project=$(git remote -v | grep umg | tail -n 1 | cut -d'/' -f6 | cut -d' ' -f1)
return
fi
echo "Pushing branch '$branch' on project '$project'"
echo "Press Enter to continue"
read
git push ssh://android.intel.com/a/buildbot/$project HEAD:platform/buildbot/$branch
# git push umg HEAD:platform/buildbot/$branch
# This requires to have the following configuration in git remote (ex for 'config' project):
# umg ssh://gerrit-glb.tl.intel.com/a/buildbot/config (fetch)
# umg ssh://gerrit-glb.tl.intel.com/a/buildbot/config (push)
#
echo "Refreshing repo" if [[ -z $project || -z $branch ]]; then
echo "Waitin 30s..." echo "Unable to findout branches or project name :("
sleep "30" return
repo sync . fi
echo "Pushing branch '$branch' on project '$project'"
echo "Press Enter to continue"
read
git push ssh://android.intel.com/a/buildbot/$project HEAD:refs/heads/platform/buildbot/$branch
echo "Display merged:" echo "Refreshing repo"
git log --pretty=oneline --graph -3 | cat echo "Waitin 30s..."
sleep "30"
repo sync .
echo "Display merged:"
git log --pretty=oneline --graph -3 | cat
} }
function bb_start_slaves() function bb_start_slaves()
{ {
DIR=$(basename $PWD) local DIR
if [[ $DIR == "config" ]]; then DIR=$(basename $PWD)
~/bin/buildslave start ~/data/buildbot-developer if [[ $DIR == "config" ]]; then
~/bin/buildslave start ~/data/buildbot-developer2 ~/bin/buildslave start ~/data/buildbot-developer
else ~/bin/buildslave start ~/data/buildbot-developer2
~/bin/buildslave start ~/data/buildbot/ else
fi ~/bin/buildslave start ~/data/buildbot/
fi
} }
function bb_stop_slaves() function bb_stop_slaves()
{ {
DIR=$(basename $PWD) local DIR
if [[ $DIR == "config" ]]; then DIR=$(basename $PWD)
~/bin/buildslave stop ~/data/buildbot-developer if [[ $DIR == "config" ]]; then
~/bin/buildslave stop ~/data/buildbot-developer2 ~/bin/buildslave stop ~/data/buildbot-developer
else ~/bin/buildslave stop ~/data/buildbot-developer2
~/bin/buildslave stop ~/data/buildbot/ else
fi ~/bin/buildslave stop ~/data/buildbot/
fi
} }