1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
#!/bin/bash
# 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).
# FIXME Remove more bash-isms. Fix errors making "ash -e" lose.
## set these to control the build process
#CONFIG_OPTS=""
#MAKE_OPTS=""
## 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)"
. "tools/release/helpers.sh"
VERSION_SH="tools/release/version.sh"
usage() {
cat << USAGE
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.
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.
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; }
do_info() {
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
local FILE="${PACKAGE_RELEASE}.${EXT}"
# create archive signatures
for HASH in md5 sha1; do
echo "sign: ${FILE}.${HASH}"
${HASH}sum "${FILE}" > "archives/${FILE}.${HASH}"
done
# save archive
mv -v "${FILE}" archives/
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() {
[ "$*" ] || die "usage: $0 commit <message>"
git add configure.in || die "error: no version changes to commit"
git commit -q -m "$*" configure.in
}
do_version_finalize() {
echo "The ${PACKAGE_NAME} ${RELEASE_VERSION} release."
echo
${VERSION_SH} tag remove dev
[ -z "${RELEASE_FINAL}" ] || ${VERSION_SH} bump final rc
}
has_dev_tag() {
[ "${PACKAGE_VERSION/dev/}" != "${PACKAGE_VERSION}" ]
}
do_release_step_branch() {
git checkout -b "v${RELEASE_VERSION}-release"
}
do_release_step_tag() {
do_version_commit "$(do_version_finalize)"
package_info_load
[ "${PACKAGE_VERSION/dev/}" = "${PACKAGE_VERSION}" ] || \
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_bump() {
# bump the version number
do_version_commit "$(do_bump_version)"
}
do_release_step_news_msg() {
cat <<MSG
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
git mv "NEWS" "NEWS-${RELEASE_VERSION}"
cat >NEWS <<NEWS
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.
JTAG Layer:
Boundary Scan:
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,
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>).
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.txt files in the source archive).
NEWS
git add NEWS
local MSG="$(do_release_step_news_msg)"
git commit -q -m "${MSG}" NEWS "NEWS-${RELEASE_VERSION}"
}
do_release_step_package() {
[ -z "${RELEASE_FAST}" ] || return 0
git checkout -q "v${RELEASE_VERSION}"
do_stage
do_clean
}
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_setup() {
echo "Starting $CMD for ${RELEASE_VERSION}..."
[ "${RELEASE_TYPE}" ] || \
die "The --next release type must be provided. See --help."
}
do_release_check() {
[ -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_branch() {
do_release_setup
local i=
for i in branch bump rebranch; do
"do_release_step_${i}"
done
}
do_release() {
local CMD='release'
do_release_setup
do_release_check
local i=
for i in branch tag bump news package rebranch; do
"do_release_step_${i}"
done
}
do_all() { do_release "$@"; }
do_reset() {
maybe_bootstrap
maybe_configure
do_clean_all
git checkout configure.in
}
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
--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
;;
--)
shift
break
;;
--help)
usage
shift
;;
*)
echo "Internal error"
exit 1
;;
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|package|stage|clean"
MISC_CMDS="all|info|release|branch|reset|help|usage"
CLEAN_CMDS="build_clean|package_clean|stage_clean|clean_all"
CMDS="|${ACTION_CMDS}|${CLEAN_CMDS}|${MISC_CMDS}|"
is_command() { echo "${CMDS}" | grep "|$1|" >/dev/null;
|