summaryrefslogtreecommitdiffstats
path: root/doc/gen_known_issues.py
diff options
context:
space:
mode:
authorSona Sarmadi <sona.sarmadi@enea.com>2018-08-28 07:11:55 +0200
committerSona Sarmadi <sona.sarmadi@enea.com>2018-08-29 12:20:43 +0200
commita6d4e68bf121a3d0e1e626f4d288ad2b594947e2 (patch)
treeca5a1852672f31e3d9ae3eb86c499891bee6e80a /doc/gen_known_issues.py
parent77870b91014d5f28f2555149db1c8ef193f24f3b (diff)
downloadel_releases-rt-a6d4e68bf121a3d0e1e626f4d288ad2b594947e2.tar.gz
First draft of doc copied from standard profile
-updated rel-info -updated UG -added new chapterdoc for RT: Real-Time in Enea Linux Change-Id: If8cec0e29d1d6aa4a09507881d815af13dd68ee2 Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
Diffstat (limited to 'doc/gen_known_issues.py')
-rw-r--r--doc/gen_known_issues.py122
1 files changed, 122 insertions, 0 deletions
diff --git a/doc/gen_known_issues.py b/doc/gen_known_issues.py
new file mode 100644
index 0000000..f926f9f
--- /dev/null
+++ b/doc/gen_known_issues.py
@@ -0,0 +1,122 @@
1#!/usr/bin/python
2
3#------------------------------------------------------------------------------
4#
5# This script generates an XML file with a table with issues in Jira. See the
6# variable 'conditions' for query details. It is used bu the make system in
7# the generation of the release notes.
8#
9# The result is printed to STDOUT.
10#
11# It is possible to override the generation. If there is a file named
12# jiraissues_override.xml in the current directory, then that file will be
13# printed instead. This mechanism can be used if the table needs manual
14# modifications.
15#
16#------------------------------------------------------------------------------
17
18from subprocess import check_output
19import json, re, datetime
20import time
21
22try:
23 with open("book-enea-linux-release-info/doc/jiraissues_override.xml") as f:
24 print f.read(),
25
26 exit(0)
27
28except SystemExit:
29 # Printing the override file was successful. Exception raised by
30 # the exit() call in the try block.
31 exit(0)
32
33except IOError:
34 # Accessing the override file failed. Assume that it does not exist
35 # and proceed with normal operation.
36 pass
37
38jd = json.JSONDecoder()
39
40def jira_query(query):
41 jira_url = "http://eneaissues.enea.com"
42 fields = "key,summary"
43 query = query.replace(" ", "+")
44
45 cmd = ["curl",
46 "-s",
47 "-D-",
48 "-u", "rest_reader:jira123",
49 "-X", "GET",
50 "-H", "Content-Type: application/json",
51 jira_url + "/rest/api/2/search?jql=" + query + "&fields=" + fields
52 ]
53
54 tmp = check_output(cmd).splitlines()
55 tmp = jd.decode(tmp[-1])
56 return tmp["issues"]
57
58conditions = ("project=LXCR",
59 "issueType=bug",
60 "resolution=Unresolved",
61 'affectedversion="EL7_Std_ARM"'
62 )
63
64bugs = []
65
66time_str = time.strftime("%Y-%m-%d, %H:%M:%S (%Z)")
67
68for issue in jira_query(" and ".join(conditions)):
69 bugs.append((issue["key"], issue["fields"]["summary"]))
70
71print '<?xml version="1.0" encoding="ISO-8859-1"?>'
72print '<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"'
73print '"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">'
74print '<section id="relinfo_extracted_from_jira">'
75print ' <title>Extracted from Jira</title>'
76print
77print ' <para>'
78print ' In the table below are the issue(s) that currently affect this specific release. Use the ticket reference provided for each issue, to look up further information if needed. Extracted at %s.' % time_str
79print ' </para>'
80print
81print ' <remark>Jira query: (%s)</remark>' % "\n and ".join(conditions)
82print
83print ' <informaltable>'
84print ' <tgroup cols="2">'
85print ' <colspec colwidth="6*" colname="c1"/>'
86print
87print ' <colspec align="center" colwidth="1*" colname="c2"/>'
88print
89print ' <thead>'
90print ' <row>'
91print ' <entry align="center">Summary</entry>'
92print
93print ' <entry>Enea Ref</entry>'
94print ' </row>'
95print ' </thead>'
96print
97print ' <tbody>',
98
99if bugs:
100 for bug in sorted(bugs):
101 print
102 print ' <row>'
103 print ' <entry>%s</entry>' % bug[1]
104 print
105 print ' <entry>%s</entry>' % bug[0]
106 print ' </row>'
107
108else:
109 print ' <row>'
110 print ' <entry namest="c1" nameend="c2" align="center">'
111 print ' No issues found'
112 print ' </entry>'
113 print ' </row>'
114
115print ' </tbody>'
116print ' </tgroup>'
117print ' </informaltable>'
118
119if bugs:
120 print ' <para>Number of open bugs: %d</para>' % len(bugs)
121
122print '</section>'