Browse Source

Rewrite release script to use GIT.

Update documentation to reflect GIT methodology.  Rewrite release.sh
script to use appropriate process.  With this update, tools/release.sh
can be used for producing private release tags on local branches.
The documentation still needs work, but their use for v0.3.x should
help rectify the deficiences.
tags/v0.3.0-rc0
Zachary T Welch 14 years ago
parent
commit
e8dc384be9
2 changed files with 210 additions and 512 deletions
  1. +62
    -136
      doc/manual/release.txt
  2. +148
    -376
      tools/release.sh

+ 62
- 136
doc/manual/release.txt View File

@@ -212,46 +212,47 @@ Even with the release script, some steps require clear user intervention

The following steps should be followed to produce each release:

-# Produce final patches to mainline (or release branch):
-# Produce final manual patches to mainline (or release branch):
-# Finalize @c NEWS file to describe the changes in the release
- This file is Used to automatically post "blurbs" about the project.
- This material should be produced during the development cycle.
- Add a new item for each @c NEWS-worthy contribution, when committed.
-# bump library version if our API changed (not yet required)
-# Remove -dev tag from package version in configure.in:
- For major/minor releases, remove version tag from mainline, @a or
- For bug-fix releases, remove version tag from release branch.
-# Branch or tag the required tree in the git repository:
- Tags and branches for releases must be named consistently: @par
"${PACKAGE_TARNAME}-${PACKAGE_VERSION}"
- For a major/minor release from the mainline, the code should be
tagged in the repository:
-# Bump library version if our API changed (not yet required)
-# Produce and tag the final revision in the git repository:
- Update and commit the final package version in @c configure.in :
-# Remove @c -dev tag.
-# Remove @c -rc tag, if producing the final release from an -rc series.
- Tags must be named consistently:
@verbatim
svn cp .../trunk .../branches/${RELEASE_BRANCH}
svn cp .../branches/${RELEASE_BRANCH} .../tags/${RELEASE_TAG}
@endverbatim
- For bug-fix releases produced in their respective branch, a tag
should be created in the repository:
- Tag the final commit with a consistent GIT tag name and message:
@verbatim
svn cp .../branches/${RELEASE_BRANCH} .../tags/${RELEASE_TAG}
PACKAGE_VERSION="x.y.z"
PACKAGE_TAG="v${PACKAGE_VERSION}"
git tag -m "The openocd-${PACKAGE_VERSION} release." "${PACKAGE_TAG}"
@endverbatim
-# Prepare to resume normal development activities:
- Archive @c NEWS file as <code>doc/news/NEWS-${PACKAGE_VERSION}</code>.
- Create a new @c NEWS file for the next release
- For major/minor release from the mainline:
-# Bump major or minor package version in mainline.
-# Restore version tag to mainline.
- For bug-fix releases from a release branch:
-# Bump bug-fix version in release branch.
-# Restore version tag to release branch.
-# Prepare to resume normal development on the branch:
- Restore @c -dev and -@c -rc0 version tags.
- To start a new major (or minor) release cycle on the @c master branch:
- Bump major (or minor) package version, zeroing sub-components.
- Add -rc0 version tag:
- This insures casual releases from GIT always increase monotonically.
- For example, a major increment after releasing 1.2.3 starts 2.0.0-rc0-dev.
- Archive @c NEWS file as "<code>doc/news/NEWS-${PACKAGE_VERSION}</code>".
- Create a new @c NEWS file for the next release
- To start a bug-fix release on a non-master branch:
-# Bump bug-fix version.
- To start another release candidate on a major or minor branch:
-# Bump rc tag.
-# Produce the package source archives:
-# Start with a clean working copy, used for producing releases only.
-# Switch to release tag branch: svn switch .../${RELEASE_TAG}
-# Produce a ChangeLog for the release (using svn2cl).
-# Checkout the appropriate tag:
<code>git checkout $(git tag ) "${PACKAGE_VERSION}"</code>
-# Produce a ChangeLog for the release (using @c git2cl).
-# @c bootstrap, @c configure, and @c make the package.
-# Run <code>make distcheck</code> to produce the distribution archives.
-# Run <code>make maintainer-clean</code> verify the repository is empty.
-# Create signature files using md5sum, sha1sum, etc.
-# Create signature files using @c md5sum, @c sha1sum, etc.
-# Publish documentation for the release:
- Allow users to access the documentation for each of our releases.
- Place static copies of the following files on the project website:
@@ -259,12 +260,21 @@ svn cp .../branches/${RELEASE_BRANCH} .../tags/${RELEASE_TAG}
- @c ChangeLog: to show exactly what has been changed
- User Guide, Developer Manual: to allow easy on-line viewing
-# Upload packages and post announcements of their availability:
-# Release packages into files section of berliOS project site:
-# Release packages into files section of project sites:
- SF.net:
-# Create a new folder named "${PACKAGE_VERSION}"
-# Select new folder as the target for uploads.
-# Upload files via Web interface into new
-# Set platform types for each archive:
- .tar.bz2: Linux, Mac
- .tar.gz: BSD, Solaris, Others
- .zip: Windows
- Berlios:
-# Create the new release for the new version.
-# Provide @c NEWS and ChangeLog files, as requested.
-# Upload files via FTP to ftp://ftp.berlios.de/incoming/
-# Edit descriptions for each file.
-# Send E-mail Release Notice
-# Click button to send E-mail Release Notice.
-# Post announcement e-mail to the openocd-development list.
-# Announce updates on freshmeat.net and other trackers.
-# Submit big updates to news feeds (e.g. Digg, Reddit, etc.).
@@ -275,7 +285,7 @@ Many of the processes described in the last section are no longer
entrusted to humans. Instead, the @c release.sh script provides
automation of the mechanical steps.

