File: gennews.sh

package info (click to toggle)
icewm 1.3.8+mod+20161220-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 7,160 kB
  • ctags: 5,575
  • sloc: cpp: 48,848; ansic: 1,813; makefile: 1,129; sh: 339; xml: 48
file content (34 lines) | stat: -rwxr-xr-x 936 bytes parent folder | download
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
#!/bin/bash

# A little script to automagically generate a GNU NEWS file from git.

if [ -z "$PACKAGE" -a -f configure.ac ]; then
	PACKAGE=$(grep AC_INIT configure.ac|head -1|sed -r 's,AC_INIT[(][[],,;s,[]].*,,')
fi

t=
i=0

for o in $(git tag --sort=-creatordate) ""; do
	if [[ $((i++)) -ge 6 ]]; then break; fi
	if [ -z "$t" ] ; then
		head=$(git show -s --format=%H HEAD)
		last=$(git show -s --format=%H "$o")
		if [[ $head == $last ]]; then
			t="$o"
			continue
		fi
		t="HEAD"
		version=$(git describe --tags)
	else
		version="$t"
	fi
	version=$(echo "$version"|sed 's,^[^0-9]*,,;s,[-_],.,g;s,\.g.*$,,')
	date=$(git show -s --format=%ci "$t^{commit}"|awk '{print$1}')
	title="Release ${PACKAGE}${PACKAGE:+-}$version released $date"
	under=$(echo "$title"|sed 's,.,-,g')
	cmd="git shortlog -e -n -w80,6,8 ${o}${o:+...}${t}"
	echo -e "\n$title\n$under\n\n$cmd\n\n$(eval $cmd)\n"
	t="$o"
done|sed -r 's,[[:space:]][[:space:]]*$,,'