summaryrefslogtreecommitdiff
path: root/tcwg-new-branch.sh
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2016-04-28 16:51:05 +0200
committerYvan Roux <yvan.roux@linaro.org>2016-04-29 14:04:06 +0200
commit6d4f0f07751e949c67be26bf31ac3a622df1b2ff (patch)
tree9f7a173430a43fb8dfab3b862427aaed17e0098b /tcwg-new-branch.sh
parent1f3248109134dc8bb2ab62768072dfebe0299bb0 (diff)
Add new script to create new Linaro development branches.
Change-Id: I1210b87fe03ea9bfd1226294aac2b659738d9647
Diffstat (limited to 'tcwg-new-branch.sh')
-rwxr-xr-xtcwg-new-branch.sh121
1 files changed, 121 insertions, 0 deletions
diff --git a/tcwg-new-branch.sh b/tcwg-new-branch.sh
new file mode 100755
index 0000000..03daad5
--- /dev/null
+++ b/tcwg-new-branch.sh
@@ -0,0 +1,121 @@
+#!/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 <<EOF
+Create Linaro branch from gcc-${GCC_VERSION}-branch at r${REV}.
+
+ * .gitreview: New file.
+
+ gcc/
+ * LINARO-VERSION: New file.
+ * configure.ac: Add Linaro version string.
+ * configure: Regenerate.
+
+ gcc/
+ Cherry-pick from linaro/gcc-4_9-branch r217544.
+ 2014-11-14 Yvan Roux <yvan.roux@linaro.org>
+
+ 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"
+