generate-deb-changelog revision d65ee3a8
1#!/bin/bash
2SCRIPTDIR=$(dirname $0)
3CHANGELOG=${SCRIPTDIR}/../deb/debian/changelog
4DIST=unstable
5FIRST=1
6
7print_changelog_item() {
8    DATE=$(git log -1 --format=%cD ${TAG})
9    DEBFULLNAME=$(git log -1 --format=%an ${TAG})
10    DEBEMAIL=$(git log -1 --format=%ae ${TAG})
11
12    if [ ${FIRST} = 0 ]; then echo >> ${CHANGELOG}; fi
13    FIRST=0
14
15    echo "vpp-nsh-plugin (${VER}) ${DIST}; urgency=low" >> ${CHANGELOG}
16    echo >> ${CHANGELOG}
17    echo "${DESC}" >> ${CHANGELOG}
18    echo >> ${CHANGELOG}
19    echo " -- ${DEBFULLNAME} <${DEBEMAIL}>  ${DATE}" >> ${CHANGELOG}
20}
21
22VER=$(${SCRIPTDIR}/version)
23TAG=HEAD
24ADDS=$(echo ${VER} | sed -e 's/~.*//'| cut -s -d- -f2)
25
26rm -f ${CHANGELOG}
27
28if [ -n "${ADDS}" ]; then
29    DESC="  * includes ${ADDS} commits after $(echo ${VER}| cut -d- -f1) release"
30    print_changelog_item
31fi
32
33for TAG in $(git tag -l 'v[0-9][0-9].[0-9][0-9]' | sort -r ); do
34    VER=$(echo ${TAG}| sed -e 's/^v//')
35    DESC=$(git tag -l -n20 ${TAG} | tail -n+2 | sed -e 's/^ */  /')
36    print_changelog_item
37done
38