summaryrefslogtreecommitdiff
path: root/bin/gen_changelog
blob: 91ef1582047ba4f8c547196cd775396581a04270 (plain)
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
35
36
37
#!/bin/bash

# This file is part of targetcli.
# Copyright (c) 2011 by RisingTide Systems LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, version 3 (AGPLv3).
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

NAME=$(git config --get user.name)
EMAIL=$(git config --get user.email)
DATE=$(date +'%a, %d %b %Y %H:%M:%S %z')

SRCPKG=$(cat debian/control | grep ^Source | awk '{print $2}')
VERSION=$(basename $(git describe --tags | tr - .))

sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" ${SRCPKG}/__init__.py

echo "${SRCPKG} (${VERSION}) unstable; urgency=low" > debian/changelog
echo >> debian/changelog
echo "  * Generated package." >> debian/changelog
echo >> debian/changelog
echo " -- ${NAME} <${EMAIL}>  ${DATE}" >> debian/changelog

RH_SPEC="redhat/targetcli.spec"
cp redhat/targetcli.spec.tmpl $RH_SPEC
sed -i "s/Version:\( *\).*/Version:\1${VERSION}/g" $RH_SPEC
echo "* $(date +'%a %b %d %Y') ${NAME} <${EMAIL}> - ${VERSION}" >> $RH_SPEC
echo "- Generated package." >> $RH_SPEC