Presently, the @c release.sh script automates steps 1(c) through 4,
Presently, the @c release.sh script automates steps 2 through 4,
allowing the Release Manager from perform these tasks in easy steps.

The following task still need to be automated:
@@ -285,61 +295,34 @@ The following task still need to be automated:
- Step 6(b): package announcement e-mail process.
- Step 6(c): post files and announce them using releaseforge.

In addition, support for '-rc' releases needs to be added.

@subsection releasescriptcmds Release Script Commands

The following output was taken from the release script:
@verbatim
usage: tools/release.sh [options] <command>

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 project mainline.
tag Create a tag for the current release branch.

Other Commands:
version ... Perform version number and tag manipulations.
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.
@endverbatim
The release script can be used for two tasks:
- Creating releases and starting a new release cycle:
@code
git checkout master
tools/release.sh --type=minor --final --start-rc release
@endcode
- Creating a development branch from a tagged release:
@code
git checkout 'v0.2.0'
tools/release.sh --type=micro branch
@endcode

Run <code>tools/release.sh help</code> for current command support.
Both of these variations make automatic commits and tags in your
repository, so you should be sure to run it on a cloned copy before
proceding with a live release.

@subsection releasescriptopts Release Script Options

The @c release.sh script recognizes some command-line options that
affect its behavior:

- @c --live : Use this option to perform a live release.
When this option has been given, the release commands will affect
the repository; otherwise, the script reports the actions to take,
and it produces archives that are unsuitable for public release.

@note Only the Release Manager should use the @c --live option, as
it will make permanent changes to the git repository that
cannot be undone.
- The @c --start-rc indicates that the new development release cycle
should start with @c -rc0. Without this, the @c -rc tag will be omitted,
leading to non-monotonic versioning of the in-tree version numbers.
- The @c --final indicates that the release should drop the @c -rc tag,
to going from @c x.y.z-rcN-dev to x.y.z.

@subsection releasescriptenv Release Script Environment

@@ -351,66 +334,9 @@ affect its behavior:

@section releasetutorial Release Tutorials

This section provides tutorials for using the Release Script to perform
common release tasks.

@subsection releasetutorialsetup Release Tutorial Setup

The tutorials in this section assume the following environment
variables have been set properly:
@verbatim
SVN_USER="maintainer"
SVN_URL="https://${SVN_USER}@svn.berlios.de/svnroot/repos/openocd"
@endverbatim

@subsection releasetutorialminor Minor Release Tutorial

This section provides a step-by-step tutorial for a Release Manager to
use to run the @c release.sh script to produce a minor release.

If the proper environment has been set, the following steps will produce
a new minor release:

