From patchwork Wed Jan 19 21:20:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 2688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8932C43217 for ; Wed, 19 Jan 2022 21:20:55 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.2874.1642627255393603090 for ; Wed, 19 Jan 2022 13:20:55 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0C3BCED1 for ; Wed, 19 Jan 2022 13:20:55 -0800 (PST) Received: from oss-tx204.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 915AF3F774 for ; Wed, 19 Jan 2022 13:20:54 -0800 (PST) From: Ross Burton To: meta-arm@lists.yoctoproject.org Subject: [PATCH 5/6] scripts/machine-summary: write per-machine reports with more details Date: Wed, 19 Jan 2022 21:20:49 +0000 Message-Id: <20220119212050.1886613-5-ross.burton@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220119212050.1886613-1-ross.burton@arm.com> References: <20220119212050.1886613-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 19 Jan 2022 21:20:55 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-arm/message/2874 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 --- 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 diff --git a/scripts/machine-summary-updates.html.jinja b/scripts/machine-summary-updates.html.jinja deleted file mode 100644 index d3ac2ff6..00000000 --- a/scripts/machine-summary-updates.html.jinja +++ /dev/null @@ -1,47 +0,0 @@ - - - - Pending Machine Upgrades Report - - - - -
-
-

Pending Machine Upgrades Report

-

Generated at {{ timestamp }}.

-
- - - - - - {% for recipe in recipes|sort %} - - {% endfor %} - - - - {% for machine, data in data|dictsort %} - - - {% for recipe in recipes|sort %} - {% if recipe in data %} - {% set details = data[recipe] %} - {% set is_old = details.version is old(details.upstream) %} - - {% else %} - - {% endif %} - {% endfor %} - - {% endfor %} - -
Machine{{ recipe }} ({{releases[recipe]|default("?")}})
{{ machine }} - {{ details.recipe if details.recipe != recipe}} - {{ details.version }} - {{ "(patched)" if details.patched }} - -
-
- - diff --git a/scripts/machine-summary.py b/scripts/machine-summary.py index 2fef8491..1f98f247 100755 --- a/scripts/machine-summary.py +++ b/scripts/machine-summary.py @@ -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") diff --git a/scripts/report-base.html.jinja b/scripts/report-base.html.jinja new file mode 100644 index 00000000..be081251 --- /dev/null +++ b/scripts/report-base.html.jinja @@ -0,0 +1,35 @@ + + + + {% block title %}{% endblock %} + + + + +
+ {# TODO use position: sticky to glue this to the top #} + + +
+ {% block content %}{% endblock %} +
+
+ +
+
+ Generated by machine-summary at {{ timestamp }}. +
+
+ + diff --git a/scripts/report-details.html.jinja b/scripts/report-details.html.jinja new file mode 100644 index 00000000..ba66fcf0 --- /dev/null +++ b/scripts/report-details.html.jinja @@ -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 %} + {{ status }} +{%- endmacro %} + +{% block content %} + + + {% for name, data in data|dictsort if data.needs_update or data.patched %} +

+ {{ data.recipe }} {{ data.fullversion }} + {% if name != data.recipe %} + (provides {{ name }}) + {% endif %} + {% if data.needs_update %}Upgrade Needed{% endif %} + # +

+ + {% if data.needs_update %} +

+ Recipe is version {{ data.fullversion }}, latest upstream release is {{ data.upstream }}. +

+ {% endif%} + + {% if data.patched %} + + + + + + + + + + {% for pinfo in data.patches %} + + + + + + + + {% endfor %} + +
PatchLayerStatus
{{ pinfo.name }}{{ pinfo.layer }}{{ make_patch_tag(pinfo.status)}}
+ {% endif %} + {% endfor %} +{% endblock %} diff --git a/scripts/report-index.html.jinja b/scripts/report-index.html.jinja new file mode 100644 index 00000000..3e39174f --- /dev/null +++ b/scripts/report-index.html.jinja @@ -0,0 +1,44 @@ +{% extends "report-base.html.jinja" %} +{% block title %}Recipe Report{% endblock %} + +{% block content %} + + + + + {% for recipe in recipes|sort %} + + {% endfor %} + + + + {% for machine, data in data|dictsort %} + + + {% for recipe in recipes|sort %} + {% if recipe in data %} + {% set details = data[recipe] %} + + {% else %} + + {% endif %} + {% endfor %} + + {% endfor %} + +
Machine{{ recipe }} ({{releases[recipe]|default("?")}})
{{ machine }} + + {{ details.recipe if details.recipe != recipe}} + {{ details.version }} + + {% if details.patches or details.needs_update %} +
+ {% if details.patches %} + Patched + {% endif %} + {% if details.needs_update %} + Upgrade + {% endif %} + {% endif %} +
-
+{% endblock %}