#!/bin/bash # ============================================================================== # Linaro new development branches script. # # Usage: tcwg-new-branch.sh GCC_VERSION YYYY.MM # ============================================================================== NC='\e[0m' RED='\e[0;31m' BLUE='\e[1;34m' BOLD='\e[1m' msg() { echo -n -e "${BLUE}** ${NC}${BOLD}$1${NC}" ; } ask() { msg "$1 " ; eval "read $2" ; } die() { echo -e "${RED}${BOLD}ERROR: ${NC}${BOLD}${1}${NC}" ; exit 1 ; } usage() { echo -e "\ ${BOLD}Usage:${NC} $(basename $0) GCC_VERSION YYYY.MM ${BOLD}GCC_VERSION${NC} : GCC branch major release version number. ${BOLD}YYYY.MM${NC} : Date of the next snapshot.\n" } extended_usage() { echo -e "\ ${BOLD}$(basename $0)${NC} is a utility which creates and performs the initial setup of Linaro development branches (main and integration) for a given GCC release branch. It should be executed from the top directory of a GCC clone and needs autoconf2.64.\n" usage exit 0 } [ $# -eq 0 ] && extended_usage [ $# -ne 2 ] && usage && exit 1 GCC_VERSION=$1 DATE=$2 # Create new development branch locally git checkout -b linaro-gcc-${GCC_VERSION}-branch origin/gcc-${GCC_VERSION}-branch # Create Linaro version string file echo "$GCC_VERSION.1-$DATE~dev" > gcc/LINARO-VERSION git add gcc/LINARO-VERSION # Add Linaro version string to configure sed -i 's:ACX_PKGVERSION(\[GCC\]):ACX_PKGVERSION(\[Linaro GCC `cat $srcdir/LINARO-VERSION`\]):' gcc/configure.ac pushd gcc &>/dev/null autoconf2.64 || die "autoconf2.64 failed." popd &>/dev/null git add gcc/configure.ac gcc/configure # Add Linaro release macros git cherry-pick -n 89cce49 &>/dev/null git add gcc/Makefile.in gcc/cppbuiltin.c git rm gcc/ChangeLog.linaro # Add .gitreview file cat << EOF > .gitreview [gerrit] host=review.linaro.org port=29418 project=toolchain/gcc defaultbranch=linaro-local/gcc-${GCC_VERSION}-integration-branch EOF git add .gitreview ask "To verify the modifications press [Enter]" user_ok git diff --cached ask "Does this look OK [N/y] ?" user_ok if [ "$user_ok" != "y" ]; then exit 1 fi # Get base revision REV=$(git log -n 1 --format="%b" | grep "branch@") REV=${REV##*@} REV=${REV%% *} # Create commit message MSG=`cat < Add Linaro release macros (Linaro only patch.) * Makefile.in (LINAROVER, LINAROVER_C, LINAROVER_S): Define. (CFLAGS-cppbuiltin.o): Add LINAROVER macro definition. (cppbuiltin.o): Depend on \\$(LINAROVER). * cppbuiltin.c (parse_linarover): New. (define_GNUC__): Define __LINARO_RELEASE__ and __LINARO_SPIN__ macros. EOF ` git commit -e -m "$MSG" msg "Push the new integration branch to gerrit remote with:\n\n" echo -e " git push gerrit linaro-gcc-${GCC_VERSION}-branch:linaro-local/gcc-${GCC_VERSION}-integration-branch\n" msg "Push the branch to the FSF repository (assuming FSF is the remote name) with:\n\n" echo -e " git push FSF linaro-gcc-${GCC_VERSION}-branch:linaro/gcc-${GCC_VERSION}-branch\n"