-# Check out (or update) mainline from the repository:
@code
svn checkout "${SVN_URL}/trunk" openocd-trunk
@endcode
-# Change to the new working copy directory:
@code
cd openocd-trunk
@endcode
-# Run @c release.sh to produce the minor release:
@code
tools/release.sh all
@endcode

@subsection releasetutorialmicro Bug-Fix Release Tutorial

This section provides a step-by-step tutorial for a Release Manager to
use to run the @c release.sh script to produce a bug-fix release.

In addition to the environment variables described in the introduction
to these tutorials, the following variables are also used in the
instructions for this section:
@verbatim
PACKAGE_BRANCH_VERSION="x.y.z"
PACKAGE_BRANCH="openocd-${PACKAGE_BRANCH_VERSION}"
@endverbatim

If the proper environment has been set, the following steps will produce
a new bug-fix release:

-# Check out (or update) the release branch from the project repository:
@code
svn checkout "${SVN_URL}/branches/${PACKAGE_BRANCH}" "${PACKAGE_BRANCH}"
@endcode
@code
cd "${PACKAGE_BRANCH}"
@endcode
-# Run @c release.sh to produce the bug-fix release:
@code
tools/release.sh all
@endcode
This section should contain a brief tutorial for using the Release
Script to perform release tasks, but the new script needs to be
used for 0.3.0.

@section releasetodo Release Script Shortcomings



+ 148
- 376
tools/release.sh View File

@@ -7,142 +7,27 @@
#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 <<INFO
Release Type: ${RELEASE_TYPE}
Branch URL: ${PACKAGE_BRANCH}
Tag URL: ${PACKAGE_TAG}
INFO
}

do_svn_echo_msg() { echo "svn: $1: $3"; }
do_svn_echo() {
case "$1" in
commit)
do_svn_echo_msg "$@"
shift 3
[ "$*" ] && echo "Files: $@"
;;
copy|move)
do_svn_echo_msg "$@"
echo "From: ${4:-$2}"
echo " To: ${5:-$3}"
;;
*)
local ACTION="$1"
shift
echo "svn: ${ACTION}: $@"
;;
esac
}
do_svn() {
do_svn_echo "$@"
[ "${RELEASE_DRY_RUN}" ] || svn "$@"
}
do_svn_switch() {
do_svn switch "$@"
package_info_load
}

## specifies the --next release type: major, minor, micro, rc, tag
#RELEASE_TYPE=tag
## For tag release type, specifies the name of the tag (e.g. "foo").
## The default is the current user name, as found by the 'id' command.
#RELEASE_TAG="$(id -un)"

package_info_load_name() {
grep AC_INIT configure.in | perl -ne 's/^.+\(\[([-\w]*)\],.+$/$1/ and print'
}
package_info_load_version() {
grep AC_INIT configure.in | perl -ne 's/^.+\[([-\w\.]*)\],$/$1/ and print'
}

package_info_load() {
[ -f "configure.in" ] || \
die "package_info_load: configure.in is missing"

PACKAGE_NAME="$(package_info_load_name)"
# todo: fix this
PACKAGE_TARNAME="${PACKAGE_NAME}"

PACKAGE_VERSION="$(package_info_load_version)"
[ "${RELEASE_VERSION}" ] || \
RELEASE_VERSION=${PACKAGE_VERSION/-dev/}

[ "${PACKAGE_NAME}" -a "${PACKAGE_VERSION}" ] || \
die "package information is missing from configure script"

PACKAGE_VERSION_TAGS=
[ "${PACKAGE_VERSION/-/}" = "${PACKAGE_VERSION}" ] || \
PACKAGE_VERSION_TAGS="-${PACKAGE_VERSION#*-}"
PACKAGE_VERSION_BASE="${PACKAGE_VERSION%%-*}"
PACKAGE_MICRO="${PACKAGE_VERSION_BASE##*.}"
PACKAGE_MAJOR_AND_MINOR="${PACKAGE_VERSION_BASE%.*}"
PACKAGE_MAJOR="${PACKAGE_MAJOR_AND_MINOR%.*}"
PACKAGE_MINOR="${PACKAGE_MAJOR_AND_MINOR#*.}"

PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
if [ "${RELEASE_DRY_RUN}" ]; then
PACKAGE_RELEASE="${PACKAGE_TARNAME}-${PACKAGE_VERSION}"
else
PACKAGE_RELEASE="${PACKAGE_TARNAME}-${RELEASE_VERSION}"
fi
}
source "tools/release/helpers.sh"

