source: dump-lfs-scripts.xsl@ 01e51a1

0.2 1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 01e51a1 was 01e51a1, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Added switch to skip toolchain test suites if desired.
That switch will disable also the build of TCL, Expect and DejaGNU.

  • Property mode set to 100644
File size: 5.7 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 extension-element-prefixes="exsl"
5 version="1.0">
6
7<!-- XSLT stylesheet to create shell scripts from LFS books. -->
8
9 <!-- Run optional test suites? -->
10 <xsl:param name="testsuite" select="0"/>
11
12 <!-- Run toolchain test suites? -->
13 <xsl:param name="toolchaintest" select="1"/>
14
15 <xsl:template match="/">
16 <xsl:apply-templates select="//sect1"/>
17 </xsl:template>
18
19 <xsl:template match="sect1">
20 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
21 count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
22 <!-- The dirs names -->
23 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
24 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
25 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
26 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
27 <!-- The file names -->
28 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
29 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
30 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
31 <!-- The build order -->
32 <xsl:variable name="position" select="position()"/>
33 <xsl:variable name="order">
34 <xsl:choose>
35 <xsl:when test="string-length($position) = 1">
36 <xsl:text>00</xsl:text>
37 <xsl:value-of select="$position"/>
38 </xsl:when>
39 <xsl:when test="string-length($position) = 2">
40 <xsl:text>0</xsl:text>
41 <xsl:value-of select="$position"/>
42 </xsl:when>
43 <xsl:otherwise>
44 <xsl:value-of select="$position"/>
45 </xsl:otherwise>
46 </xsl:choose>
47 </xsl:variable>
48 <!-- Creating dirs and files -->
49 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
50 <xsl:choose>
51 <xsl:when test="@id='ch-system-changingowner' or
52 @id='ch-system-creatingdirs' or
53 @id='ch-system-createfiles'">
54 <xsl:text>#!/tools/bin/bash&#xA;&#xA;</xsl:text>
55 </xsl:when>
56 <xsl:otherwise>
57 <xsl:text>#!/bin/sh&#xA;&#xA;</xsl:text>
58 </xsl:otherwise>
59 </xsl:choose>
60 <xsl:if test="sect2[@role='installation'] or
61 @id='ch-tools-adjusting' or
62 @id='ch-system-readjusting'">
63 <xsl:text>cd $PKGDIR &amp;&amp;&#xA;</xsl:text>
64 </xsl:if>
65 <xsl:apply-templates select=".//para/userinput | .//screen"/>
66 <xsl:text>exit</xsl:text>
67 </exsl:document>
68 </xsl:if>
69 </xsl:template>
70
71 <xsl:template match="screen">
72 <xsl:if test="child::* = userinput">
73 <xsl:choose>
74 <xsl:when test="@role = 'nodump'"/>
75 <xsl:otherwise>
76 <xsl:apply-templates select="userinput" mode="screen"/>
77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:if>
80 </xsl:template>
81
82 <xsl:template match="para/userinput">
83 <xsl:if test="$testsuite != '0' and
84 (contains(string(),'test') or
85 contains(string(),'check'))">
86 <xsl:value-of select="substring-before(string(),'make')"/>
87 <xsl:text>make -k</xsl:text>
88 <xsl:value-of select="substring-after(string(),'make')"/>
89 <xsl:text> &#xA;</xsl:text>
90 </xsl:if>
91 </xsl:template>
92
93 <xsl:template match="userinput" mode="screen">
94 <xsl:choose>
95 <xsl:when test="$testsuite = '0' and
96 ancestor::sect1[@id='ch-system-coreutils'] and
97 (contains(string(),'check') or
98 contains(string(),'dummy'))"/>
99 <xsl:when test="string() = 'make check' or
100 string() = 'make -k check'">
101 <xsl:choose>
102 <xsl:when test="$toolchaintest = '0'"/>
103 <xsl:otherwise>
104 <xsl:text>make -k check</xsl:text>
105 <xsl:text>&#xA;</xsl:text>
106 </xsl:otherwise>
107 </xsl:choose>
108 </xsl:when>
109 <xsl:when test="contains(string(),'glibc-check-log') or
110 contains(string(),'test_summary')">
111 <xsl:choose>
112 <xsl:when test="$toolchaintest = '0'"/>
113 <xsl:otherwise>
114 <xsl:apply-templates/>
115 <xsl:text> &amp;&amp;&#xA;</xsl:text>
116 </xsl:otherwise>
117 </xsl:choose>
118 </xsl:when>
119 <xsl:when test="contains(string(),'EOF')">
120 <xsl:variable name="content">
121 <xsl:apply-templates/>
122 </xsl:variable>
123 <xsl:value-of select="substring-before(string($content), 'cat &gt;')"/>
124 <xsl:text>&#xA;(&#xA;cat &lt;&lt; EOF</xsl:text>
125 <xsl:value-of select="substring-after(string($content), '&quot;EOF&quot;')"/>
126 <xsl:text>&#xA;) &gt;</xsl:text>
127 <xsl:value-of select="substring-after((substring-before(string($content), '&lt;&lt;')), 'cat &gt;')"/>
128 <xsl:text> &amp;&amp;&#xA;</xsl:text>
129 </xsl:when>
130 <xsl:otherwise>
131 <xsl:apply-templates/>
132 <xsl:if test="not(contains(string(),'check')) and
133 not(contains(string(),'strip '))">
134 <xsl:text> &amp;&amp;</xsl:text>
135 </xsl:if>
136 <xsl:text>&#xA;</xsl:text>
137 </xsl:otherwise>
138 </xsl:choose>
139 </xsl:template>
140
141 <xsl:template match="replaceable">
142 <xsl:choose>
143 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
144 <xsl:text>$PAGE</xsl:text>
145 </xsl:when>
146 <xsl:otherwise>
147 <xsl:text>**EDITME</xsl:text>
148 <xsl:apply-templates/>
149 <xsl:text>EDITME**</xsl:text>
150 </xsl:otherwise>
151 </xsl:choose>
152 </xsl:template>
153
154</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.