aboutsummaryrefslogtreecommitdiffstats
path: root/mk/changelog
diff options
context:
space:
mode:
authorLibravatarLibravatar William Ahern <william@solaris.(none)> 2013-12-10 16:20:49 -0800
committerLibravatarLibravatar William Ahern <william@solaris.(none)> 2013-12-10 16:20:49 -0800
commit864c08cc3e75442443d3492cf3084b704ef5af70 (patch)
tree6c11c7845a8f68abfeceb7efe9f846543321bfea /mk/changelog
parente3ec2e4f949267ca48fe9fe983dd00f41010c2a8 (diff)
downloadluaossl-864c08cc3e75442443d3492cf3084b704ef5af70.tar.gz
luaossl-864c08cc3e75442443d3492cf3084b704ef5af70.tar.bz2
luaossl-864c08cc3e75442443d3492cf3084b704ef5af70.zip
forgot to add changelog script
Diffstat (limited to 'mk/changelog')
-rwxr-xr-xmk/changelog92
1 files changed, 92 insertions, 0 deletions
diff --git a/mk/changelog b/mk/changelog
new file mode 100755
index 0000000..34c466e
--- /dev/null
+++ b/mk/changelog
@@ -0,0 +1,92 @@
+#!/bin/sh
+set -e # strict errors
+set -u # don't expand unbound variables
+set -f # disable pathname expansion
+set -C # noclobber
+\unalias -a # no command surprises
+export LC_ALL=C # no locale headaches
+unset IFS # no field splitting surprises
+
+
+RELPATH=${0%/*}
+: RELPATH=${RELPATH:-.}
+
+CHANGELOG=${RELPATH}/../debian/changelog
+ROOTDIR=${RELPATH}/..
+
+GIT="$(command -v git)"
+
+
+changelog() {
+ if [ ! -f ${CHANGELOG} ]; then
+ printf -- "${CHANGELOG}: No such file\n" >&2
+ exit 1
+ fi
+
+ cat ${CHANGELOG}
+}
+
+
+usage() {
+ cat <<-EOF
+ usage: ${0##*/} [-h] version|author|commit
+ -h print this usage message
+
+ version most recent package version number
+ author author of most recent log message
+ commit Git hash of most recent commit
+
+ Report bugs to <william@25thandClement.com>
+ EOF
+}
+
+while getopts h OPT; do
+ case "${OPT}" in
+ h)
+ usage
+ exit 0
+ ;;
+ *)
+ usage >&2
+ exit 1
+ ;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+
+
+case "${1:-version}" in
+version)
+ changelog | sed -ne '
+ s/.*(\([1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*).*/\1/
+ t Found
+ d
+ :Found
+ p
+ q
+ '
+ ;;
+author)
+ changelog | sed -ne '
+ s/.*<\([^>]*@[^>]*\)>.*/\1/
+ t Found
+ d
+ :Found
+ p
+ q
+ '
+ ;;
+commit)
+ test -n "${GIT}" -a -d ${ROOTDIR}/.git || exit 1
+
+ cd ${ROOTDIR}
+ ${GIT} show --pretty='%H' HEAD 2>/dev/null | sed -n '1p'
+ ;;
+*)
+ usage >&2
+ exit 1
+ ;;
+esac
+
+exit 0