2009-11-04 17:20:18 -06:00
|
|
|
#!/bin/bash
|
2009-07-06 06:21:28 -05:00
|
|
|
# release.sh: openocd release process automation
|
|
|
|
# Copyright (C) 2009 by Zachary T Welch <zw@superlucidity.net>
|
|
|
|
# Release under the GNU GPL v2 (or later versions).
|
|
|
|
|
2009-11-04 17:20:18 -06:00
|
|
|
# FIXME Remove more bash-isms. Fix errors making "ash -e" lose.
|
|
|
|
|
2009-07-06 06:21:28 -05:00
|
|
|
## set these to control the build process
|
|
|
|
#CONFIG_OPTS=""
|
|
|
|
#MAKE_OPTS=""
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
## 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)"
|
2009-07-06 06:21:28 -05:00
|
|
|
|
2009-11-04 17:20:18 -06:00
|
|
|
. "tools/release/helpers.sh"
|
2009-07-06 06:21:28 -05:00
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
VERSION_SH="tools/release/version.sh"
|
2009-07-06 06:21:28 -05:00
|
|
|
|
|
|
|
usage() {
|
|
|
|
cat << USAGE
|
2009-10-20 19:11:33 -05:00
|
|
|
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.
|
2009-07-06 06:21:28 -05:00
|
|
|
|
|
|
|
Main Commands:
|
|
|
|
info Show a summary of the next pending release.
|
|
|
|
release Release the current tree as an archive.
|
|
|
|
|
|
|
|
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:
|
|
|
|
package Produce new distributable source archives.
|
|
|
|
stage Move archives to staging area for upload.
|
|
|
|
|
|
|
|
Other Commands:
|
|
|
|
clean Forces regeneration of results.
|
|
|
|
clean_all Removes all traces of the release process.
|
|
|
|
help Provides this list of commands.
|
2009-10-20 19:11:33 -05:00
|
|
|
|
2009-07-06 06:21:28 -05:00
|
|
|
For more information about this script, see the Release Processes page
|
|
|
|
in the OpenOCD Developer's Manual (doc/manual/release.txt).
|
|
|
|
USAGE
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
do_usage() { usage; }
|
|
|
|
do_help() { usage; }
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
do_info() {
|
2009-07-06 06:21:28 -05:00
|
|
|
echo "Current Release Analysis:"
|
|
|
|
package_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; }
|
|
|
|
|
|
|
|
|
|
|
|
do_package() {
|
|
|
|
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
|
2009-09-30 18:20:06 -05:00
|
|
|
local FILE="${PACKAGE_RELEASE}.${EXT}"
|
|
|
|
# create archive signatures
|
2017-01-15 09:40:54 -06:00
|
|
|
for HASH in sha256; do
|
2009-09-30 18:20:06 -05:00
|
|
|
echo "sign: ${FILE}.${HASH}"
|
|
|
|
${HASH}sum "${FILE}" > "archives/${FILE}.${HASH}"
|
|
|
|
done
|
|
|
|
# save archive
|
|
|
|
mv -v "${FILE}" archives/
|
2009-07-06 06:21:28 -05:00
|
|
|
done
|
|
|
|
cp -a NEWS archives/
|
|
|
|
}
|
|
|
|
do_stage_clean() { rm -v -f -r archives; }
|
|
|
|
|
|
|
|
do_clean() {
|
|
|
|
do_build_clean
|
|
|
|
do_package_clean
|
|
|
|
rm -v -f release-*.log
|
|
|
|
}
|
|
|
|
do_clean_all() {
|
|
|
|
do_clean
|
|
|
|
do_stage_clean
|
|
|
|
}
|
|
|
|
|
|
|
|
do_version_commit() {
|
2009-10-20 19:11:33 -05:00
|
|
|
[ "$*" ] || die "usage: $0 commit <message>"
|
2012-03-20 16:19:16 -05:00
|
|
|
git add configure.ac || die "error: no version changes to commit"
|
|
|
|
git commit -q -m "$*" configure.ac
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
do_version_finalize() {
|
|
|
|
echo "The ${PACKAGE_NAME} ${RELEASE_VERSION} release."
|
|
|
|
echo
|
|
|
|
${VERSION_SH} tag remove dev
|
|
|
|
[ -z "${RELEASE_FINAL}" ] || ${VERSION_SH} bump final rc
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
2009-10-20 19:11:33 -05:00
|
|
|
has_dev_tag() {
|
|
|
|
[ "${PACKAGE_VERSION/dev/}" != "${PACKAGE_VERSION}" ]
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
2009-10-20 19:11:33 -05:00
|
|
|
do_release_step_branch() {
|
|
|
|
git checkout -b "v${RELEASE_VERSION}-release"
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
do_release_step_tag() {
|
|
|
|
do_version_commit "$(do_version_finalize)"
|
|
|
|
package_info_load
|
2009-10-07 00:43:05 -05:00
|
|
|
[ "${PACKAGE_VERSION/dev/}" = "${PACKAGE_VERSION}" ] || \
|
2009-10-20 19:11:33 -05:00
|
|
|
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
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
2009-10-20 19:11:33 -05:00
|
|
|
do_release_step_bump() {
|
|
|
|
# bump the version number
|
|
|
|
do_version_commit "$(do_bump_version)"
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
|
|
|
|
2009-09-30 18:19:53 -05:00
|
|
|
do_release_step_news_msg() {
|
|
|
|
cat <<MSG
|
2009-10-20 19:11:33 -05:00
|
|
|
Archive and recreate NEWS file.
|
|
|
|
|
|
|
|
Archive released NEWS file as NEWS-${RELEASE_VERSION}.
|
|
|
|
Create new NEWS file from release script template.
|
2009-09-30 18:19:53 -05:00
|
|
|
MSG
|
|
|
|
}
|
|
|
|
do_release_step_news() {
|
2009-10-20 19:11:33 -05:00
|
|
|
# only archive the NEWS file for major/minor releases
|
|
|
|
[ "${RELEASE_TYPE}" = "major" -o "${RELEASE_TYPE}" = "minor" ] || \
|
|
|
|
return 0
|
2009-07-06 06:21:28 -05:00
|
|
|
# archive NEWS and create new one from template
|
2009-10-20 19:11:33 -05:00
|
|
|
git mv "NEWS" "NEWS-${RELEASE_VERSION}"
|
2009-07-06 06:21:28 -05:00
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
cat >NEWS <<NEWS
|
2009-11-04 18:46:27 -06:00
|
|
|
This file includes highlights of the changes made in the
|
|
|
|
OpenOCD ${NEXT_RELEASE_VERSION} source archive release. See the
|
|
|
|
repository history for details about what changed, including
|
|
|
|
bugfixes and other issues not mentioned here.
|
2009-07-06 06:21:28 -05:00
|
|
|
|
|
|
|
JTAG Layer:
|
2009-11-04 18:46:27 -06:00
|
|
|
Boundary Scan:
|
2009-07-06 06:21:28 -05:00
|
|
|
Target Layer:
|
|
|
|
Flash Layer:
|
|
|
|
Board, Target, and Interface Configuration Scripts:
|
|
|
|
Documentation:
|
|
|
|
Build and Release:
|
|
|
|
|
|
|
|
For more details about what has changed since the last release,
|
2009-11-04 18:46:27 -06:00
|
|
|
see the git repository history. With gitweb, you can browse that
|
|
|
|
in various levels of detail.
|
|
|
|
|
|
|
|
For older NEWS, see the NEWS files associated with each release
|
|
|
|
(i.e. NEWS-<version>).
|
2009-07-06 06:21:28 -05:00
|
|
|
|
|
|
|
For more information about contributing test reports, bug fixes, or new
|
|
|
|
features and device support, please read the new Developer Manual (or
|
2010-01-08 19:20:47 -06:00
|
|
|
the BUGS and PATCHES.txt files in the source archive).
|
2009-07-06 06:21:28 -05:00
|
|
|
NEWS
|
2009-10-20 19:11:33 -05:00
|
|
|
git add NEWS
|
2009-07-06 06:21:28 -05:00
|
|
|
|
2009-09-30 18:19:53 -05:00
|
|
|
local MSG="$(do_release_step_news_msg)"
|
2009-10-20 19:11:33 -05:00
|
|
|
git commit -q -m "${MSG}" NEWS "NEWS-${RELEASE_VERSION}"
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
2009-09-30 18:19:53 -05:00
|
|
|
|
2009-07-06 06:21:28 -05:00
|
|
|
do_release_step_package() {
|
2009-10-20 19:11:33 -05:00
|
|
|
[ -z "${RELEASE_FAST}" ] || return 0
|
2009-09-30 18:20:13 -05:00
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
git checkout -q "v${RELEASE_VERSION}"
|
2009-07-06 06:21:28 -05:00
|
|
|
do_stage
|
|
|
|
do_clean
|
2009-10-20 19:11:33 -05:00
|
|
|
}
|
2009-09-30 18:20:13 -05:00
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
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}"
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
do_release_setup() {
|
|
|
|
echo "Starting $CMD for ${RELEASE_VERSION}..."
|
|
|
|
[ "${RELEASE_TYPE}" ] || \
|
|
|
|
die "The --next release type must be provided. See --help."
|
|
|
|
}
|
2009-07-06 06:21:28 -05:00
|
|
|
|
|
|
|
do_release_check() {
|
2009-10-20 19:11:33 -05:00
|
|
|
[ -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) "
|
2009-07-06 06:21:28 -05:00
|
|
|
read ANSWER
|
|
|
|
if [ "${ANSWER}" != 'y' ]; then
|
|
|
|
echo "Live release aborted!"
|
|
|
|
exit 0
|
|
|
|
fi
|
2009-10-20 19:11:33 -05:00
|
|
|
do_countdown "Starting live release"
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
|
|
|
do_countdown() {
|
|
|
|
echo -n "$1 in "
|
|
|
|
for i in $(seq 5 -1 1); do
|
|
|
|
echo -n "$i, "
|
2009-10-20 19:11:33 -05:00
|
|
|
sleep 1
|
2009-07-06 06:21:28 -05:00
|
|
|
done
|
|
|
|
echo "go!"
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
do_branch() {
|
|
|
|
do_release_setup
|
|
|
|
local i=
|
2009-11-04 17:20:18 -06:00
|
|
|
for i in branch bump rebranch; do
|
2009-10-20 19:11:33 -05:00
|
|
|
"do_release_step_${i}"
|
|
|
|
done
|
|
|
|
}
|
2009-07-06 06:21:28 -05:00
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
do_release() {
|
|
|
|
local CMD='release'
|
|
|
|
do_release_setup
|
|
|
|
do_release_check
|
2009-07-06 06:21:28 -05:00
|
|
|
local i=
|
2009-11-04 17:20:18 -06:00
|
|
|
for i in branch tag bump news package rebranch; do
|
2009-10-20 19:11:33 -05:00
|
|
|
"do_release_step_${i}"
|
2009-07-06 06:21:28 -05:00
|
|
|
done
|
|
|
|
}
|
|
|
|
do_all() { do_release "$@"; }
|
|
|
|
|
|
|
|
do_reset() {
|
|
|
|
maybe_bootstrap
|
|
|
|
maybe_configure
|
|
|
|
do_clean_all
|
2012-03-20 16:19:16 -05:00
|
|
|
git checkout configure.ac
|
2009-07-06 06:21:28 -05:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
LONGOPTS="fast,final,start-rc,next-tag:,next:,help"
|
|
|
|
OPTIONS=$(getopt -o 'V,n:' --long "${LONGOPTS}" -n $0 -- "$@")
|
2009-07-06 06:21:28 -05:00
|
|
|
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
|
|
|
eval set -- "${OPTIONS}"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
2009-10-20 19:11:33 -05:00
|
|
|
--fast)
|
|
|
|
RELEASE_FAST=yes
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--final)
|
|
|
|
RELEASE_FINAL=yes
|
2009-07-06 06:21:28 -05:00
|
|
|
shift
|
|
|
|
;;
|
2009-10-20 19:11:33 -05:00
|
|
|
--start-rc)
|
|
|
|
RELEASE_START_RC=yes
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-n|--next)
|
|
|
|
export RELEASE_TYPE="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
--next-tag)
|
|
|
|
export RELEASE_TAG="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
2009-07-06 06:21:28 -05:00
|
|
|
-V)
|
|
|
|
exec $0 info
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2009-10-20 19:11:33 -05:00
|
|
|
--help)
|
|
|
|
usage
|
|
|
|
shift
|
|
|
|
;;
|
2009-07-06 06:21:28 -05:00
|
|
|
*)
|
|
|
|
echo "Internal error"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
case "${RELEASE_TYPE}" in
|
|
|
|
major|minor|micro|rc)
|
|
|
|
;;
|
|
|
|
tag)
|
|
|
|
[ "${RELEASE_TAG}" ] || RELEASE_TAG="$(id -u -n)"
|
|
|
|
;;
|
|
|
|
'')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
die "Unknown release type '${RELEASE_TYPE}'"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-07-06 06:21:28 -05:00
|
|
|
CMD=$1
|
|
|
|
[ "${CMD}" ] || usage
|
|
|
|
shift
|
|
|
|
|
2009-11-04 18:46:27 -06:00
|
|
|
ACTION_CMDS="bootstrap|configure|build|package|stage|clean"
|
2009-10-20 19:11:33 -05:00
|
|
|
MISC_CMDS="all|info|release|branch|reset|help|usage"
|
2009-11-04 18:46:27 -06:00
|
|
|
CLEAN_CMDS="build_clean|package_clean|stage_clean|clean_all"
|
2009-07-06 06:21:28 -05:00
|
|
|
CMDS="|${ACTION_CMDS}|${CLEAN_CMDS}|${MISC_CMDS}|"
|
|
|
|
is_command() { echo "${CMDS}" | grep "|$1|" >/dev/null; }
|
|
|
|
|
2009-10-20 19:11:33 -05:00
|
|
|
package_info_load
|
2009-07-06 06:21:28 -05:00
|
|
|
if is_command "${CMD}"; then
|
2009-10-20 19:11:33 -05:00
|
|
|
"do_${CMD}" "$@"
|
|
|
|
echo "Done with '${CMD}'." >&2
|
2009-07-06 06:21:28 -05:00
|
|
|
else
|
|
|
|
echo "error: unknown command: '${CMD}'"
|
|
|
|
usage
|
|
|
|
fi
|