package_info_show() {
cat <<INFO
Name: ${PACKAGE_TARNAME}
Release: ${RELEASE_VERSION}
Version: ${PACKAGE_VERSION}
Number: ${PACKAGE_VERSION_BASE}
Series: ${PACKAGE_MAJOR_AND_MINOR}
Major: ${PACKAGE_MAJOR}
Minor: ${PACKAGE_MINOR}
Micro: ${PACKAGE_MICRO}
Tags: ${PACKAGE_VERSION_TAGS}
Branch: ${PACKAGE_RELEASE}
Release: ${PACKAGE_TARNAME}-${PACKAGE_VERSION_BASE}${PACKAGE_VERSION_TAGS}
INFO
}
VERSION_SH="tools/release/version.sh"

usage() {
cat << USAGE
usage: $0 <command>
usage: $0 <command> ...
Command Options:
--next name The branch's next release type: major, minor, micro, rc, tag.
--next-tag name The name for the package version tag.
--live Perform the actions in the repository.

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.
@@ -150,42 +35,26 @@ Build Commands:
build Compiles the project; runs configure, if needed.

Packaging Commands:
changelog Generate a new ChangeLog using svn2cl.
changelog Generate a new ChangeLog using ${SCM}2cl.
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() {
do_info() {
echo "Current Release Analysis:"
package_info_show
svn_setup_show
}

do_info() {
package_info_load
svn_setup_load
do_info_show
}

do_bootstrap() {
@@ -213,26 +82,16 @@ maybe_build() { [ -f "src/openocd" ] || do_build; }
do_build_clean() { [ -f Makefile ] && make maintainer-clean >/dev/null; }

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
local CMD=tools/git2cl/git2cl
eval ${CMD} ${OPTS} > ChangeLog
}
do_changelog_clean() {
do_svn revert ChangeLog
git checkout ChangeLog
}

do_package() {
package_info_load
maybe_changelog
do_changelog
maybe_build
echo "Building distribution packages..."
make ${MAKE_OPTS} distcheck 2>&1 | perl tools/logger.pl > "release-pkg.log"
@@ -266,207 +125,76 @@ do_stage_clean() { rm -v -f -r archives; }
do_clean() {
do_build_clean
do_package_clean
rm -v -f configure

svn revert configure.in
do_changelog_clean
rm -v -f release-*.log
}
do_clean_all() {
do_clean
do_changelog_clean
do_stage_clean
}

do_version_usage() {
cat << USAGE
usage: $0 version <command>
Version Commands:
tag {add|remove} <label> Add or remove the specified tag.
bump {major|minor|micro} Bump the specified version number, and
reset less-significant numbers to zero.
bump tag <label> Add or bump a versioned tag (e.g. -rcN).
bump final <label> Remove a versioned tag (e.g. -rcN).
USAGE
}

do_version_sed() {
local OLD_VERSION="${PACKAGE_VERSION}"
local NEW_VERSION="$1"
local MSG="$2"

sed -i -e "/AC_INIT/ s|${OLD_VERSION}|${NEW_VERSION}|" configure.in
package_info_load
echo "${MSG}: ${OLD_VERSION} -> ${NEW_VERSION}"
}
do_version_bump_sed() {
local NEW_VERSION="$1"
[ -z "${PACKAGE_VERSION_TAGS}" ] || \
NEW_VERSION="${NEW_VERSION}${PACKAGE_VERSION_TAGS}"

do_version_sed "${NEW_VERSION}" \
"Bump ${CMD} package version number"
}
do_version_bump_major() {
do_version_bump_sed "$((PACKAGE_MAJOR + 1)).0.0"
}
do_version_bump_minor() {
do_version_bump_sed "${PACKAGE_MAJOR}.$((PACKAGE_MINOR + 1)).0"
}
do_version_bump_micro() {
do_version_bump_sed "${PACKAGE_MAJOR_AND_MINOR}.$((PACKAGE_MICRO + 1))"
}
do_version_bump_tag() {
local TAG="$1"
[ "${TAG}" ] || die "TAG argument is missing"
local TAGS="${PACKAGE_VERSION_TAGS}"
if has_version_tag "${TAG}"; then
local RC=$(do_version_tag_value "${TAG}")
RC=$((${RC} + 1))
TAGS=$(echo ${TAGS} | perl -npe "s/-${TAG}[\\d]*/-${TAG}${RC}/")
else
TAGS="-${TAG}1${PACKAGE_VERSION_TAGS}"
fi
PACKAGE_VERSION_TAGS="${TAGS}"
do_version_bump_sed "${PACKAGE_VERSION_BASE}"
}
do_version_bump_final() {
local TAG="$1"
[ "${TAG}" ] || die "TAG argument is missing"
has_version_tag "${TAG}" || die "-${TAG} tag is missing"
do_version_tag_remove "${TAG}$(do_version_tag_value "${TAG}")"
}
do_version_bump() {
CMD="$1"
shift
case "${CMD}" in
major|minor|micro|final|tag)
eval "do_version_bump_${CMD}" "$@"
;;
*)
do_version_usage
;;
esac
}

has_version_tag() {
test "${PACKAGE_VERSION/-${1}/}" != "${PACKAGE_VERSION}"
}
do_version_tag_value() {
local TAG="$1"
echo ${PACKAGE_VERSION_TAGS} | perl -ne "/-${TAG}"'(\d+)/ && print $1'
}
do_version_tag_add() {
local TAG="$1"
has_version_tag "${TAG}" && \
die "error: tag '-${TAG}' exists in '${PACKAGE_VERSION}'"
do_version_sed "${PACKAGE_VERSION}-${TAG}" \
"Add '-${TAG}' version tag"
}
do_version_tag_remove() {
local TAG="$1"
has_version_tag "${TAG}" || \
die "error: tag '-${TAG}' missing from '${PACKAGE_VERSION}'"
do_version_sed "${PACKAGE_VERSION/-${TAG}/}" \
"Remove '-${TAG}' version tag"
}
do_version_tag() {
CMD="$1"
shift
case "${CMD}" in
add|remove)
local i=
for i in "$@"; do
eval "do_version_tag_${CMD}" "${i}"
done
;;
*)
do_version_usage
;;
esac
}

