From ce0824868c1326df81024e78d98af1fe560ecb97 Mon Sep 17 00:00:00 2001 From: zwelch Date: Mon, 6 Jul 2009 11:21:28 +0000 Subject: Add script to automate most of the release process. git-svn-id: svn://svn.berlios.de/openocd/trunk@2473 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- tools/release.sh | 569 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 569 insertions(+) create mode 100755 tools/release.sh (limited to 'tools') diff --git a/tools/release.sh b/tools/release.sh new file mode 100755 index 00000000..583cd20c --- /dev/null +++ b/tools/release.sh @@ -0,0 +1,569 @@ +#!/bin/sh -e +# release.sh: openocd release process automation +# Copyright (C) 2009 by Zachary T Welch +# Release under the GNU GPL v2 (or later versions). + +## set these to control the build process +#CONFIG_OPTS="" +#MAKE_OPTS="" + +## DO NOT PERFORM LIVE RELEASES UNLESS YOU ARE THE RELEASE MANAGER!!! +RELEASE_DRY_RUN=1 +## set this to perform individual steps on past releases +RELEASE_VERSION= + +die() { + echo "$@" >&2 + exit 1 +} + +svn_info_get() { + svn info | grep "$1" | cut -d':' -f2- | cut -c2- +} + +svn_setup_load() { + SVN_ROOT="$(svn_info_get 'Repository Root')" + SVN_URL="$(svn_info_get 'URL')" + + SVN_TRUNK="${SVN_ROOT}/trunk" + + SVN_BRANCHES="${SVN_ROOT}/branches" + PACKAGE_BRANCH="${SVN_BRANCHES}/${PACKAGE_RELEASE}" + + SVN_TAGS="${SVN_ROOT}/tags" + PACKAGE_TAG="${SVN_TAGS}/${PACKAGE_RELEASE}" + + if [ "${SVN_URL}" = "${SVN_TRUNK}" ]; then + RELEASE_TYPE=minor + elif [ "${SVN_URL/${SVN_BRANCHES}/}" != "${SVN_URL}" ]; then + RELEASE_TYPE=micro + else + echo "error: bad URL: ${SVN_URL}" >&2 + die "unable to branch from the current location" + fi +} +svn_setup_show() { + cat < + +Main Commands: + info Show a summary of the next pending release. + release Release the current tree as an archive. + upload Upload archives to berliOS project site + +Build Commands: + bootstrap Prepare the working copy for configuration and building. + configure Configures the package; runs bootstrap, if needed. + build Compiles the project; runs configure, if needed. + +Packaging Commands: + changelog Generate a new ChangeLog using svn2cl. + package Produce new distributable source archives. + stage Move archives to staging area for upload. + +Repository Commands: + commit Perform branch and tag, as appropriate for the version. + branch Create a release branch from the project trunk. + tag Create a tag for the current release branch. + +Other Commands: + version ... Perform version number and tag manipulations. + maryslamb Mary had a little lamb, but no one noticed. + clean Forces regeneration of results. + clean_all Removes all traces of the release process. + help Provides this list of commands. + +For more information about this script, see the Release Processes page +in the OpenOCD Developer's Manual (doc/manual/release.txt). + +WARNING: This script should be used by the Release Manager ONLY. +USAGE + exit 0 +} +do_usage() { usage; } +do_help() { usage; } + +do_info_show() { + echo "Current Release Analysis:" + package_info_show + svn_setup_show +} + +do_info() { + package_info_load + svn_setup_load + do_info_show +} + +do_bootstrap() { + echo -n "Bootstrapping..." + ./bootstrap 2>&1 | perl tools/logger.pl > "release-bootstrap.log" +} +maybe_bootstrap() { [ -f "configure" ] || do_bootstrap; } + +do_configure() { + maybe_bootstrap + echo -n "Configuring..." + ./configure ${CONFIG_OPTS} 2>&1 | perl tools/logger.pl > "release-config.log" +} +maybe_configure() { [ -f "Makefile" ] || do_configure; } + +do_build() { + maybe_configure + echo -n "Compiling OpenOCD ${PACKAGE_VERSION}" + make ${MAKE_OPTS} -C doc stamp-vti 2>&1 \ + | perl tools/logger.pl > "release-version.log" + make ${MAKE_OPTS} 2>&1 \ + | perl tools/logger.pl > "release-make.log" +} +maybe_build() { [ -f "src/openocd" ] || do_build; } +do_build_clean() { [ -f Makefile ] && make maintainer-clean >/dev/null; } + +maybe_rebuild() { + if [ -f "configure" ]; then + echo "Re-running autoconf..." + autoconf + echo "Re-running automake..." + automake + fi + if [ -f "Makefile" ]; then + do_configure + do_build + fi +} + +do_changelog() { + echo "Updating working copy to HEAD..." + do_svn update + echo "Creating ChangeLog..." + svn2cl -i --authors AUTHORS.ChangeLog +} +maybe_changelog() { + if [ -z "${RELEASE_DRY_RUN}" ] \ + || [ ! -f ChangeLog ] \ + || [ "$(cat ChangeLog | wc -l)" -lt 2 ] + then + do_changelog + fi +} +do_changelog_clean() { + do_svn revert ChangeLog +} + +do_package() { + package_info_load + maybe_changelog + maybe_build + echo "Building distribution packages..." + make ${MAKE_OPTS} distcheck 2>&1 | perl tools/logger.pl > "release-pkg.log" +} +maybe_package() { [ -f "${PACKAGE_RELEASE}.zip" ] || do_package; } +do_package_clean() { + for EXT in tar.gz tar.bz2 zip; do + rm -v -f *.${EXT} + done +} + +do_stage() { + maybe_package + echo "Staging package archives:" + mkdir -p archives + for EXT in tar.gz tar.bz2 zip; do + mv -v "${PACKAGE_RELEASE}.${EXT}" archives/ + done + cp -a NEWS archives/ + cp -a ChangeLog archives/ +} +do_stage_clean() { rm -v -f -r archives; } + +do_clean() { + do_build_clean + do_package_clean + rm -v -f configure + + svn revert configure.in + rm -v -f release-*.log +} +do_clean_all() { + do_clean + do_changelog_clean + do_stage_clean +} + +do_version_usage() { + cat << USAGE +usage: $0 version +Version Commands: + tag {add|remove}