summaryrefslogtreecommitdiffstats
path: root/tools/release_notes.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 13:16:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 13:16:35 +0000
commite2bbf175a2184bd76f6c54ccf8456babeb1a46fc (patch)
treef0b76550d6e6f500ada964a3a4ee933a45e5a6f1 /tools/release_notes.py
parentInitial commit. (diff)
downloadfrr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.tar.xz
frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.zip
Adding upstream version 9.1.upstream/9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/release_notes.py')
-rwxr-xr-xtools/release_notes.py94
1 files changed, 94 insertions, 0 deletions
diff --git a/tools/release_notes.py b/tools/release_notes.py
new file mode 100755
index 0000000..973215b
--- /dev/null
+++ b/tools/release_notes.py
@@ -0,0 +1,94 @@
+#!/usr/bin/python3
+#
+# 2021 Jafar Al-Gharaibeh, ATCorp
+#
+# Generate a draft FRR release notes
+#
+
+import sys
+import os
+import getopt
+import subprocess
+
+
+def run(cmd):
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ rv = proc.communicate("")[0].decode("UTF-8")
+ proc.wait()
+ return rv
+
+
+def usage(n):
+ print(os.path.basename(__file__), " [-b <branch>] [-t <tag> ]")
+ print(" Generate one line logs for non merge commits")
+ print(" -branch: branch name to use, default to HEAD")
+ print(" -tag : generate logs up to this tag, default to latest tag")
+ sys.exit(n)
+
+
+def main(argv):
+ branch = tag = None
+ try:
+ opts, args = getopt.getopt(argv, "hb:t:", ["branch=", "tag="])
+ except getopt.GetoptError:
+ usage(2)
+ for opt, arg in opts:
+ if opt == "-h":
+ usage(0)
+ elif opt in ("-b", "--branch"):
+ branch = arg
+ elif opt in ("-t", "--tag"):
+ tag = arg
+
+ if branch is None:
+ branch = "HEAD"
+ if tag is None:
+ tag = run(["git", "describe", "--abbrev=0"]).strip("\n")
+
+ chnglog = run(
+ ["git", "log", "--no-merges", "--pretty=format:'%s'", tag + ".." + branch]
+ )
+ chnglog = chnglog.split("\n")
+
+ chnglist = []
+ daemons = [
+ "babel",
+ "bgp",
+ "eigrp",
+ "nhrp",
+ "ospf",
+ "ospf6",
+ "pbr",
+ "pim",
+ "rip",
+ "ripng",
+ "sharp",
+ "vrrp",
+ "zebra",
+ ]
+
+ for line in chnglog:
+ line = line.strip("'")
+ colon = line.partition(":")
+ label = colon[0].strip().lower()
+ if label in daemons:
+ label = label + "d"
+ comment = colon[2].strip().capitalize()
+ chnglist.append(label + ":" + comment)
+
+ chnglist.sort()
+ lastlabel = ""
+ for line in chnglist:
+ colon = line.partition(":")
+ label = colon[0]
+ comment = colon[2]
+ if label != lastlabel:
+ print("")
+ print(label)
+ lastlabel = label
+
+ print(" ", comment)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])