do_version_commit() {
[ "$(svn diff configure.in | wc -l)" -gt 0 ] || \
die "error: no version changes to commit"
do_svn commit -m "$1" configure.in
[ "$*" ] || die "usage: $0 commit <message>"
git add configure.in || die "error: no version changes to commit"
git commit -q -m "$*" configure.in
}

do_version() {
package_info_load
CMD="$1"
shift
case "${CMD}" in
tag|bump)
do_version_commit "$(eval "do_version_${CMD}" "$@")"
;;
commit)
local MSG="$1"
[ "${MSG}" ] || die "usage: $0 version commit <message>"
do_version_commit "${MSG}"
;;
*)
do_version_usage
;;
esac
do_version_finalize() {
echo "The ${PACKAGE_NAME} ${RELEASE_VERSION} release."
echo
${VERSION_SH} tag remove dev
[ -z "${RELEASE_FINAL}" ] || ${VERSION_SH} bump final rc
}


do_branch() {
package_info_load
svn_setup_load
do_svn copy -m "Branching version ${PACKAGE_VERSION}" \
"${SVN_TRUNK}" "${PACKAGE_BRANCH}"
has_dev_tag() {
[ "${PACKAGE_VERSION/dev/}" != "${PACKAGE_VERSION}" ]
}
do_tag() {
package_info_load
svn_setup_load
do_svn copy -m "Tagging version ${PACKAGE_VERSION}" \
"${PACKAGE_BRANCH}" "${PACKAGE_TAG}"
do_release_step_branch() {
git checkout -b "v${RELEASE_VERSION}-release"
}
do_commit() {
package_info_load
svn_setup_load

do_release_step_tag() {
do_version_commit "$(do_version_finalize)"
package_info_load
[ "${PACKAGE_VERSION/dev/}" = "${PACKAGE_VERSION}" ] || \
die "'${PACKAGE_NAME}-${PACKAGE_VERSION}' cannot be released"

[ "${PACKAGE_VERSION%.0}" = "${PACKAGE_VERSION}" ] || \
do_branch
do_tag
die "'${PACKAGE_NAME}-${PACKAGE_VERSION}' should not be tagged"
local MSG="The ${PACKAGE_STRING} release."
git tag -m "${MSG}" "v${PACKAGE_VERSION}"
}

do_bump_version() {
echo -n "Bump ${RELEASE_TYPE} "
[ -z "${RELEASE_TAG}" ] || echo -n "-${RELEASE_TAG} "
echo -n "version and add "
[ -z "${RELEASE_START_RC}" ] || echo -n "-rc0"
echo "-dev tag."
echo
${VERSION_SH} bump "${RELEASE_TYPE}" "${RELEASE_TAG}"
[ -z "${RELEASE_START_RC}" ] || ${VERSION_SH} bump tag rc
${VERSION_SH} tag add dev
}


do_release_step_prep() {
do_version tag remove dev
# reset RELEASE_VERSION now to allow release version to be detected
export RELEASE_VERSION=
do_release_step_bump() {
# bump the version number
do_version_commit "$(do_bump_version)"
}
do_release_step_commit() { do_commit; }

do_release_step_branch_bump() {
local TYPE="$1"
echo "Bump ${TYPE} version and add tag:"
do_version_bump ${TYPE}
do_version_tag_add dev
}
do_release_step_branch() {
do_svn_switch "${PACKAGE_BRANCH}"
do_version_commit "$(do_release_step_branch_bump micro)"
do_svn_switch "${SVN_URL}"
}
do_release_step_news_msg() {
cat <<MSG
Archive released NEWS file: NEWS -> NEWS-${RELEASE_VERSION}
Create new NEWS file from relesse script template.
Archive and recreate NEWS file.

Archive released NEWS file as NEWS-${RELEASE_VERSION}.
Create new NEWS file from release script template.
MSG
}
do_release_step_news() {
# only archive the NEWS file for major/minor releases
[ "${RELEASE_TYPE}" = "major" -o "${RELEASE_TYPE}" = "minor" ] || \
return 0
# archive NEWS and create new one from template
do_svn move "NEWS" "NEWS-${RELEASE_VERSION}"
git mv "NEWS" "NEWS-${RELEASE_VERSION}"

[ "${RELEASE_DRY_RUN}" ] || cat >NEWS <<NEWS
cat >NEWS <<NEWS
This file should include items worth mentioning in the
OpenOCD ${PACKAGE_RELEASE} source archive release.
OpenOCD ${NEXT_RELEASE_VERSION} source archive release.

The following areas of OpenOCD functionality changed in this release:

@@ -485,71 +213,79 @@ For more information about contributing test reports, bug fixes, or new
features and device support, please read the new Developer Manual (or
the BUGS and PATCHES files in the source archive).
NEWS
do_svn add NEWS
git add NEWS

local MSG="$(do_release_step_news_msg)"
do_svn commit -m "${MSG}" NEWS NEWS-${RELEASE_VERSION}
git commit -q -m "${MSG}" NEWS "NEWS-${RELEASE_VERSION}"
}
do_release_step_bump() {
# major and minor releases require branch version update too
[ "${RELEASE_TYPE}" = "micro" ] || do_release_step_branch
# bump the current tree version as required.
do_version_commit "$(do_release_step_branch_bump "${RELEASE_TYPE}")"

[ "${RELEASE_TYPE}" = "micro" ] || do_release_step_news
}
do_release_step_package() {
local A=${PACKAGE_TAG}
local B=${A/https/http}
local PACKAGE_BUILD=${B/${USER}@/}

do_svn_switch "${PACKAGE_TAG}"
do_svn_switch --relocate "${PACKAGE_TAG}" "${PACKAGE_BUILD}"

# required to force SVN to update the in-source URL keyword
[ "${RELEASE_DRY_RUN}" ] || rm -v -f src/openocd.c
do_svn revert src/openocd.c
[ -z "${RELEASE_FAST}" ] || return 0

git checkout -q "v${RELEASE_VERSION}"
do_stage
do_clean
}

do_svn_switch --relocate "${PACKAGE_BUILD}" "${PACKAGE_TAG}"
do_svn_switch "${SVN_URL}"
do_release_step_rebranch() {
# return to the new development head
local OLD_BRANCH="v${RELEASE_VERSION}-release"
git checkout "${OLD_BRANCH}"

# create new branch with new version information
package_info_load
git checkout -b "v${PACKAGE_VERSION}"
git branch -d "${OLD_BRANCH}"
}

do_release_step_1() { do_release_step_prep; }
do_release_step_2() { do_release_step_commit; }
do_release_step_3() { do_release_step_bump; }
do_release_step_0() { do_release_step_branch; }
do_release_step_1() { do_release_step_tag; }
do_release_step_2() { do_release_step_bump; }
do_release_step_3() { do_release_step_news; }
do_release_step_4() { do_release_step_package; }
do_release_step_5() { do_release_step_rebranch; }

do_release_setup() {
echo "Starting $CMD for ${RELEASE_VERSION}..."
[ "${RELEASE_TYPE}" ] || \
die "The --next release type must be provided. See --help."
}

do_release_check() {
echo -n "Are you sure you want to release '${PACKAGE_RELEASE}'?"
[ -z "${RELEASE_FAST}" ] || return 0
echo "Are you sure you want to ${CMD} '${PACKAGE_RELEASE}', "
echo -n " to start a new ${RELEASE_TYPE} development cycle? (y/N) "
read ANSWER
if [ "${ANSWER}" != 'y' ]; then
echo "Live release aborted!"
exit 0
fi
do_countdown "Starting live release"
}
do_countdown() {
echo -n "$1 in "
for i in $(seq 5 -1 1); do
echo -n "$i, "
sleep 1
done
echo "go!"
}

do_release() {
package_info_load
package_info_show

if [ -z "${RELEASE_DRY_RUN}" ]; then
do_release_check
do_countdown "Starting live release"
fi
do_branch() {
do_release_setup
local i=
for i in 0 2 5; do
"do_release_step_${i}"
done
}

do_release() {
local CMD='release'
do_release_setup
do_release_check
local i=
for i in $(seq 1 4); do
eval "do_release_step_${i}"
for i in $(seq 0 5); do
"do_release_step_${i}"
done
}
do_all() { do_release "$@"; }
@@ -558,18 +294,35 @@ do_reset() {
maybe_bootstrap
maybe_configure
do_clean_all
svn revert configure.in
git checkout configure.in
}

OPTIONS=$(getopt -o V --long live -n $0 -- "$@")
LONGOPTS="fast,final,start-rc,next-tag:,next:,help"
OPTIONS=$(getopt -o 'V,n:' --long "${LONGOPTS}" -n $0 -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "${OPTIONS}"
while true; do
case "$1" in
--live)
export RELEASE_DRY_RUN=
--fast)
RELEASE_FAST=yes
shift
;;
--final)
RELEASE_FINAL=yes
shift
;;
--start-rc)
RELEASE_START_RC=yes
shift
;;
-n|--next)
export RELEASE_TYPE="$2"
shift 2
;;
--next-tag)
export RELEASE_TAG="$2"
shift 2
;;
-V)
exec $0 info
;;
@@ -577,6 +330,10 @@ while true; do
shift
break
;;
--help)
usage
shift
;;
*)
echo "Internal error"
exit 1
@@ -584,18 +341,33 @@ while true; do
esac
done

case "${RELEASE_TYPE}" in
major|minor|micro|rc)
;;
tag)
[ "${RELEASE_TAG}" ] || RELEASE_TAG="$(id -u -n)"
;;
'')
;;
*)
die "Unknown release type '${RELEASE_TYPE}'"
;;
esac

CMD=$1
[ "${CMD}" ] || usage
shift

ACTION_CMDS="bootstrap|configure|build|changelog|package|stage|clean"
MISC_CMDS="all|info|version|tag|branch|commit|release|reset|help|usage"
MISC_CMDS="all|info|release|branch|reset|help|usage"
CLEAN_CMDS="build_clean|changelog_clean|package_clean|stage_clean|clean_all"
CMDS="|${ACTION_CMDS}|${CLEAN_CMDS}|${MISC_CMDS}|"
is_command() { echo "${CMDS}" | grep "|$1|" >/dev/null; }

package_info_load
if is_command "${CMD}"; then
eval "do_${CMD}" "$@"
"do_${CMD}" "$@"
echo "Done with '${CMD}'." >&2
else
echo "error: unknown command: '${CMD}'"
usage


Loading…
Cancel
Save