diff options
-rwxr-xr-x | tcwg-release.sh | 108 |
1 files changed, 86 insertions, 22 deletions
diff --git a/tcwg-release.sh b/tcwg-release.sh index 956850b..833aaed 100755 --- a/tcwg-release.sh +++ b/tcwg-release.sh @@ -6,6 +6,7 @@ red='\e[0;31m' blue='\e[1;34m' green='\e[0;32m' bold='\e[1m' +italic='\e[3m' lines="$(perl -E 'say "-" x 80')" EDITOR="${EDITOR:-vim}" # ============================================================================== @@ -14,7 +15,7 @@ EDITOR="${EDITOR:-vim}" usage() { # Format this section with 75 columns. cat << EOF - ${release_script} [-a FILE] [-b BRANCH] [-d DATE] [-h] [-e REMOTE] + ${release_script} [-a FILE] [-b BRANCH] [-d DATE] [-h] [-e REMOTE] -n [-r [RC] [SPIN]] [-R [SPIN]] [-S [SPIN]] [-t TAG] [-u] EOF return 0 @@ -89,6 +90,9 @@ ${bold}OPTIONS${NC}" -h Print this extended help text. + -n + No build. Skip the 'build' stage. + -R [SPIN] This tells ${release_script} to create a release tarball, branch and tag with an optional spin number SPIN. By @@ -392,6 +396,61 @@ tag() { fi } +info() { + print_info "${bold}${italic}You are about to create ${SNAPSHOT:+snapshot }${RELEASE:+release }${CANDIDATE:+release candidate }${red}${rname}" + print_info "${bold}+--------------------------------------------------------------------------------" + print_info "${bold}+ Tracking remote ${BRANCH:+branch}${TAG:+tag}:" + print_info "${bold}| ${red}${track}" + print_info "${bold}+ With new local branch:" + print_info "${bold}| ${red}${local_branch}" + print_info "${bold}+ The ${RELEASE:+release}${SNAPSHOT:+snapshot}${CANDIDATE:+release candidate} will be tagged as:" + print_info "${bold}| ${red}${release_tag}" + print_info "${bold}+ The local branch has gcc/LINARO-VERSION set:" + print_info "${bold}| ${italic}to: ${red}$(git show ${track}:gcc/LINARO-VERSION)" + print_info "${bold}+ For the ${SNAPSHOT:+snapshot}${RELEASE:+release}${CANDIDATE:+release candidate} gcc/LINARO-VERSION will be set:" + print_info "${bold}| ${italic}to: ${red}${SNAPSHOT:+Snapshot }${release}" + print_info "${bold}+ The gcc/LINARO-VERSION will be bumped:" + print_info "${bold}| ${italic}to: ${red}${bump_mode_to}" + print_info "${bold}+ The local branch should be pushed to:" + print_info "${bold}| ${red}${remote_mode_branch}" + if [ "${SNAPSHOT:+set}" = "set" ]; then + print_info "${bold}| +-----------------------------------------------------------------------------" + print_info "${bold}| + The local integration branch is:" + print_info "${bold}| | ${red}${local_int_branch}" + print_info "${bold}| + The local integration branch will have gcc/LINARO-VERSION bumped:" + print_info "${bold}| | ${italic}from: ${red}$(git show ${remote_int__branch}:gcc/LINARO-VERSION)" + print_info "${bold}| | ${italic}to: ${red}${bump_int_to}" + print_info "${bold}| + The local integration branch should be pushed to:" + print_info "${bold}| | ${red}${remote_int_branch}" + print_info "${bold}+--+-----------------------------------------------------------------------------" + else + print_info "${bold}+--------------------------------------------------------------------------------" + fi +} + +hint() { + url=$(git config --get remote.${REMOTE}.url) + if [ x"${url}" = x ]; then + print_info "Couldn't determine viable url from remote \"${REMOTE}\"" + fi + + print_info "${bold}Push local tag ${red}${release_tag}${NC}${bold} to remote \"${REMOTE}\" with:" + print_info " git push ${url/https:\/\//ssh://git@} ${release_tag}" + print_info "${bold}local branch ${red}${local_branch}${NC}${bold} to remote \"${REMOTE}\" with:" + print_info " git push ${url/https:\/\//ssh://git@} ${local_branch}:${remote_mode_branch/remotes\/${REMOTE}/refs/heads}" + + if [ "${SNAPSHOT:+set}" = "set" ]; then + print_info "${bold}local integration branch ${red}${local_int_branch}${NC}${bold} to remote \"${REMOTE}\" with:" + print_info " git push ${url/https:\/\//ssh://git@} ${local_int_branch}:${remote_int_branch/remotes\/${REMOTE}/refs/heads}" + print_info "" + print_info "${italic}${bold}Note: ${NC}${italic}Someone with FSF write permission will need to cherry-pick the remote_int_branch changes into" + print_info " refs/heads/fsf/linaro/gcc-${vstring%.*}-branch." + fi + print_info "" + print_info "${bold}The ${SNAPSHOT:+snapshot}${RELEASE:+release}${CANDIDATE:+release candidate} tarball is in:" + print_info " ${REL_DIR}/gcc-linaro-${rname}.tar.xz" +} + # ============================================================================== # Settings # ============================================================================== @@ -409,6 +468,7 @@ SNAPSHOT= RC= CANDIDATE= REMOTE= +BUILD="build" NAME="$(git config user.name)" EMAIL="$(git config user.email)" @@ -419,7 +479,7 @@ release_script="$(basename "$0")" # Arguments. The first colon puts getopts into silent error reporting mode # which sets $OPTARG to the unknown option if one is encountered. -while getopts ":a:b:d:e:hrRSt:u" options +while getopts ":a:b:d:e:hnrRSt:u" options do case $options in a ) gitlog_amend="--amend $OPTARG" @@ -438,6 +498,8 @@ do ;; h ) help; exit 1; ;; + n ) unset BUILD + ;; r ) CANDIDATE=1 # If the next input is not a -option then it is an optional RC arg. [[ ${!OPTIND} =~ ^-. ]] || { RC=${!OPTIND} ; OPTIND=$(( OPTIND + 1 )); } @@ -560,7 +622,7 @@ release=${vstring%.*}-"$DATE" # Some things are only necessary when we're in snapshot mode. if [ "${SNAPSHOT:+set}" = "set" ]; then # The snapshot branch only gets the spin number bumped. - bump_snapshot_to="${release}-$(( SPIN + 1 ))~dev" + bump_mode_to="${release}-$(( SPIN + 1 ))~dev" # The local integration branch only gets its DATE bumped. Ask `date` to # figure out what the next month is. Use mid-month as a starting point to @@ -586,11 +648,19 @@ if [ "${SNAPSHOT:+set}" = "set" ]; then # At the end of the script it will recommend that changes to the # local_int_branch will be pushed to the remote_int_branch. remote_int_branch="remotes/${REMOTE}/linaro-local/gcc-${int_vstring}-integration-branch" +elif [ "${CANDIDATE:+set}" = "set" ]; then + bump_mode_to="${release}-${SPIN}-rc$(( RC + 1 ))~dev" +else + bump_mode_to="${release}-$(( SPIN + 1 ))-rc$(( RC + 1 ))~dev" fi # The local branch can have the SPIN number on the name. local_branch=${SNAPSHOT:+snapshots/}${RELEASE:+releases/}${CANDIDATE:+releases/}linaro-${release}${SPIN:+-$SPIN}${CANDIDATE:+-rc${RC}} +if [ x"${local_branch}" = x"$(git rev-parse --abbrev-ref HEAD)" ]; then + die "Local branch \"${local_branch}\" already exists and your tree is checked out in it." +fi + # Release candidates and releases always push against the future or current # release branch. Snapshots always go into the snapshots namespace. remote_mode_branch="remotes/${REMOTE}/linaro-local/${SNAPSHOT:+snapshots}${RELEASE:+releases}${CANDIDATE:+releases}/linaro-${release}" @@ -611,30 +681,18 @@ release_tag="linaro-${rname}" REL_DIR="$PWD/../release/gcc-linaro-${rname}" + # ============================================================================== # Prepare Sources # ============================================================================== -print_info "${bold}You are about to create ${RELEASE:+release }${CANDIDATE:+release candidate }${red}${rname}" -print_info "${bold}from a new local branch named \"${red}${local_branch}${NC}${bold}\"" - -if [ x"${local_branch}" = x"$(git rev-parse --abbrev-ref HEAD)" ]; then - die "Local branch \"${local_branch}\" already exists and your tree is checked out in it." -fi - -print_info "${bold}The ${RELEASE:+release}${SNAPSHOT:+snapshot}${CANDIDATE:+release candidate} will be tagged \"${red}${release_tag}${NC}${bold}\"" -print_info "${bold}Push ${local_branch} commits to ${red}${remote_mode_branch}" -print_info "${bold}This local branch will track ${BRANCH:+branch }${TAG:+tag }${red}${track}" -if [ "${SNAPSHOT:+set}" = "set" ]; then - print_info "${bold}The local integration branch is ${red}${local_int_branch}" - print_info "${bold}The remote integration branch is ${red}${remote_int_branch}" - print_info "${bold}After we've created the snapshot we'll bump the gcc/LINARO-VERSION to ${red}${bump_snapshot_to}" -fi +# Display informational output about this run of ${release_script}. +info # Terminal lines (minus 7 to account for interesting prior output. terminal_lines=$(( $(tput lines) - 7 )) -ask "To see the most recent commits on the tracked branch press [Enter]." user_ok +ask "To see the most recent commits on the tracked ${BRANCH:+branch}${TAG:+tag} press [Enter]." user_ok # the last ten commits should be more than enough. git log -n 10 ${track} 2>/dev/null| head -n ${terminal_lines} @@ -708,8 +766,12 @@ if [ ${vstring%%.*} -ge "5" ]; then $EDITOR $REL_DIR/gcc-linaro-${rname}/ChangeLog.linaro fi -print_info "${bold}Building ${release}..." -build +if [ "${BUILD:+set}" = "set" ]; then + print_info "${bold}Building ${release}..." + build +else + print_info "${bold}Skipping build for ${release}..." +fi md5 @@ -718,5 +780,7 @@ tar cfJ gcc-linaro-${rname}.tar.xz gcc-linaro-${rname} popd 1>/dev/null if [ "${SNAPSHOT:+set}" = "set" ]; then - bump_and_dev "${bump_snapshot_to}" + bump_and_dev "${bump_mode_to}" fi + +hint |