2 # release.sh: openocd release process automation
3 # Copyright (C) 2009 by Zachary T Welch <zw@superlucidity.net>
4 # Release under the GNU GPL v2 (or later versions).
6 # FIXME Remove more bash-isms. Fix errors making "ash -e" lose.
8 ## set these to control the build process
12 ## specifies the --next release type: major, minor, micro, rc, tag
14 ## For tag release type, specifies the name of the tag (e.g. "foo").
15 ## The default is the current user name, as found by the 'id' command.
16 #RELEASE_TAG="$(id -un)"
18 .
"tools/release/helpers.sh"
20 VERSION_SH
="tools/release/version.sh"
24 usage: $0 <command> ...
26 --next name The branch's next release type: major, minor, micro, rc, tag.
27 --next-tag name The name for the package version tag.
28 --live Perform the actions in the repository.
31 info Show a summary of the next pending release.
32 release Release the current tree as an archive.
35 bootstrap Prepare the working copy for configuration and building.
36 configure Configures the package; runs bootstrap, if needed.
37 build Compiles the project; runs configure, if needed.
40 package Produce new distributable source archives.
41 stage Move archives to staging area for upload.
44 clean Forces regeneration of results.
45 clean_all Removes all traces of the release process.
46 help Provides this list of commands.
48 For more information about this script, see the Release Processes page
49 in the OpenOCD Developer's Manual (doc/manual/release.txt).
57 echo "Current Release Analysis:"
62 echo -n "Bootstrapping..."
63 .
/bootstrap
2>&1 | perl tools
/logger.pl
> "release-bootstrap.log"
65 maybe_bootstrap
() { [ -f "configure" ] || do_bootstrap
; }
69 echo -n "Configuring..."
70 .
/configure
${CONFIG_OPTS} 2>&1 | perl tools
/logger.pl
> "release-config.log"
72 maybe_configure
() { [ -f "Makefile" ] || do_configure
; }
76 echo -n "Compiling OpenOCD ${PACKAGE_VERSION}"
77 make ${MAKE_OPTS} -C doc stamp-vti
2>&1 \
78 | perl tools
/logger.pl
> "release-version.log"
79 make ${MAKE_OPTS} 2>&1 \
80 | perl tools
/logger.pl
> "release-make.log"
82 maybe_build
() { [ -f "src/openocd" ] || do_build
; }
83 do_build_clean
() { [ -f Makefile
] && make maintainer-clean
>/dev
/null
; }
88 echo "Building distribution packages..."
89 make ${MAKE_OPTS} distcheck
2>&1 | perl tools
/logger.pl
> "release-pkg.log"
91 maybe_package
() { [ -f "${PACKAGE_RELEASE}.zip" ] || do_package
; }
93 for EXT
in tar.gz
tar.bz2
zip; do
100 echo "Staging package archives:"
102 for EXT
in tar.gz
tar.bz2
zip; do
103 local FILE
="${PACKAGE_RELEASE}.${EXT}"
104 # create archive signatures
105 for HASH
in md5 sha1
; do
106 echo "sign: ${FILE}.${HASH}"
107 ${HASH}sum "${FILE}" > "archives/${FILE}.${HASH}"
110 mv -v "${FILE}" archives/
114 do_stage_clean() { rm -v -f -r archives; }
119 rm -v -f release-*.log
126 do_version_commit() {
127 [ "$
*" ] || die "usage
: $0 commit
<message
>"
128 git add configure.in || die "error
: no version changes to commit
"
129 git commit -q -m "$
*" configure.in
132 do_version_finalize() {
133 echo "The
${PACKAGE_NAME} ${RELEASE_VERSION} release.
"
135 ${VERSION_SH} tag remove dev
136 [ -z "${RELEASE_FINAL}" ] || ${VERSION_SH} bump final rc
139 [ "${PACKAGE_VERSION/dev/}" != "${PACKAGE_VERSION}" ]
141 do_release_step_branch() {
142 git checkout -b "v
${RELEASE_VERSION}-release"
145 do_release_step_tag() {
146 do_version_commit "$
(do_version_finalize
)"
148 [ "${PACKAGE_VERSION/dev/}" = "${PACKAGE_VERSION}" ] || \
149 die "'${PACKAGE_NAME}-${PACKAGE_VERSION}' should not be tagged
"
150 local MSG="The
${PACKAGE_STRING} release.
"
151 git tag -m "${MSG}" "v
${PACKAGE_VERSION}"
155 echo -n "Bump
${RELEASE_TYPE} "
156 [ -z "${RELEASE_TAG}" ] || echo -n "-${RELEASE_TAG} "
157 echo -n "version and add
"
158 [ -z "${RELEASE_START_RC}" ] || echo -n "-rc0"
161 ${VERSION_SH} bump "${RELEASE_TYPE}" "${RELEASE_TAG}"
162 [ -z "${RELEASE_START_RC}" ] ||
${VERSION_SH} bump tag rc
163 ${VERSION_SH} tag add dev
165 do_release_step_bump
() {
166 # bump the version number
167 do_version_commit
"$(do_bump_version)"
170 do_release_step_news_msg
() {
172 Archive and recreate NEWS file.
174 Archive released NEWS file as NEWS-${RELEASE_VERSION}.
175 Create new NEWS file from release script template.
178 do_release_step_news
() {
179 # only archive the NEWS file for major/minor releases
180 [ "${RELEASE_TYPE}" = "major" -o "${RELEASE_TYPE}" = "minor" ] || \
182 # archive NEWS and create new one from template
183 git
mv "NEWS" "NEWS-${RELEASE_VERSION}"
186 This file includes highlights of the changes made in the
187 OpenOCD ${NEXT_RELEASE_VERSION} source archive release. See the
188 repository history for details about what changed, including
189 bugfixes and other issues not mentioned here.
195 Board, Target, and Interface Configuration Scripts:
199 For more details about what has changed since the last release,
200 see the git repository history. With gitweb, you can browse that
201 in various levels of detail.
203 For older NEWS, see the NEWS files associated with each release
204 (i.e. NEWS-
<version
>).
206 For
more information about contributing
test reports
, bug fixes
, or new
207 features and device support
, please
read the new Developer Manual
(or
208 the BUGS and PATCHES.txt files
in the
source archive
).
212 local MSG
="$(do_release_step_news_msg)"
213 git commit
-q -m "${MSG}" NEWS
"NEWS-${RELEASE_VERSION}"
216 do_release_step_package
() {
217 [ -z "${RELEASE_FAST}" ] ||
return 0
219 git checkout
-q "v${RELEASE_VERSION}"
224 do_release_step_rebranch
() {
225 # return to the new development head
226 local OLD_BRANCH
="v${RELEASE_VERSION}-release"
227 git checkout
"${OLD_BRANCH}"
229 # create new branch with new version information
231 git checkout
-b "v${PACKAGE_VERSION}"
232 git branch
-d "${OLD_BRANCH}"
236 echo "Starting $CMD for ${RELEASE_VERSION}..."
237 [ "${RELEASE_TYPE}" ] || \
238 die
"The --next release type must be provided. See --help."
242 [ -z "${RELEASE_FAST}" ] ||
return 0
243 echo "Are you sure you want to ${CMD} '${PACKAGE_RELEASE}', "
244 echo -n " to start a new ${RELEASE_TYPE} development cycle? (y/N) "
246 if [ "${ANSWER}" != 'y' ]; then
247 echo "Live release aborted!"
250 do_countdown
"Starting live release"
254 for i
in $
(seq 5 -1 1); do
264 for i
in branch bump rebranch
; do
265 "do_release_step_${i}"
274 for i
in branch tag bump news package rebranch
; do
275 "do_release_step_${i}"
278 do_all
() { do_release
"$@"; }
284 git checkout configure.
in
287 LONGOPTS
="fast,final,start-rc,next-tag:,next:,help"
288 OPTIONS
=$
(getopt
-o 'V,n:' --long "${LONGOPTS}" -n $0 -- "$@")
289 if [ $?
!= 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
290 eval set -- "${OPTIONS}"
306 export RELEASE_TYPE
="$2"
310 export RELEASE_TAG
="$2"
325 echo "Internal error"
331 case "${RELEASE_TYPE}" in
332 major|minor|micro|rc
)
335 [ "${RELEASE_TAG}" ] || RELEASE_TAG
="$(id -u -n)"
340 die
"Unknown release type '${RELEASE_TYPE}'"
345 [ "${CMD}" ] || usage
348 ACTION_CMDS
="bootstrap|configure|build|package|stage|clean"
349 MISC_CMDS
="all|info|release|branch|reset|help|usage"
350 CLEAN_CMDS
="build_clean|package_clean|stage_clean|clean_all"
351 CMDS
="|${ACTION_CMDS}|${CLEAN_CMDS}|${MISC_CMDS}|"
352 is_command
() { echo "${CMDS}" |
grep "|$1|" >/dev
/null
; }
355 if is_command
"${CMD}"; then
357 echo "Done with '${CMD}'." >&2
359 echo "error: unknown command: '${CMD}'"