[icinga-checkins] icinga.org: icinga2/master: Add the changelog.py script

git at icinga.org git at icinga.org
Thu Feb 12 15:52:25 CET 2015


Module: icinga2
Branch: master
Commit: 82e82b5dd8be62a03f07ba521de36ac94e10795a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=82e82b5dd8be62a03f07ba521de36ac94e10795a

Author: Gunnar Beutner <gunnar at beutner.name>
Date:   Thu Feb 12 15:52:06 2015 +0100

Add the changelog.py script

---

 INSTALL.md   |    2 +-
 changelog.py |   90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 1 deletion(-)

diff --git a/INSTALL.md b/INSTALL.md
index 9ef5c9f..950c0c1 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -77,7 +77,7 @@ Update the [.mailmap](.mailmap) and [AUTHORS](AUTHORS) files
 
 Bump the version in icinga2.spec.
 Update the [ChangeLog](ChangeLog), [doc/1-about.md](doc/1-about.md) and [INSTALL.md](INSTALL.md)
-files.
+files using the changelog.py script.
 Commit these changes to the "master" branch.
 
     $ git commit -v -a -m "Release version <VERSION>"
diff --git a/changelog.py b/changelog.py
new file mode 100755
index 0000000..ffdbd85
--- /dev/null
+++ b/changelog.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#/******************************************************************************
+# * Icinga 2                                                                   *
+# * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)    *
+# *                                                                            *
+# * This program is free software; you can redistribute it and/or              *
+# * modify it under the terms of the GNU General Public License                *
+# * as published by the Free Software Foundation; either version 2             *
+# * of the License, or (at your option) any later version.                     *
+# *                                                                            *
+# * 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 General Public License for more details.                               *
+# *                                                                            *
+# * You should have received a copy of the GNU General Public License          *
+# * along with this program; if not, write to the Free Software Foundation     *
+# * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
+# ******************************************************************************/
+
+import urllib2, json, sys
+
+if len(sys.argv) < 2:
+    print "Usage:", sys.argv[0], "<VERSION>"
+    sys.exit(0)
+
+version_name = sys.argv[1]
+
+rsp = urllib2.urlopen("https://dev.icinga.org/projects/i2/versions.json")
+versions_data = json.loads(rsp.read())
+
+version_id = None
+
+for version in versions_data["versions"]:
+    if version["name"] == version_name:
+        version_id = version["id"]
+
+if version_id == None:
+    print "Version '%s' not found." % (version_name)
+    sys.exit(1)
+
+print "### What's New in Version %s" % (version_name)
+print ""
+print "#### Changes"
+print ""
+print "TODO: Update this section."
+print ""
+print "#### Issues"
+print ""
+
+offset = 0
+
+log_entries = []
+
+while True:
+    # We could filter using &cf_13=1, however this doesn't currently work because the custom field isn't set
+    # for some of the older tickets:
+    rsp = urllib2.urlopen("https://dev.icinga.org/projects/i2/issues.json?offset=%d&status_id=closed&fixed_version_id=%d" % (offset, version_id))
+    issues_data = json.loads(rsp.read())
+    issues_count = len(issues_data["issues"])
+    offset = offset + issues_count
+
+    if issues_count == 0:
+        break
+
+    for issue in issues_data["issues"]:
+        ignore_issue = False
+
+        for field in issue["custom_fields"]:
+            if field["id"] == 13 and "value" in field and field["value"] == "0":
+                ignore_issue = True
+                break
+
+        if ignore_issue:
+            continue
+
+        log_entries.append((issue["tracker"]["name"], issue["id"], issue["subject"]))
+
+for p in range(2):
+    not_empty = False
+
+    for log_entry in sorted(log_entries):
+        if (p == 0 and log_entry[0] == "Feature") or (p == 1 and log_entry[0] != "Feature"):
+            print "* %s %d: %s" % log_entry
+            not_empty = True
+
+    if not_empty:
+        print ""
+
+sys.exit(0)



More information about the icinga-checkins mailing list