summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorWilliam Ahern <william@solaris.(none)>2013-12-10 16:20:49 -0800
committerWilliam Ahern <william@solaris.(none)>2013-12-10 16:20:49 -0800
commit864c08cc3e75442443d3492cf3084b704ef5af70 (patch)
tree6c11c7845a8f68abfeceb7efe9f846543321bfea /mk
parente3ec2e4f949267ca48fe9fe983dd00f41010c2a8 (diff)
downloadluaossl-864c08cc3e75442443d3492cf3084b704ef5af70.tar.gz
luaossl-864c08cc3e75442443d3492cf3084b704ef5af70.tar.bz2
luaossl-864c08cc3e75442443d3492cf3084b704ef5af70.zip
forgot to add changelog script
Diffstat (limited to 'mk')
-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 @@
1#!/bin/sh
2set -e # strict errors
3set -u # don't expand unbound variables
4set -f # disable pathname expansion
5set -C # noclobber
6\unalias -a # no command surprises
7export LC_ALL=C # no locale headaches
8unset IFS # no field splitting surprises
9
10
11RELPATH=${0%/*}
12: RELPATH=${RELPATH:-.}
13
14CHANGELOG=${RELPATH}/../debian/changelog
15ROOTDIR=${RELPATH}/..
16
17GIT="$(command -v git)"
18
19
20changelog() {
21 if [ ! -f ${CHANGELOG} ]; then
22 printf -- "${CHANGELOG}: No such file\n" >&2
23 exit 1
24 fi
25
26 cat ${CHANGELOG}
27}
28
29
30usage() {
31 cat <<-EOF
32 usage: ${0##*/} [-h] version|author|commit
33 -h print this usage message
34
35 version most recent package version number
36 author author of most recent log message
37 commit Git hash of most recent commit
38
39 Report bugs to <william@25thandClement.com>
40 EOF
41}
42
43while getopts h OPT; do
44 case "${OPT}" in
45 h)
46 usage
47 exit 0
48 ;;
49 *)
50 usage >&2
51 exit 1
52 ;;
53 esac
54done
55
56shift $(($OPTIND - 1))
57
58
59case "${1:-version}" in
60version)
61 changelog | sed -ne '
62 s/.*(\([1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*).*/\1/
63 t Found
64 d
65 :Found
66 p
67 q
68 '
69 ;;
70author)
71 changelog | sed -ne '
72 s/.*<\([^>]*@[^>]*\)>.*/\1/
73 t Found
74 d
75 :Found
76 p
77 q
78 '
79 ;;
80commit)
81 test -n "${GIT}" -a -d ${ROOTDIR}/.git || exit 1
82
83 cd ${ROOTDIR}
84 ${GIT} show --pretty='%H' HEAD 2>/dev/null | sed -n '1p'
85 ;;
86*)
87 usage >&2
88 exit 1
89 ;;
90esac
91
92exit 0