source: CLFS/clfs.xsl@ c4ad7bf

2.4 ablfs-more legacy new_features trunk
Last change on this file since c4ad7bf was ee2c45c, checked in by Pierre Labastie <pierre@…>, 11 years ago

Tidy up clfs.xsl:

  • add 32 bit critical tests when in multilib
  • allow the "note" in perl to be run only when method=boot, and tests

are asked

  • remove some useless lines
  • Property mode set to 100644
File size: 16.7 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
10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 xmlns:exsl="http://exslt.org/common"
12 extension-element-prefixes="exsl"
13 version="1.0">
14
15<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
16
17 <!-- Build method used -->
18 <xsl:param name="method" select="chroot"/>
19
20 <!-- Run test suites?
21 0 = none
22 1 = only Glibc, GCC and Binutils testsuites
23 2 = all testsuites
24 3 = alias to 2
25 -->
26 <xsl:param name="testsuite" select="1"/>
27
28 <!-- Bomb on test suites failures?
29 n = no, I want to build the full system and review the logs
30 y = yes, bomb at the first test suite failure to can review the build dir
31 -->
32 <xsl:param name="bomb-testsuite" select="n"/>
33
34 <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
35 <xsl:param name="vim-lang" select="n"/>
36
37 <!-- Time zone -->
38 <xsl:param name="timezone" select="GMT"/>
39
40 <!-- Page size -->
41 <xsl:param name="page" select="letter"/>
42
43 <!-- Locale settings -->
44 <xsl:param name="lang" select="C"/>
45
46 <!-- Sparc64 processor type -->
47 <xsl:param name="sparc" select="none"/>
48
49 <xsl:template match="/">
50 <xsl:apply-templates select="//sect1"/>
51 </xsl:template>
52
53 <xsl:template match="sect1">
54 <xsl:choose>
55 <xsl:when test="../@id='chapter-partitioning' or
56 ../@id='chapter-getting-materials' or
57 ../@id='chapter-final-preps'"/>
58 <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
59 <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
60 <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
61 <xsl:otherwise>
62 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
63 count(descendant::screen/userinput) &gt;
64 count(descendant::screen[@role='nodump'])">
65 <!-- The dirs names -->
66 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
67 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
68 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
69 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
70 <!-- The file names -->
71 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
72 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
73 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
74 <!-- The build order -->
75 <xsl:variable name="position" select="position()"/>
76 <xsl:variable name="order">
77 <xsl:choose>
78 <xsl:when test="string-length($position) = 1">
79 <xsl:text>00</xsl:text>
80 <xsl:value-of select="$position"/>
81 </xsl:when>
82 <xsl:when test="string-length($position) = 2">
83 <xsl:text>0</xsl:text>
84 <xsl:value-of select="$position"/>
85 </xsl:when>
86 <xsl:otherwise>
87 <xsl:value-of select="$position"/>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:variable>
91 <!-- Creating dirs and files -->
92 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
93 <xsl:choose>
94 <xsl:when test="@id='ch-chroot-changingowner' or
95 @id='ch-chroot-creatingdirs' or
96 @id='ch-chroot-createfiles' or
97 @id='ch-system-stripping'">
98 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
102 </xsl:otherwise>
103 </xsl:choose>
104 <xsl:if test="not(@id='ch-system-stripping')">
105 <xsl:text>set -e</xsl:text>
106 </xsl:if>
107 <xsl:text>&#xA;</xsl:text>
108 <xsl:if test="sect2[@role='installation'] and
109 not(@id='ch-system-multiarch-wrapper')">
110 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
111 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
112 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
113 </xsl:if>
114 </xsl:if>
115 <xsl:apply-templates select=".//para/userinput | .//screen"/>
116 <xsl:if test="not(@id='ch-chroot-chroot')">
117 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
118 </xsl:if>
119 <xsl:text>exit</xsl:text>
120 </exsl:document>
121 </xsl:if>
122 </xsl:otherwise>
123 </xsl:choose>
124 </xsl:template>
125
126 <xsl:template match="screen">
127 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
128 <xsl:apply-templates select="userinput" mode="screen"/>
129 </xsl:if>
130 </xsl:template>
131
132 <xsl:template match="para/userinput">
133 <xsl:if test="(contains(string(),'test') or
134 contains(string(),'check')) and
135 ($testsuite = '2' or $testsuite = '3')">
136 <xsl:choose>
137 <xsl:when test="$bomb-testsuite = 'n'">
138 <xsl:value-of select="substring-before(string(),'make')"/>
139 <xsl:text>make -k</xsl:text>
140 <xsl:value-of select="substring-after(string(),'make')"/>
141 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
142 </xsl:when>
143 <xsl:otherwise>
144 <xsl:apply-templates/>
145 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
146 <xsl:if test="contains(string(),' -k ')">
147 <xsl:text> || true</xsl:text>
148 </xsl:if>
149 <xsl:text>&#xA;</xsl:text>
150 </xsl:otherwise>
151 </xsl:choose>
152 </xsl:if>
153 </xsl:template>
154
155 <xsl:template match="userinput" mode="screen">
156 <xsl:choose>
157 <!-- Estandarized package formats -->
158 <xsl:when test="contains(string(),'tar.gz')">
159 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
160 <xsl:text>tar.*</xsl:text>
161 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
162 <xsl:text>&#xA;</xsl:text>
163 </xsl:when>
164 <!-- Setting $LANG for /etc/profile -->
165 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
166 contains(string(),'export LANG=')">
167 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
168 <xsl:text>export LANG=</xsl:text>
169 <xsl:value-of select="$lang"/>
170 <xsl:value-of select="substring-after(string(),'charmap]')"/>
171 <xsl:text>&#xA;</xsl:text>
172 </xsl:when>
173 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
174 <xsl:when test="contains(string(),'defkeymap')"/>
175 <!-- Copying the kernel config file -->
176 <xsl:when test="string() = 'make mrproper'">
177 <xsl:text>make mrproper&#xA;</xsl:text>
178 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
179 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
180 </xsl:if>
181 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
182 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
183 </xsl:if>
184 </xsl:when>
185 <!-- No interactive commands are needed if the .config file is the proper one -->
186 <xsl:when test="contains(string(),'menuconfig')"/>
187<!-- test instructions -->
188 <xsl:when test="@remap = 'test'">
189 <xsl:choose>
190 <!-- Avoid executing the note before perl tests while in 'chroot' -->
191 <xsl:when test="ancestor::note[@os='a00'] and $method='chroot'"/>
192 <xsl:when test="$testsuite = '0'"/>
193 <xsl:when test=
194 "$testsuite = '1' and
195 not(ancestor::sect1[@id='ch-system-gcc']) and
196 not(ancestor::sect1[contains(@id,'ch-system-eglibc')]) and
197 not(ancestor::sect1[contains(@id,'ch-system-glibc')]) and
198 not(ancestor::sect1[contains(@id,'ch-system-gmp')]) and
199 not(ancestor::sect1[contains(@id,'ch-system-mpfr')]) and
200 not(ancestor::sect1[contains(@id,'ch-system-mpc')]) and
201 not(ancestor::sect1[contains(@id,'ch-system-ppl')]) and
202 not(ancestor::sect1[contains(@id,'ch-system-isl')]) and
203 not(ancestor::sect1[contains(@id,'ch-system-cloog')]) and
204 not(ancestor::sect1[contains(@id,'ch-system-cloog-ppl')]) and
205 not(ancestor::sect1[@id='ch-system-binutils'])"/>
206 <xsl:otherwise>
207 <xsl:choose>
208 <xsl:when test="$bomb-testsuite = 'n'">
209 <xsl:choose>
210 <!-- special case for (e)glibc -->
211 <xsl:when test="contains(string(), 'glibc-check-log')">
212 <xsl:value-of
213 select="substring-before(string(),'2&gt;&amp;1')"/>
214 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
215 </xsl:when>
216 <!-- special case for procps-ng -->
217 <xsl:when test="contains(string(), 'pushd')">
218 <xsl:text>{ </xsl:text>
219 <xsl:apply-templates/>
220 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
221 </xsl:when>
222 <xsl:when test="contains(string(), 'make -k')">
223 <xsl:apply-templates/>
224 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
225 </xsl:when>
226 <xsl:when test="contains(string(), 'make')">
227 <xsl:value-of select="substring-before(string(),'make')"/>
228 <xsl:text>make -k</xsl:text>
229 <xsl:value-of select="substring-after(string(),'make')"/>
230 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
231 </xsl:when>
232 <xsl:otherwise>
233 <xsl:apply-templates/>
234 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
235 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
236 </xsl:if>
237 <xsl:text>&#xA;</xsl:text>
238 </xsl:otherwise>
239 </xsl:choose>
240 </xsl:when>
241 <xsl:otherwise>
242 <!-- bomb-testsuite != 'n'-->
243 <xsl:choose>
244 <!-- special case for (e)glibc -->
245 <xsl:when test="contains(string(), 'glibc-check-log')">
246 <xsl:value-of
247 select="substring-before(string(),'2&gt;&amp;1')"/>
248 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
249 </xsl:when>
250 <!-- special case for gmp -->
251 <xsl:when test="contains(string(), 'tee gmp-check-log')">
252 <xsl:text>(</xsl:text>
253 <xsl:apply-templates/>
254 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
255 </xsl:when>
256 <!-- special case for procps-ng -->
257 <xsl:when test="contains(string(), 'pushd')">
258 <xsl:text>{ </xsl:text>
259 <xsl:apply-templates/>
260 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
261 </xsl:when>
262 <xsl:when test="contains(string(), 'make -k')">
263 <xsl:apply-templates/>
264 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
265 </xsl:when>
266 <xsl:otherwise>
267 <xsl:apply-templates/>
268 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
269 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
270 </xsl:if>
271 <xsl:text>&#xA;</xsl:text>
272 </xsl:otherwise>
273 </xsl:choose>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:otherwise>
277 </xsl:choose>
278 </xsl:when>
279<!-- End of test instructions -->
280
281 <!-- Fixing toolchain test suites run XXX more to fix -->
282 <xsl:when test="contains(string(),'glibc-check-log')">
283 <xsl:choose>
284 <xsl:when test="$testsuite != '0'">
285 <xsl:value-of select="substring-before(string(),'2&gt;')"/>
286 <xsl:choose>
287 <xsl:when test="$bomb-testsuite = 'n'">
288 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
289 </xsl:when>
290 <xsl:otherwise>
291 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
292 <xsl:if test="contains(string(),' -k ')">
293 <xsl:text> || true</xsl:text>
294 </xsl:if>
295 <xsl:text>&#xA;</xsl:text>
296 </xsl:otherwise>
297 </xsl:choose>
298 </xsl:when>
299 </xsl:choose>
300 </xsl:when>
301 <xsl:when test="string() = 'make check' or
302 contains(string(), 'make -k check')">
303 <xsl:choose>
304 <xsl:when test="$testsuite != '0'">
305 <xsl:choose>
306 <xsl:when test="$bomb-testsuite = 'n'">
307 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
308 </xsl:when>
309 <xsl:otherwise>
310 <xsl:apply-templates/>
311 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
312 <xsl:if test="contains(string(),' -k ')">
313 <xsl:text> || true</xsl:text>
314 </xsl:if>
315 <xsl:text>&#xA;</xsl:text>
316 </xsl:otherwise>
317 </xsl:choose>
318 </xsl:when>
319 </xsl:choose>
320 </xsl:when>
321 <xsl:when test="contains(string(),'test_summary') or
322 contains(string(),'expect -c')">
323 <xsl:choose>
324 <xsl:when test="$testsuite != '0'">
325 <xsl:apply-templates/>
326 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
327 </xsl:when>
328 </xsl:choose>
329 </xsl:when>
330 <!-- Don't stop on strip run -->
331 <xsl:when test="contains(string(),'strip ')">
332 <xsl:apply-templates/>
333 <xsl:text> || true&#xA;</xsl:text>
334 </xsl:when>
335 <!-- Add -j1 to make install commands -->
336 <xsl:when test="contains(string(),'make ') and
337 contains(string(),'install')">
338 <xsl:value-of select="substring-before(string(),'make ')"/>
339 <xsl:text>make -j1 </xsl:text>
340 <xsl:value-of select="substring-after(string(),'make ')"/>
341 <xsl:text>&#xA;</xsl:text>
342 </xsl:when>
343 <!-- The rest of commands -->
344 <xsl:otherwise>
345 <xsl:apply-templates/>
346 <xsl:text>&#xA;</xsl:text>
347 </xsl:otherwise>
348 </xsl:choose>
349 </xsl:template>
350
351 <xsl:template match="replaceable">
352 <xsl:choose>
353 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
354 <xsl:value-of select="$timezone"/>
355 </xsl:when>
356 <xsl:when test="ancestor::sect1[@id='ch-system-eglibc']">
357 <xsl:value-of select="$timezone"/>
358 </xsl:when>
359 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
360 <xsl:value-of select="$page"/>
361 </xsl:when>
362 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
363 <xsl:choose>
364 <xsl:when test="contains(string(),'BUILD32')">
365 <xsl:choose>
366 <xsl:when test="$sparc = '1' or $sparc = '2'">
367 <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
368 </xsl:when>
369 <xsl:when test="$sparc = '3'">
370 <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
371 </xsl:when>
372 </xsl:choose>
373 </xsl:when>
374 <xsl:when test="contains(string(),'BUILD64')">
375 <xsl:choose>
376 <xsl:when test="$sparc = '1' or $sparc = '2'">
377 <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
378 </xsl:when>
379 <xsl:when test="$sparc = '3'">
380 <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
381 </xsl:when>
382 </xsl:choose>
383 </xsl:when>
384 <xsl:when test="contains(string(),'GCCTARGET')">
385 <xsl:choose>
386 <xsl:when test="$sparc = '1' or $sparc = '2'">
387 <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
388 </xsl:when>
389 <xsl:when test="$sparc = '3'">
390 <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
391 </xsl:when>
392 </xsl:choose>
393 </xsl:when>
394 </xsl:choose>
395 </xsl:when>
396 <xsl:otherwise>
397 <xsl:text>**EDITME</xsl:text>
398 <xsl:apply-templates/>
399 <xsl:text>EDITME**</xsl:text>
400 </xsl:otherwise>
401 </xsl:choose>
402 </xsl:template>
403
404</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.