diff options
author | Michael Marineau <marineam@gentoo.org> | 2007-08-23 22:32:37 +0000 |
---|---|---|
committer | Michael Marineau <marineam@gentoo.org> | 2007-08-23 22:32:37 +0000 |
commit | 77d8d86a50df4a9e426e012ce2c71b7accb6aabd (patch) | |
tree | 26ecf2b41a7826cbc381ebf372297bc455d3fc79 /dorelease | |
parent | Reorganize the xen patchset to work more like genpatches/hardened and so we o... (diff) | |
download | xen-77d8d86a50df4a9e426e012ce2c71b7accb6aabd.tar.gz xen-77d8d86a50df4a9e426e012ce2c71b7accb6aabd.tar.bz2 xen-77d8d86a50df4a9e426e012ce2c71b7accb6aabd.zip |
swipe dorelease script for hardened and tweek it slightly since I don't need to split .base and .extras
svn path=/patches/; revision=19
Diffstat (limited to 'dorelease')
-rwxr-xr-x | dorelease | 236 |
1 files changed, 236 insertions, 0 deletions
diff --git a/dorelease b/dorelease new file mode 100755 index 0000000..35a4459 --- /dev/null +++ b/dorelease @@ -0,0 +1,236 @@ +#!/bin/bash +############################################## +# +# John Mylchreest, 2006-04-13. +# +# The default settings expect CWD to be +# the branch root (directly below tags/trunk) +# +# Modified from Daniel Drakes original +# svn release script to suit my needs. +# This should also provide more flexibilty +# +############################################## + +# Get options +while getopts "f:t:d" opts; do + case ${opts} in + f) release_conf="${OPTARG}";; + t) target=${OPTARG};; + d) release_debug=1;; + esac +done +release_cwd=`pwd` + +# Source config +release_conf="${release_conf:-".release"}" + +if [[ ! -f "${release_conf}" ]]; then + echo "WARNING: Unable to find release config. Using defaults." +fi + +# Setup Defaults +webuser=${GENTOO_USER:-${USER}} +webrelease=0 +webpath="~${GENTOO_USER}/public_html/" +svntags=./tags/ +svntrunk=./trunk/ +branch_root=../ +branch_prefix= +output_dir=/tmp/ +mailvia=ssh +announce_mailto=${webuser}@gentoo.org + +# Source options +[[ -f ${release_conf} ]] && source ${release_conf} + +# Sanitise as neccessary +if [[ -n "$(svn status ${svntrunk})" ]] ; then + echo "FATAL: There are files in conflict with SVN in ${svntrunk}," + echo "FATAL: Please make sure it is up to date, with no outstanding changes." + exit -1 +fi + +echo "ACTION: Performing svn up." +svn up ${svntags}/../ >/dev/null + +# Compute targets +echo "ACTION: Tracing Previous Releases..." +# Sorry for all the pipes, its just easier to read :) +release_history="$(svn ls ${svntags} | sed -e 's:/::g' | sort -n)" + +# Find target +if [[ -z ${target} ]]; then + # Since all we need is the last release, lets do that. + for i in ${release_history}; do + target=${i%-*} + done +fi + +# Set target release +hightarget=0 +for i in ${release_history}; do + if [[ -z ${i/*${target}*} ]]; then + lasttag=${i//*-} + if [[ ${lasttag} -ge ${hightarget} ]]; then + hightarget=$((${lasttag} + 1)) + target_release=${target}-${hightarget} + fi + fi +done +[[ -n "${lasttag}" ]] && lasttag=$((${hightarget} - 1)) +[[ -z "${target_release}" ]] && target_release=${target}-1 + +# replace branch prefix? +if [[ -z "${branch_prefix}" ]]; then + pushd ${branch_root} >/dev/null + branch_prefix=`pwd` + branch_prefix=${branch_prefix/*\/}-patches + popd >/dev/null +fi + +# Print Debug +if [[ ${release_debug} -gt 0 ]]; then + for var in \ + release_conf \ + release_cwd \ + branch_root \ + branch_prefix \ + release_history \ + lasttag \ + target \ + target_release \ + output_dir \ + svntags \ + svntrunk \ + webrelease \ + mailvia \ + announce_mailto \ + webuser \ + webpath; do + + spacing=" " + len=$((${#spacing} - ${#var})) + spacing=${spacing:0:${len}} + echo -e "${var}${spacing}= ${!var}" + done +fi; + +echo "ACTION: Rolling release tarballs..." +tarball_prefix="${output_dir}/${branch_prefix}-${target_release}" +pushd ${svntrunk} >/dev/null +tar -cjf ${tarball_prefix}.tar.bz2 --exclude=".svn" ${target}/* +popd >/dev/null +echo "md5: $(md5sum ${tarball_prefix}.tar.bz2)" + +cat << EOF + +We have the tarballs, so we're ready to go. + +I will now: + +1. Tag a new ${target_release} branch +2. Upload the tarballs to d.g.o:/space/distfiles-local +EOF + +if [[ ${webrelease} -gt 0 ]]; then + cat << EOF +3. Create a release shortlog +4. Upload the release shortlog to ${webpath} +5. Upload the broken-out patches and tarballs + to ${webpath}/{broken-out,releases} +6. Send an announcement email to ${announce_mailto} + +To continue, Hit enter." +EOF +fi +read + +echo "ACTION: Tagging release in svn..." +svn cp \ + ${svntrunk}/${target} \ + ${svntags}/${target_release} \ + >/dev/null + +echo "ACTION: Comitting release..." +svn ci ${svntags}/${target_release} -m "Releasing ${target_release}" + +echo "ACTION: Uploading tarballs to distfiles..." +scp ${tarball_prefix}* \ + ${webuser}@dev.gentoo.org:/space/distfiles-local \ + >/dev/null + +if [[ ${webrelease} -gt 0 ]]; then + tmpfile=$(mktemp /tmp/myemail-XXXXXXX) + tmpath=${webpath%*\/} + tmppath=${tmppath/*\/} + shortlog=$(mktemp /tmp/myshortlog-XXXXXXX) + + echo "ACTION: Creating Shortlog..." + if [[ ${target_release//*-} == 1 ]]; then + echo "Initial Import" > ${shortlog} + else + checktag=$((${lasttag} - 1)) + lastrev=$(svn info ${svntags}/${target}-${lasttag}/ \ + | grep "Last Changed Rev") + lastrev=${lastrev//*:} + + svn log -v -r ${lastrev}:HEAD \ + ${svntrunk}/${target} \ + > ${shortlog} + fi + + #make directories + ssh ${webuser}@dev.gentoo.org \ + mkdir -p ${webpath}/broken-out/ \ + ${webpath}/releases \ + ${webpath}/logs/ \ + >/dev/null + + echo "ACTION: Uploading Shortlog..." + scp ${shortlog} \ + ${webuser}@dev.gentoo.org:${webpath}/logs/shortlog-${target_release} \ + >/dev/null + ssh ${webuser}@dev.gentoo.org chmod a+r \ + ${webpath}/logs/shortlog-${target_release} \ + >/dev/null + + #upload broken patches + echo "ACTION: Uploading broken-out patches..." + scp -r ${svntags}/${target_release} \ + ${webuser}@dev.gentoo.org:${webpath}/broken-out/ \ + >/dev/null + + #upload release tarballs + echo "ACTION: Uploading release tarballs..." + scp ${tarball_prefix}* \ + ${webuser}@dev.gentoo.org:${webpath}/releases/ \ + >/dev/null + + # Email section + cat << EOF >> ${tmpfile} +This is an automated email to say that ${branch_prefix}-${target_release} +has just been released. + +You can find a shortlog, broken out patches and release tarballs at: +http://dev.gentoo.org/~${webuser}/${tmppath} + +Changes since ${target}-${lasttag} are as follows: +EOF + + cat < ${shortlog} >> ${tmpfile} + + # Send the email + case ${mailvia} in + ssh) scp ${tmpfile} ${webuser}@dev.gentoo.org:tmpannounce; + ssh ${webuser}@dev.gentoo.org "cat tmpannounce | mailx -s \ + \"[ANNOUNCE] ${branch_prefix}-${target_release} Released\" \ + ${announce_mailto}"; + ssh ${webuser}@dev.gentoo.org rm tmpannounce;; + mailx) cat ${tmpfile} | mail \ + -s "[gentoo-kernel] [ANNOUNCE] ${branch_prefix}-${target_release} Release" \ + ${announce_mailto};; + esac + rm ${tmpfile} + rm ${shortlog} +fi |