Add RFC5424 syslog protocol support (VPP-1139)
[vpp.git] / build-root / scripts / generate-deb-changelog
1 #!/bin/bash
2
3 # Copyright (c) 2015 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 CHANGELOG=deb/debian/changelog
17 DIST=unstable
18 FIRST=1
19
20 print_changelog_item() {
21         DATE=$(git log -1 --format=%cD ${TAG})
22         DEBFULLNAME=$(git log -1 --format=%an ${TAG})
23         DEBEMAIL=$(git log -1 --format=%ae ${TAG})
24
25         if [ ${FIRST} = 0 ]; then echo >> ${CHANGELOG}; fi
26         FIRST=0
27
28         echo "vpp (${VER}) ${DIST}; urgency=low" >> ${CHANGELOG}
29         echo >> ${CHANGELOG}
30         echo "${DESC}" >> ${CHANGELOG}
31         echo >> ${CHANGELOG}
32         echo " -- ${DEBFULLNAME} <${DEBEMAIL}>  ${DATE}" >> ${CHANGELOG}
33 }
34
35 VER=$(scripts/version)
36 TAG=HEAD
37 ADDS=$(echo ${VER} | sed -e 's/~.*//'| cut -s -d- -f2)
38
39 rm -f ${CHANGELOG}
40
41 if [ -n "${ADDS}" ]; then
42         DESC="  * includes ${ADDS} commits after $(echo ${VER}| cut -d- -f1) release"
43         print_changelog_item
44 fi
45
46 for TAG in $(git tag -l 'v[0-9][0-9].[0-9][0-9]' | sort -r ); do
47         VER=$(echo ${TAG}| sed -e 's/^v//')
48         DESC=$(git tag -l -n20 ${TAG} | tail -n+2 | sed -e 's/^ */  /')
49         print_changelog_item
50 done