summaryrefslogtreecommitdiff
path: root/tsp/scripts
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-07-22 15:42:40 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2016-11-08 15:08:39 (GMT)
commit035a0210950a9125b1adbb0396de8ecbe02644bc (patch)
treecf42b6b69b86a580d85cbcc66aef9a795f7ebbcf /tsp/scripts
parentd4307f5daf6018fa1508ba8664c6a6b570b118de (diff)
downloadmajor-035a0210950a9125b1adbb0396de8ecbe02644bc.zip
major-035a0210950a9125b1adbb0396de8ecbe02644bc.tar.gz
major-035a0210950a9125b1adbb0396de8ecbe02644bc.tar.bz2
Add tsp/scripts/publish.pyrefs/changes/37/81337/9
This script requires jinja2 templating library. Change-Id: Icd30ab726bc98a7e6556363c4a3bf8eccbdfa7a7 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/scripts')
-rwxr-xr-xtsp/scripts/publish.py82
1 files changed, 82 insertions, 0 deletions
diff --git a/tsp/scripts/publish.py b/tsp/scripts/publish.py
new file mode 100755
index 0000000..2ea2c77
--- /dev/null
+++ b/tsp/scripts/publish.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##
+# @author Aleksander Mistewicz <a.mistewicz@samsung.com>
+
+import argparse
+import sqlite3
+import jinja2
+
+__version__ = "0.0.1"
+__license__ = "APACHE-2.0"
+__author__ = "Aleksander Mistewicz"
+__author_email__ = "a.mistewicz@samsung.com"
+
+USAGE = "%prog <db>"
+
+AGENT = "%s/%s" % (__name__, __version__)
+
+def print_head(row):
+ template = jinja2.Template('<tr>\n\
+{% for item in row %}<th>{{ item }}</th>\n{% endfor %}\
+</tr>\n')
+ print template.render(row=row)
+
+def print_row(row):
+ build_nr=str(row[2])
+ template = jinja2.Template('<tr>\n\
+<td> <a href=\"../dwn/{{ build_nr }}\">{{ sr }}</a> </td>\n\
+{% for item in row %}\
+<td> {{ item }} </td>\n\
+{% endfor %}\
+<td>\
+{% if status != \'Identical\' %}\
+ <a href=\"../img_test/{{ build_nr }}/sysctl.result\">{{ status }}</a>\
+{% else %}\
+ {{ status }} \
+{% endif %}\
+</td>\n\
+</tr>\n')
+ print template.render(build_nr=build_nr, sr=row[0], row=[row[1], build_nr, row[3]], status=row[4])
+
+def print_view(dbpath):
+ conn = sqlite3.connect(dbpath)
+ column_names = ["SR", "Date", "\"Build nr\"", "Device", "Status"]
+ print_head(column_names)
+ testresults = conn.execute("SELECT " + ', '.join(column_names) + " FROM currentstatus;")
+ for row in testresults:
+ print_row(row)
+ conn.close()
+
+def parse_arguments():
+ parser = argparse.ArgumentParser(description="HTML view generatator for results.db3")
+
+ parser.add_argument("db3", metavar='<db>', type=str,
+ help='database path')
+
+ args = parser.parse_args()
+
+ return args
+
+def main():
+ args = parse_arguments()
+ if args.db3:
+ print_view(args.db3)
+
+if __name__ == '__main__':
+ main()