source: CLFS/clfs.xsl@ 4cbc48f

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 4cbc48f was 28f4756, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

Added config option to allow to bommb in test suites faiures.

  • Property mode set to 100644
File size: 11.1 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
4 %general-entities;
5]>
6
7<!-- $Id$ -->
8
9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:exsl="http://exslt.org/common"
11 extension-element-prefixes="exsl"
12 version="1.0">
13
14<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
15
16 <!-- Build method used -->
17 <xsl:param name="method" select="chroot"/>
18
19 <!-- Compile the keymap into the kernel? -->
20 <xsl:param name="keymap" select="none"/>
21
22 <!-- Run test suites?
23 0 = none
24 1 = only Glibc, GCC and Binutils testsuites
25 2 = all testsuites
26 3 = alias to 2
27 -->
28 <xsl:param name="testsuite" select="1"/>
29
30 <!-- Bomb on test suites failures?
31 0 = no, I want to build the full system and review the logs
32 1 = yes, bomb at the first test suite failure to can review the build dir
33 -->
34 <xsl:param name="bomb-testsuite" select="0"/>
35
36 <!-- Install vim-lang package? -->
37 <xsl:param name="vim-lang" select="1"/>
38
39 <!-- Time zone -->
40 <xsl:param name="timezone" select="GMT"/>
41
42 <!-- Page size -->
43 <xsl:param name="page" select="letter"/>
44
45 <!-- Locale settings -->
46 <xsl:param name="lang" select="C"/>
47
48 <xsl:template match="/">
49 <xsl:apply-templates select="//sect1"/>
50 </xsl:template>
51
52 <xsl:template match="sect1">
53 <xsl:choose>
54 <xsl:when test="../@id='chapter-partitioning' or
55 ../@id='chapter-getting-materials' or
56 ../@id='chapter-final-preps'"/>
57 <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
58 <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
59 <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
60 <xsl:otherwise>
61 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
62 count(descendant::screen/userinput) &gt;
63 count(descendant::screen[@role='nodump'])">
64 <!-- The dirs names -->
65 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
66 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
67 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
68 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
69 <!-- The file names -->
70 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
71 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
72 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
73 <!-- The build order -->
74 <xsl:variable name="position" select="position()"/>
75 <xsl:variable name="order">
76 <xsl:choose>
77 <xsl:when test="string-length($position) = 1">
78 <xsl:text>00</xsl:text>
79 <xsl:value-of select="$position"/>
80 </xsl:when>
81 <xsl:when test="string-length($position) = 2">
82 <xsl:text>0</xsl:text>
83 <xsl:value-of select="$position"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:value-of select="$position"/>
87 </xsl:otherwise>
88 </xsl:choose>
89 </xsl:variable>
90 <!-- Creating dirs and files -->
91 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
92 <xsl:choose>
93 <xsl:when test="../@id='chapter-chroot'">
94 <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
95 </xsl:when>
96 <xsl:when test="@id='ch-system-stripping'">
97 <xsl:text>#!/bin/sh&#xA;</xsl:text>
98 </xsl:when>
99 <xsl:otherwise>
100 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
101 </xsl:otherwise>
102 </xsl:choose>
103 <xsl:if test="sect2[@role='installation']">
104 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
105 <xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
106 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
107 </xsl:if>
108 </xsl:if>
109 <xsl:apply-templates select=".//para/userinput | .//screen"/>
110 <xsl:text>exit</xsl:text>
111 </exsl:document>
112 </xsl:if>
113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:template>
116
117 <xsl:template match="screen">
118 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
119 <xsl:apply-templates select="userinput" mode="screen"/>
120 </xsl:if>
121 </xsl:template>
122
123 <xsl:template match="para/userinput">
124 <xsl:if test="(contains(string(),'test') or
125 contains(string(),'check')) and
126 ($testsuite = '2' or $testsuite = '3')">
127 <xsl:choose>
128 <xsl:when test="$bomb-testsuite = '0'">
129 <xsl:value-of select="substring-before(string(),'make')"/>
130 <xsl:text>make -k</xsl:text>
131 <xsl:value-of select="substring-after(string(),'make')"/>
132 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
133 </xsl:when>
134 <xsl:otherwise>
135 <xsl:apply-templates/>
136 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
137 </xsl:otherwise>
138 </xsl:choose>
139 </xsl:if>
140 </xsl:template>
141
142 <xsl:template match="userinput" mode="screen">
143 <xsl:choose>
144 <!-- Estandarized package formats -->
145 <xsl:when test="contains(string(),'tar.gz')">
146 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
147 <xsl:text>tar.*</xsl:text>
148 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
149 <xsl:text>&#xA;</xsl:text>
150 </xsl:when>
151 <!-- Avoiding a race condition in a patch -->
152 <xsl:when test="contains(string(),'debian_fixes')">
153 <xsl:value-of select="substring-before(string(),'patch')"/>
154 <xsl:text>patch -Z</xsl:text>
155 <xsl:value-of select="substring-after(string(),'patch')"/>
156 <xsl:text>&#xA;</xsl:text>
157 </xsl:when>
158 <!-- Setting $LANG for /etc/profile -->
159 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
160 contains(string(),'export LANG=')">
161 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
162 <xsl:text>export LANG=</xsl:text>
163 <xsl:value-of select="$lang"/>
164 <xsl:value-of select="substring-after(string(),'charmap]')"/>
165 <xsl:text>&#xA;</xsl:text>
166 </xsl:when>
167 <!-- Compile the keymap into the kernel? -->
168 <xsl:when test="contains(string(),'defkeymap') and
169 $keymap = 'none'"/>
170 <!-- Copying the kernel config file -->
171 <xsl:when test="string() = 'make mrproper'">
172 <xsl:text>make mrproper&#xA;</xsl:text>
173 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
174 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
175 </xsl:if>
176 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
177 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
178 </xsl:if>
179 </xsl:when>
180 <!-- No interactive commands are needed if the .config file is the proper one -->
181 <xsl:when test="contains(string(),'menuconfig')"/>
182 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
183 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
184 ancestor::sect1[@id='ch-system-module-init-tools']) and
185 (contains(string(),'check') or
186 contains(string(),'dummy'))">
187 <xsl:choose>
188 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
189 <xsl:otherwise>
190 <xsl:if test="not(contains(string(),'check'))">
191 <xsl:apply-templates/>
192 <xsl:text>&#xA;</xsl:text>
193 </xsl:if>
194 <xsl:if test="contains(string(),'check')">
195 <xsl:choose>
196 <xsl:when test="$bomb-testsuite = '0'">
197 <xsl:value-of select="substring-before(string(),'check')"/>
198 <xsl:text>-k check</xsl:text>
199 <xsl:value-of select="substring-after(string(),'check')"/>
200 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
201 </xsl:when>
202 <xsl:otherwise>
203 <xsl:apply-templates/>
204 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
205 </xsl:otherwise>
206 </xsl:choose>
207 </xsl:if>
208 </xsl:otherwise>
209 </xsl:choose>
210 </xsl:when>
211 <!-- Fixing toolchain test suites run -->
212 <xsl:when test="string() = 'make check' or
213 string() = 'make -k check'">
214 <xsl:choose>
215 <xsl:when test="$testsuite != '0'">
216 <xsl:choose>
217 <xsl:when test="$bomb-testsuite = '0'">
218 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
219 </xsl:when>
220 <xsl:otherwise>
221 <xsl:apply-templates/>
222 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
223 </xsl:otherwise>
224 </xsl:choose>
225 </xsl:when>
226 </xsl:choose>
227 </xsl:when>
228 <xsl:when test="contains(string(),'glibc-check-log')">
229 <xsl:choose>
230 <xsl:when test="$testsuite != '0'">
231 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
232 <xsl:choose>
233 <xsl:when test="$bomb-testsuite = '0'">
234 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
235 </xsl:when>
236 <xsl:otherwise>
237 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
238 </xsl:otherwise>
239 </xsl:choose>
240 </xsl:when>
241 </xsl:choose>
242 </xsl:when>
243 <xsl:when test="contains(string(),'test_summary') or
244 contains(string(),'expect -c')">
245 <xsl:choose>
246 <xsl:when test="$testsuite != '0'">
247 <xsl:apply-templates/>
248 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
249 </xsl:when>
250 </xsl:choose>
251 </xsl:when>
252 <!-- Don't stop on strip run -->
253 <xsl:when test="contains(string(),'strip ')">
254 <xsl:apply-templates/>
255 <xsl:text> || true&#xA;</xsl:text>
256 </xsl:when>
257 <!-- The rest of commands -->
258 <xsl:otherwise>
259 <xsl:apply-templates/>
260 <xsl:text>&#xA;</xsl:text>
261 </xsl:otherwise>
262 </xsl:choose>
263 </xsl:template>
264
265 <xsl:template match="replaceable">
266 <xsl:choose>
267 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
268 <xsl:value-of select="$timezone"/>
269 </xsl:when>
270 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
271 <xsl:value-of select="$page"/>
272 </xsl:when>
273 <xsl:when test="ancestor::sect1[@id='ch-boot-kernel'] or
274 ancestor::sect1[@id='ch-bootable-kernel']">
275 <xsl:value-of select="$keymap"/>
276 </xsl:when>
277 <xsl:otherwise>
278 <xsl:text>**EDITME</xsl:text>
279 <xsl:apply-templates/>
280 <xsl:text>EDITME**</xsl:text>
281 </xsl:otherwise>
282 </xsl:choose>
283 </xsl:template>
284
285</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.