diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2015-04-23 16:18:00 +0200 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2015-04-23 16:18:00 +0200 |
commit | eb251652a2bf2f66d83fe9762108a1e3e4a2a163 (patch) | |
tree | d10cd62986b2a04cde37db2b3ef7d0f230af1aa4 | |
parent | 29496c697b0b949ed9e649fcf72a81c74f8ff49a (diff) | |
parent | 1886e9f4bf082dcf4609a449bf4f318a0e63595d (diff) |
Merge branch 'master' into trigger-api
-rw-r--r-- | app/utils/log_parser.py | 17 | ||||
-rw-r--r-- | app/utils/report/build.py | 45 | ||||
-rw-r--r-- | app/utils/report/templates/boot.html | 8 | ||||
-rw-r--r-- | app/utils/report/templates/build.html | 149 |
4 files changed, 177 insertions, 42 deletions
diff --git a/app/utils/log_parser.py b/app/utils/log_parser.py index 87cbf40..d862e37 100644 --- a/app/utils/log_parser.py +++ b/app/utils/log_parser.py @@ -342,6 +342,17 @@ def _parse_log(job, kernel, defconfig, log_file, build_dir): """ utils.LOG.info("Parsing build log file '%s'", log_file) + def _clean_path(line): + """Strip the beginning of the line if it contains a special sequence. + + :param line: The line to clean. + :type line: string + :return The line without the special sequence. + """ + if line.startswith("../"): + line = line[3:] + return line + errors = [] status = 200 @@ -366,7 +377,7 @@ def _parse_log(job, kernel, defconfig, log_file, build_dir): if re.search(err_pattrn, line): line = line.strip() has_err = True - err_append(line) + err_append(_clean_path(line)) break if not has_err: @@ -377,12 +388,12 @@ def _parse_log(job, kernel, defconfig, log_file, build_dir): else: has_warn = True line = line.strip() - warn_append(line) + warn_append(_clean_path(line)) if any([not has_err, not has_warn]): if re.search(MISMATCH_PATTERN, line): line = line.strip() - mismatch_append(line) + mismatch_append(_clean_path(line)) except IOError, ex: error = "Cannot open build log file for %s-%s-%s" utils.LOG.exception(ex) diff --git a/app/utils/report/build.py b/app/utils/report/build.py index 296cfd4..0e03690 100644 --- a/app/utils/report/build.py +++ b/app/utils/report/build.py @@ -56,6 +56,21 @@ MISM_LOG_URL = ( utils.BUILD_MISMATCHES_FILE) +# Other template strings. +DEFCONFIG_URL_HTML = u"<a href=\"{defconfig_url:s}\">{defconfig:s}</a>" +STATUS_HTML = ( + u"<a style=\"color: {red:s}\" href=\"{log_url:s}\">{status:s}</a>" +) +ERR_STR_HTML = ( + u"<a style=\"color: {red:s};\" href=\"{err_log_url:s}\">" + u"{err_string:s}</a>" +) +WARN_STR_HTML = ( + u"<a style=\"color: {yellow:s};\" href=\"{warn_log_url:s}\">" + u"{warn_string:s}</a>" +) + + # pylint: disable=too-many-locals # pylint: disable=star-args def create_build_report(job, @@ -463,11 +478,9 @@ def _parse_and_structure_results(**kwargs): subs["defconfig"] = struct[0] subs["status"] = struct[1] txt_str = G_(u"{defconfig:s}: {status:s}").format(**subs) - html_str = G_( - u"<a href=\"{defconfig_url:s}\">{defconfig:s}</a>: " - u"<a style=\"color: {red:s}\" " - u"href=\"{log_url:s}\">{status:s}</a>".format(**subs) - ).format(**subs) + html_str = ( + DEFCONFIG_URL_HTML.format(**subs).format(**subs), + STATUS_HTML.format(**subs).format(**subs)) failed_append((txt_str, html_str)) else: platforms["failed_data"] = None @@ -526,36 +539,28 @@ def _parse_and_structure_results(**kwargs): if all([err_numb > 0, warn_numb > 0]): txt_desc_str = G_( u"{err_string:s}, {warn_string:s}") - html_desc_str = G_( - u"<a style=\"color: {red:s};\" " - "href=\"{err_log_url:s}\">{err_string:s}</a>, " - "<a style=\"color: {yellow:s};\" " - "href=\"{warn_log_url:s}\">{warn_string:s}</a>" + html_desc_str = ( + ERR_STR_HTML.format(**subs).format(**subs), + WARN_STR_HTML.format(**subs).format(**subs) ) elif all([err_numb > 0, warn_numb == 0]): txt_desc_str = u"{err_string:s}" html_desc_str = ( - u"<a style=\"color: {red:s};\" " - "href=\"{err_log_url:s}\">{err_string:s}</a>") + ERR_STR_HTML.format(**subs).format(**subs), u"") elif all([err_numb == 0, warn_numb > 0]): txt_desc_str = u"{warn_string:s}" html_desc_str = ( - u"<a style=\"color: {yellow:s};\" " - "href=\"{warn_log_url:s}\">{warn_string:s}</a>") + u"", WARN_STR_HTML.format(**subs).format(**subs)) txt_desc_str = txt_desc_str.format(**subs) - html_desc_str = html_desc_str.format(**subs) - subs["txt_desc_str"] = txt_desc_str - subs["html_desc_str"] = html_desc_str txt_defconfig_str = ( G_(u"{defconfig:s}: {txt_desc_str:s}").format(**subs) ).format(**subs) html_defconfing_str = ( - u"<a href=\"{defconfig_url:s}\">{defconfig:s}</a>: " - u"{html_desc_str:s}".format(**subs) - ).format(**subs) + DEFCONFIG_URL_HTML.format(**subs).format(**subs), + html_desc_str) error_append((txt_defconfig_str, html_defconfing_str)) else: diff --git a/app/utils/report/templates/boot.html b/app/utils/report/templates/boot.html index 4eb2637..95befcc 100644 --- a/app/utils/report/templates/boot.html +++ b/app/utils/report/templates/boot.html @@ -5,7 +5,7 @@ <title>{{ subject_str }}</title> </head> <body> - <span style="font-weight: bold;">{{ subject_str }}</span> + <span><strong>{{ subject_str }}</strong></span> <br /> <table style="border: none; padding-top: 15px; padding-bottom: 15px;"> <tbody> @@ -27,7 +27,7 @@ <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> <tbody> {%- for summary in platforms.failed_data.summary.html %} - <tr><td>{{ summary }}</td></tr> + <tr><td><strong>{{ summary }}</strong></td></tr> {%- endfor %} <tr><td style="padding-bottom: 15px;"></td></tr> {%- for arch in platforms.failed_data.data %} @@ -50,7 +50,7 @@ <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> <tbody> {%- for summary in platforms.offline_data.summary.html %} - <tr><td>{{ summary }}</td></tr> + <tr><td><strong>{{ summary }}</strong></td></tr> {%- endfor %} <tr><td style="padding-bottom: 15px;"></td></tr> {%- for arch in platforms.offline_data.data %} @@ -73,7 +73,7 @@ <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> <tbody> {%- for summary in platforms.conflict_data.summary.html %} - <tr><td>{{ summary }}</td></tr> + <tr><td><strong>{{ summary }}</strong></td></tr> {%- endfor %} <tr><td style="padding-bottom: 15px;"></td></tr> {%- for arch in platforms.conflict_data.data %} diff --git a/app/utils/report/templates/build.html b/app/utils/report/templates/build.html index cdf6562..fb894b5 100644 --- a/app/utils/report/templates/build.html +++ b/app/utils/report/templates/build.html @@ -5,7 +5,7 @@ <title>{{ subject_str }}</title> </head> <body> - <span style="font-weight: bold;">{{ subject_str }}</span> + <span><strong>{{ subject_str }}</strong></span> <br /> <table style="border: none; padding-top: 15px; padding-bottom: 15px;"> <tbody> @@ -23,17 +23,19 @@ </table> {%- if platforms %} {%- if platforms.failed_data %} - <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> + <p style="padding-bottom: 10px;"> + {%- for summary in platforms.failed_data.summary.html %} + <strong>{{ summary }}</strong><br /> + {%- endfor %} + </p> + <table style="border: none; padding-bottom: 15px; padding-top: 5px; padding-left: 15px;"> <tbody> - {%- for summary in platforms.failed_data.summary.html %} - <tr><td>{{ summary }}</td></tr> - {%- endfor %} - <tr><td style="padding-bottom: 15px;"></td></tr> {%- for arch in platforms.failed_data.data %} - <tr><td>{{ arch }}</td></tr> + <tr><td colspan="2" align="left" style="padding-bottom: 5px;">{{ arch }}</td></tr> {%- for defconfig in platforms.failed_data.data[arch] %} <tr> - <td style="padding-left: 25px;">{{ defconfig[1] }}</td> + <td style="padding-left: 25px; padding-right: 5px;">{{ defconfig[1][0] }}</td> + <td align="center">{{ defconfig[1][1] }}</td> </tr> {%- endfor %}{# defconfig #} <tr><td style="padding-bottom: 7px;"></td></tr> @@ -42,17 +44,20 @@ </table> {%- endif %}{# end failed_data #} {%- if platforms.error_data %} - <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> + <p style="padding-bottom: 10px;"> + {%- for summary in platforms.error_data.summary.html %} + <strong>{{ summary }}</strong><br /> + {%- endfor %} + </p> + <table style="border: none; padding-bottom: 15px; padding-top: 5px; padding-left: 15px;"> <tbody> - {%- for summary in platforms.error_data.summary.html %} - <tr><td>{{ summary }}</td></tr> - {%- endfor %} - <tr><td style="padding-bottom: 15px;"></td></tr> {%- for arch in platforms.error_data.data %} - <tr><td style="padding-bottom: 15px;">{{ arch }}</td></tr> + <tr><td colspan="3" align="left" style="padding-bottom: 5px;">{{ arch }}</td></tr> {%- for defconfig in platforms.error_data.data[arch] %} <tr> - <td style="padding-left: 25px;">{{ defconfig[1] }}</td> + <td align="left" style="padding-left: 25px; padding-right: 5px;">{{ defconfig[1][0] }}</td> + <td align="right" style="padding-right: 5px;">{{ defconfig[1][1][0] }}</td> + <td align="right">{{ defconfig[1][1][1] }}</td> </tr> {%- endfor %}{# defconfig #} <tr><td style="padding-bottom: 7px;"></td></tr> @@ -61,6 +66,120 @@ </table> {%- endif %}{# end error_data #} {%- endif %}{# end platforms #} + {%- if errors_summary %} + {% if errors_summary.errors %} + <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> + <thead> + <tr> + <th style="padding-bottom: 10px;" colspan="2" align="left"> + Errors summary: + </th> + </tr> + </thead> + <tbody> + {%- for err in errors_summary.errors %} + <tr> + <td style="padding-left: 15px;" align="right">{{ err[0] }}</td> + <td style="padding-left: 10px;">{{ err[1] }}</td> + </tr> + {%- endfor %} + </tbody> + </table> + {%- endif %}{# end errors #} + {%- if errors_summary.warnings %} + <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> + <thead style="padding-bottom: 15px;"> + <tr> + <th style="padding-bottom: 10px;" colspan="2" align="left"> + Warnings summary: + </th> + </tr> + </thead> + <tbody> + {%- for warn in errors_summary.warnings %} + <tr> + <td style="padding-left: 15px;" align="right">{{ warn[0] }}</td> + <td style="padding-left: 10px;">{{ warn[1] }}</td> + </tr> + {%- endfor %} + </tbody> + </table> + {%- endif %}{# end warnings #} + {%- if errors_summary.mismatches %} + <table style="border: none; padding-bottom: 15px; padding-top: 5px;"> + <thead> + <tr> + <th style="padding-bottom: 10px;" colspan="2" align="left"> + Section mismatches summary: + </th> + </tr> + </thead> + <tbody> + {%- for mism in errors_summary.mismatches %} + <tr> + <td style="padding-left: 15px;" align="right">{{ mism[0] }}</td> + <td style="padding-left: 10px;">{{ mism[1] }}</td> + </tr> + {%- endfor %} + </tbody> + </table> + {%- endif %}{# end mismatches #} + {%- endif %}{# and errors summary #} + {%- if error_details %} + <p style="padding-bottom: 5px;"><strong>Detailed per-defconfig build reports:</strong></p> + {%- for d in error_details %} + {%- set errs = P_("{:d} error", "{:d} errors", d.errors_count).format(d.errors_count) %} + {%- set warns = P_("{:d} warning", "{:d} warnings", d.warnings_count).format(d.warnings_count) %} + {%- set mism = P_("{:d} section mismatch", "{:d} section mismatches", d.mismatches_count).format(d.mismatches_count) %} + <p> + {{ "<strong>{}</strong> — {}, {}, {}, {}".format(d.defconfig_full, d.status, errs, warns, mism) }} + </p> + {%- if d.errors %} + <table style="border: none; padding-bottom: 5px; padding-top: 3px; padding-left: 15px;"> + <thead> + <tr> + <th style="padding-bottom: 10px;" align="left">Errors:</th> + </tr> + </thead> + <tbody> + {%- for line in d.errors %} + <tr><td style="padding-left: 15px;">{{ line }}</td></tr> + {%- endfor %} + </tbody> + </table> + {%- endif %}{# end error lines #} + {%- if d.warnings %} + <table style="border: none; padding-bottom: 5px; padding-top: 3px; padding-left: 15px;"> + <thead> + <tr> + <th style="padding-bottom: 10px;" align="left">Warnings:</th> + </tr> + </thead> + <tbody> + {%- for line in d.warnings %} + <tr><td style="padding-left: 15px;">{{ line }}</td></tr> + {%- endfor %} + </tbody> + </table> + {%- endif %}{# end warning lines #} + {%- if d.mismatches %} + <table style="border: none; padding-bottom: 5px; padding-top: 3px; padding-left: 15px;"> + <thead> + <tr> + <th style="padding-bottom: 10px;" align="left"> + Section mismatches: + </th> + </tr> + </thead> + <tbody> + {%- for line in d.mismatches %} + <tr><td style="padding-left: 15px;">{{ line }}</td></tr> + {%- endfor %} + </tbody> + </table> + {%- endif %}{# end mismatch lines #} + {%- endfor %} + {%- endif %}{# end error_details #} {%- if info_email %} <footer> <p style="padding-top: 10px;"> |