mirror of
https://github.com/NixOS/nix.git
synced 2025-12-03 07:31:00 +01:00
* Added a utility that can be used to produce nice HTML pages from Nix
build logs. The program `log2xml' converts a Nix build log (read
from standard input) into XML file that can then be converted to
XHTML by the `log2html.xsl' stylesheet. The CSS stylesheet
`logfile.css' is necessary to make it look good.
This is primarily useful if the log file has a *tree structure*,
i.e., that sub-tasks such as the various phases of a build (unpack,
configure, make, etc.) or recursive invocations of Make are
represented as such. While a log file is in principle an
unstructured plain text file, builders can communicate this tree
structure to `log2xml' by using escape sequences:
- "\e[p" starts a new nesting level; the first line following the
escape code is the header;
- "\e[q" ends the current nesting level.
The generic builder in nixpkgs (not yet committed) uses this. It
shouldn't be to hard to patch GNU Make to speak this protocol.
Further improvements to the generated HTML pages are to allow
collapsing/expanding of subtrees, and to abbreviate store paths (but
to show the full path by hovering the mouse over it).
This commit is contained in:
parent
beda10f5a2
commit
9d2669d218
6 changed files with 240 additions and 1 deletions
61
src/log2xml/log2html.xsl
Normal file
61
src/log2xml/log2html.xsl
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:template match="logfile">
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="logfile.css" type="text/css" />
|
||||
<title>Log File</title>
|
||||
</head>
|
||||
<body>
|
||||
<xsl:apply-templates/>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="nest">
|
||||
<div class='nesting'>
|
||||
<div class='head'>
|
||||
<code>
|
||||
<xsl:value-of select="head"/>
|
||||
</code>
|
||||
</div>
|
||||
<blockquote class='body'>
|
||||
<xsl:for-each select='line|nest'>
|
||||
<xsl:if test="position() != last()">
|
||||
<table class='x'>
|
||||
<tr class='x'>
|
||||
<td class='dummy'>
|
||||
<div class='dummy' />
|
||||
</td>
|
||||
<td>
|
||||
<xsl:apply-templates select='.'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:if test="position() = last()">
|
||||
<table class='y'>
|
||||
<tr class='y'>
|
||||
<td class='dummy'>
|
||||
<div class='dummy' />
|
||||
</td>
|
||||
<td>
|
||||
<xsl:apply-templates select='.'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</blockquote>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="line">
|
||||
<code class='line'>
|
||||
<xsl:value-of select="."/>
|
||||
</code>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Loading…
Add table
Add a link
Reference in a new issue