deleted file mode 100644
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Pending Machine Upgrades Report</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
- </head>
- <body>
- <section class="section">
- <div class="content">
- <h1 class="title">Pending Machine Upgrades Report</h1>
- <p>Generated at {{ timestamp }}.</p>
- </div>
-
- <table class="table is-striped">
- <thead>
- <tr>
- <th>Machine</th>
- {% for recipe in recipes|sort %}
- <th>{{ recipe }} ({{releases[recipe]|default("?")}})</th>
- {% endfor %}
- </tr>
- </thead>
- <tbody>
- {% for machine, data in data|dictsort %}
- <tr>
- <th>{{ machine }}</th>
- {% for recipe in recipes|sort %}
- {% if recipe in data %}
- {% set details = data[recipe] %}
- {% set is_old = details.version is old(details.upstream) %}
- <td class="{% if is_old %}has-text-weight-bold{% endif %}">
- {{ details.recipe if details.recipe != recipe}}
- {{ details.version }}
- {{ "(patched)" if details.patched }}
- </td>
- {% else %}
- <td>-</td>
- {% endif %}
- {% endfor %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </section>
- </body>
-</html>
@@ -167,7 +167,26 @@ class TextOverview(Format):
name = "overview.txt"
class HtmlUpdates(Format):
- name = "updates.html"
+ name = "report"
+
+ def render(self, context, output: pathlib.Path):
+ if output.exists() and not output.is_dir():
+ print(f"{output} is not a directory", file=sys.stderr)
+ sys.exit(1)
+
+ if not output.exists():
+ output.mkdir(parents=True)
+
+ with open(output / "index.html", "wt") as f:
+ f.write(self.get_template(f"report-index.html.jinja").render(context))
+
+ subcontext = context.copy()
+ del subcontext["data"]
+ for machine, subdata in context["data"].items():
+ subcontext["machine"] = machine
+ subcontext["data"] = subdata
+ with open(output / f"{machine}.html", "wt") as f:
+ f.write(self.get_template(f"report-details.html.jinja").render(subcontext))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="machine-summary")
new file mode 100644
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>{% block title %}{% endblock %}</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
+ </head>
+ <body>
+ <section class="section">
+ {# TODO use position: sticky to glue this to the top #}
+ <nav class="breadcrumb is-large">
+ <ul>
+ <li class="{{ "is-active" if machine is undefined }}">
+ <a href="index.html">Recipe Report</a>
+ </li>
+ {% if machine is defined %}
+ <li class="is-active">
+ <a href="#">{{machine}}</a>
+ </li>
+ {% endif %}
+ </ul>
+ </nav>
+
+ <div class="content">
+ {% block content %}{% endblock %}
+ </div>
+ </section>
+
+ <footer class="footer">
+ <div class="content has-text-centered">
+ Generated by <code>machine-summary</code> at {{ timestamp }}.
+ </div>
+ </footer>
+ </body>
+</html>
new file mode 100644
@@ -0,0 +1,61 @@
+{% extends "report-base.html.jinja" %}
+{% block title %}Recipe Report for {{ machine }}{% endblock %}
+
+{# Write a tag element using the Upstream-Status to determine the class. #}
+{% macro make_patch_tag(status) -%}
+ {% set status = status.split()[0] %}
+ {% if status in ("Unknown", "Pending") %}
+ {% set class = "is-danger" %}
+ {% elif status in ("Backport", "Accepted", "Inappropriate") %}
+ {% set class = "is-success" %}
+ {% elif status in ("Submitted", "Denied") %}
+ {% set class = "is-info" %}
+ {% else %}
+ {% set class = "is-info" %}
+ {% endif %}
+ <span class="tag {{ class }}">{{ status }}</span>
+{%- endmacro %}
+
+{% block content %}
+ <!-- TODO table of contents -->
+
+ {% for name, data in data|dictsort if data.needs_update or data.patched %}
+ <h2 class="title is-4">
+ {{ data.recipe }} {{ data.fullversion }}
+ {% if name != data.recipe %}
+ (provides {{ name }})
+ {% endif %}
+ {% if data.needs_update %}<span class="tag is-danger">Upgrade Needed</span>{% endif %}
+ <a id="recipe-{{ data.recipe }}" class="has-text-grey-lighter">#</a>
+ </h2>
+
+ {% if data.needs_update %}
+ <p>
+ Recipe is version {{ data.fullversion }}, latest upstream release is <strong>{{ data.upstream }}</strong>.
+ </p>
+ {% endif%}
+
+ {% if data.patched %}
+ <table class="table is-striped is-bordered">
+ <thead>
+ <tr>
+ <th>Patch</th>
+ <th style="width: 20em">Layer</th>
+ <th style="width: 10em">Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for pinfo in data.patches %}
+ <tr>
+ <!-- TODO links to cgit -->
+ <td>{{ pinfo.name }}</td>
+ <td>{{ pinfo.layer }}</td>
+ <!-- TODO: tooltip with full status? -->
+ <td class="has-text-centered">{{ make_patch_tag(pinfo.status)}}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endif %}
+ {% endfor %}
+{% endblock %}
new file mode 100644
@@ -0,0 +1,44 @@
+{% extends "report-base.html.jinja" %}
+{% block title %}Recipe Report{% endblock %}
+
+{% block content %}
+ <table class="table is-striped">
+ <thead>
+ <tr>
+ <th>Machine</th>
+ {% for recipe in recipes|sort %}
+ <th>{{ recipe }} ({{releases[recipe]|default("?")}})</th>
+ {% endfor %}
+ </tr>
+ </thead>
+ <tbody>
+ {% for machine, data in data|dictsort %}
+ <tr>
+ <th><a href="{{machine}}.html">{{ machine }}</a></th>
+ {% for recipe in recipes|sort %}
+ {% if recipe in data %}
+ {% set details = data[recipe] %}
+ <td style="text-align: center">
+ <a href="{{machine}}.html#recipe-{{details.recipe}}">
+ {{ details.recipe if details.recipe != recipe}}
+ {{ details.version }}
+ </a>
+ {% if details.patches or details.needs_update %}
+ <br>
+ {% if details.patches %}
+ <span class="tag is-info">Patched</span>
+ {% endif %}
+ {% if details.needs_update %}
+ <span class="tag is-danger">Upgrade</span>
+ {% endif %}
+ {% endif %}
+ </td>
+ {% else %}
+ <td>-</td>
+ {% endif %}
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+{% endblock %}
Rename the updates.html format to just 'report'. This report has the existing overview as the index.html, and then per-machine files are written with the patch breakdown. Signed-off-by: Ross Burton <ross.burton@arm.com> --- scripts/machine-summary-updates.html.jinja | 47 ----------------- scripts/machine-summary.py | 21 +++++++- scripts/report-base.html.jinja | 35 +++++++++++++ scripts/report-details.html.jinja | 61 ++++++++++++++++++++++ scripts/report-index.html.jinja | 44 ++++++++++++++++ 5 files changed, 160 insertions(+), 48 deletions(-) delete mode 100644 scripts/machine-summary-updates.html.jinja create mode 100644 scripts/report-base.html.jinja create mode 100644 scripts/report-details.html.jinja create mode 100644 scripts/report-index.html.jinja