From bfdeb85104770527eb455712ab2ca65730d722fd Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 22 Apr 2025 12:26:20 +0200 Subject: Add simple http server allowing to browse an invocation-log directory Being able to browse through past invocations of the build tool can actually be useful and doing so in the browser is a way many users prefer. Therefore, add a small WSGI application (written in python, using werkzeug and jinja) serving a directory of invocation logs via http. --- doc/invocations-http-server/templates/base.html | 13 +++ doc/invocations-http-server/templates/blob.html | 10 ++ doc/invocations-http-server/templates/failure.html | 24 ++++ .../templates/invocation.html | 130 +++++++++++++++++++++ .../templates/invocations.html | 35 ++++++ doc/invocations-http-server/templates/tree.html | 14 +++ 6 files changed, 226 insertions(+) create mode 100644 doc/invocations-http-server/templates/base.html create mode 100644 doc/invocations-http-server/templates/blob.html create mode 100644 doc/invocations-http-server/templates/failure.html create mode 100644 doc/invocations-http-server/templates/invocation.html create mode 100644 doc/invocations-http-server/templates/invocations.html create mode 100644 doc/invocations-http-server/templates/tree.html (limited to 'doc/invocations-http-server/templates') diff --git a/doc/invocations-http-server/templates/base.html b/doc/invocations-http-server/templates/base.html new file mode 100644 index 00000000..cf591652 --- /dev/null +++ b/doc/invocations-http-server/templates/base.html @@ -0,0 +1,13 @@ + + + + + {% block heading %}Invocation Browser{% endblock %} + + + + {% block content %} + (no content) + {% endblock %} + + diff --git a/doc/invocations-http-server/templates/blob.html b/doc/invocations-http-server/templates/blob.html new file mode 100644 index 00000000..2a64d064 --- /dev/null +++ b/doc/invocations-http-server/templates/blob.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% block heading %} +Blob {{ name | e }} +{% endblock %} + +{% block content %} +

Blob {{ name | e }}

+ +
{{ data | e}}
+{% endblock %} diff --git a/doc/invocations-http-server/templates/failure.html b/doc/invocations-http-server/templates/failure.html new file mode 100644 index 00000000..30892281 --- /dev/null +++ b/doc/invocations-http-server/templates/failure.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} +{% block heading %} +Failure calling an external process +{% endblock %} + +{% block content %} +

Failure calling an external process

+ + +{% endblock %} diff --git a/doc/invocations-http-server/templates/invocation.html b/doc/invocations-http-server/templates/invocation.html new file mode 100644 index 00000000..7fec7e6e --- /dev/null +++ b/doc/invocations-http-server/templates/invocation.html @@ -0,0 +1,130 @@ +{% extends "base.html" %} +{% block heading %} +Inocations {{invocation | e}} +{% endblock %} + +{% macro show_action(action) %} +
  • +
    + + {{ action["name_prefix"] | e }} {{ action["name"] | e}} + {% if action["may_fail"] %} + {% if action["exit_code"] != 0 %} + failure: {{ action["may_fail"] }} + {% else %} + tainted ({{ action["may_fail"] }}) + {% endif %} + {% elif action["primary_output"] %} + {% if action["exit_code"] != 0 %} + failed to build: {{ action["primary_output"] | e }} + {% else %} + build: {{ action["primary_output"] | e }} + {% endif %} + {% endif %} + +
      + {% if action["stdout"] %} +
    • stdout: {{action["stdout"] | e }}
    • + {% endif %} + {% if action["stderr"] %} +
    • stderr: {{action["stderr"] | e }}
    • + {% endif %} + {% if action["origins"] %} +
    • origins +
        + {% for origin in action["origins"] %} +
      • {{ origin | e }}
      • + {% endfor %} +
      +
    • + {% endif %} + {% if action["exit_code"] != 0 %} +
    • exit code: {{ action["exit_code"] }}
    • + {% endif %} + {% if action["output"] %} +
    • output +
        + {% for out in action["output"] %} + {% if action["artifacts"].get(out) %} +
      • {{ out | e }}
      • + {% else %} +
      • {{ out | e }}
      • + {% endif %} + {% endfor %} +
      +
    • + {% endif %} + {% if action["output_dirs"] %} +
    • output directories +
        + {% for out in action["output_dirs"] %} + {% if action["artifacts"].get(out) %} +
      • {{ out | e }}
      • + {% else %} +
      • {{ out | e }}
      • + {% endif %} + {% endfor %} +
      +
    • + {% endif %} +
    +
    +
  • +{% endmacro %} + +{% block content %} +

    Invocation {{invocation | e}}

    + +

    Overview

    + + +

    Failed actions

    +{% if failed_actions %} + +{% else %} +(none) +{% endif %} + + +

    Remaining non-cached actions

    +{% if non_cached %} +In order of decreasing run time. + +{% else %} +(none) +{% endif %} + + + +{% endblock %} diff --git a/doc/invocations-http-server/templates/invocations.html b/doc/invocations-http-server/templates/invocations.html new file mode 100644 index 00000000..bab67cd3 --- /dev/null +++ b/doc/invocations-http-server/templates/invocations.html @@ -0,0 +1,35 @@ +{% extends "base.html" %} +{% block heading %} +Recent Invocations +{% endblock %} + +{% block content %} +

    Recent Invocations

    +{% if invocations %} + +{% else %} +(none) +{% endif %} +{% endblock %} diff --git a/doc/invocations-http-server/templates/tree.html b/doc/invocations-http-server/templates/tree.html new file mode 100644 index 00000000..765be73e --- /dev/null +++ b/doc/invocations-http-server/templates/tree.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} +{% block heading %} +Tree {{ name | e }} +{% endblock %} + +{% block content %} +

    Tree {{ name | e }}

    + + +{% endblock %} -- cgit v1.2.3