summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-10-22 01:38:22 -0700
committerZachary T Welch <zw@superlucidity.net>2009-10-27 23:20:24 -0700
commitc970d03ddb7084713533c935864df18a6828d21a (patch)
tree9010b72ce3ffc1800e68935c37a1bbe1b0610b77 /tools
parenteb9790dc91bd2d46c480277b1f275ba2d6e1ca3f (diff)
downloadopenocd+libswd-c970d03ddb7084713533c935864df18a6828d21a.tar.gz
openocd+libswd-c970d03ddb7084713533c935864df18a6828d21a.tar.bz2
openocd+libswd-c970d03ddb7084713533c935864df18a6828d21a.tar.xz
openocd+libswd-c970d03ddb7084713533c935864df18a6828d21a.zip
Factor release version functions into new script.
Diffstat (limited to 'tools')
-rw-r--r--tools/release/helpers.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/release/helpers.sh b/tools/release/helpers.sh
new file mode 100644
index 00000000..2dd5bae1
--- /dev/null
+++ b/tools/release/helpers.sh
@@ -0,0 +1,60 @@
+#!/bin/sh -e
+
+die() {
+ echo "$@" >&2
+ exit 1
+}
+
+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)"
+
+ [ "${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#*.}"
+
+ [ "${RELEASE_FINAL}" ] \
+ && RELEASE_VERSION="${PACKAGE_VERSION_BASE}" \
+ || RELEASE_VERSION="${PACKAGE_VERSION/-dev/}"
+ PACKAGE_RELEASE="${PACKAGE_TARNAME}-${RELEASE_VERSION}"
+ PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
+}
+
+package_info_show() {
+ cat <<INFO
+Name: ${PACKAGE_TARNAME}
+Version: ${PACKAGE_VERSION}
+Release: ${RELEASE_VERSION}
+ Number: ${PACKAGE_VERSION_BASE}
+ Series: ${PACKAGE_MAJOR_AND_MINOR}
+ Major: ${PACKAGE_MAJOR}
+ Minor: ${PACKAGE_MINOR}
+ Micro: ${PACKAGE_MICRO}
+ Tags: ${PACKAGE_VERSION_TAGS}
+ Full: ${PACKAGE_TARNAME}-${PACKAGE_VERSION_BASE}${PACKAGE_VERSION_TAGS}
+Release: ${PACKAGE_RELEASE}
+ Type: ${RELEASE_TYPE}
+INFO
+}
+