summaryrefslogtreecommitdiff
path: root/bin/gen_changelog
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gen_changelog')
-rwxr-xr-xbin/gen_changelog45
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/gen_changelog b/bin/gen_changelog
new file mode 100755
index 0000000..8a25923
--- /dev/null
+++ b/bin/gen_changelog
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# This file is part of RTSAdmin Community Edition.
+# 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}')
+
+LAST_TAG=$(git tag | tail -1)
+if [ -z $LAST_TAG ]; then
+ LAST_TAG='0.0'
+fi
+
+COMMIT=$(git log ${LAST_TAG}..HEAD | head -1 | colrm 1 7 | colrm 8)
+TS=$(date +%Y%m%d%H%M%S)
+
+if [ -z $COMMIT ]; then
+ VERSION="${LAST_TAG}"
+else
+ VERSION="${LAST_TAG}-${TS}.${COMMIT}"
+fi
+
+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
+