ETM cleanup
[openocd/ztw.git] / tools / release / helpers.sh
blob2dd5bae15a9b47de46ca9d0f140c7729d8b4e8a6
1 #!/bin/sh -e
3 die() {
4 echo "$@" >&2
5 exit 1
8 package_info_load_name() {
9 grep AC_INIT configure.in | perl -ne 's/^.+\(\[([-\w]*)\],.+$/$1/ and print'
11 package_info_load_version() {
12 grep AC_INIT configure.in | perl -ne 's/^.+\[([-\w\.]*)\],$/$1/ and print'
15 package_info_load() {
16 [ -f "configure.in" ] || \
17 die "package_info_load: configure.in is missing"
19 PACKAGE_NAME="$(package_info_load_name)"
20 # todo: fix this
21 PACKAGE_TARNAME="${PACKAGE_NAME}"
23 PACKAGE_VERSION="$(package_info_load_version)"
25 [ "${PACKAGE_NAME}" -a "${PACKAGE_VERSION}" ] || \
26 die "package information is missing from configure script"
28 PACKAGE_VERSION_TAGS=
29 [ "${PACKAGE_VERSION/-/}" = "${PACKAGE_VERSION}" ] || \
30 PACKAGE_VERSION_TAGS="-${PACKAGE_VERSION#*-}"
31 PACKAGE_VERSION_BASE="${PACKAGE_VERSION%%-*}"
32 PACKAGE_MICRO="${PACKAGE_VERSION_BASE##*.}"
33 PACKAGE_MAJOR_AND_MINOR="${PACKAGE_VERSION_BASE%.*}"
34 PACKAGE_MAJOR="${PACKAGE_MAJOR_AND_MINOR%.*}"
35 PACKAGE_MINOR="${PACKAGE_MAJOR_AND_MINOR#*.}"
37 [ "${RELEASE_FINAL}" ] \
38 && RELEASE_VERSION="${PACKAGE_VERSION_BASE}" \
39 || RELEASE_VERSION="${PACKAGE_VERSION/-dev/}"
40 PACKAGE_RELEASE="${PACKAGE_TARNAME}-${RELEASE_VERSION}"
41 PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
44 package_info_show() {
45 cat <<INFO
46 Name: ${PACKAGE_TARNAME}
47 Version: ${PACKAGE_VERSION}
48 Release: ${RELEASE_VERSION}
49 Number: ${PACKAGE_VERSION_BASE}
50 Series: ${PACKAGE_MAJOR_AND_MINOR}
51 Major: ${PACKAGE_MAJOR}
52 Minor: ${PACKAGE_MINOR}
53 Micro: ${PACKAGE_MICRO}
54 Tags: ${PACKAGE_VERSION_TAGS}
55 Full: ${PACKAGE_TARNAME}-${PACKAGE_VERSION_BASE}${PACKAGE_VERSION_TAGS}
56 Release: ${PACKAGE_RELEASE}
57 Type: ${RELEASE_TYPE}
58 INFO