source: LFS/lfs.xsl@ c5ae20a

experimental
Last change on this file since c5ae20a was f5f857d, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Set $TEST_LOG from inside the build scripts.
There is no need now to use the envars file.
Optimize support must be moved to an XSL-based code.

  • Property mode set to 100644
File size: 27.8 KB
Line 
1<?xml version="1.0"?>
2
3<!-- $Id$ -->
4
5<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:exsl="http://exslt.org/common"
7 extension-element-prefixes="exsl"
8 version="1.0">
9
10<!-- XSLT stylesheet to create shell scripts from LFS books. -->
11
12<!-- ####################### PARAMETERS ################################### -->
13
14 <!-- Run test suites?
15 0 = none
16 1 = only chapter06 Glibc, GCC and Binutils testsuites
17 2 = all chapter06 testsuites
18 3 = all chapter05 and chapter06 testsuites
19 -->
20 <xsl:param name="testsuite">1</xsl:param>
21
22 <!-- Bomb on test suites failures?
23 n = no, I want to build the full system and review the logs
24 y = yes, bomb at the first test suite failure to can review the build dir
25 -->
26 <xsl:param name="bomb-testsuite">n</xsl:param>
27
28 <!-- Install vim-lang package? -->
29 <xsl:param name="vim-lang">y</xsl:param>
30
31 <!-- Time zone -->
32 <xsl:param name="timezone">GMT</xsl:param>
33
34 <!-- Page size -->
35 <xsl:param name="page">letter</xsl:param>
36
37 <!-- Locale setting -->
38 <xsl:param name="lang">C</xsl:param>
39
40 <!-- Custom tools support -->
41 <xsl:param name="custom-tools">n</xsl:param>
42
43 <!-- blfs-tool support -->
44 <xsl:param name="blfs-tool">n</xsl:param>
45
46
47<!-- ####################################################################### -->
48
49<!-- ########### NAMED USER TEMPLATES TO ALLOW CUSTOMIZATIONS ############## -->
50<!-- ############ Maybe should be placed on a separate file ################ -->
51
52 <!-- Hock for user header additions -->
53 <xsl:template name="user_header">
54 <xsl:text>&#xA;</xsl:text>
55 </xsl:template>
56
57
58 <!-- Hock for user envars or extra commands after unpacking the tarball
59 but before cd into the sources dir -->
60 <xsl:template name="user_pre_commands">
61 <xsl:text>&#xA;</xsl:text>
62 </xsl:template>
63
64
65 <!-- Hock for user footer additions before remove sources dir -->
66 <xsl:template name="user_footer">
67 <xsl:text>&#xA;</xsl:text>
68 </xsl:template>
69
70
71 <!-- Hock for inserting scripts before a selected one -->
72 <xsl:template name="insert_script_before">
73 <!-- Inherited values -->
74 <xsl:param name="reference" select="foo"/>
75 <xsl:param name="order" select="foo"/>
76 <!-- Added a string to be sure that this scripts are run
77 before the selected one -->
78 <xsl:variable name="insert_order" select="concat($order,'_0')"/>
79 <!-- Add an xsl:if block for each referenced sect1 you want
80 to insert scripts before -->
81 <xsl:if test="$reference = 'ID_of_selected_sect1'">
82 <!-- Add an exsl:document block for each script to be inserted
83 at this point of the build. This one is only a dummy example. -->
84 <exsl:document href="{$insert_order}01-dummy" method="text">
85 <xsl:call-template name="header"/>
86 <xsl:text>
87PKG_PHASE=dummy
88PACKAGE=dummy
89VERSION=0.0.0
90TARBALL=dummy-0.0.0.tar.bz2
91 </xsl:text>
92 <xsl:call-template name="disk_usage"/>
93 <xsl:call-template name="unpack"/>
94 <xsl:text>
95cd $PKGDIR
96./configure --prefix=/usr
97make
98make check
99make install
100 </xsl:text>
101 <xsl:call-template name="disk_usage"/>
102 <xsl:call-template name="clean_sources"/>
103 <xsl:call-template name="footer"/>
104 </exsl:document>
105 </xsl:if>
106 </xsl:template>
107
108
109 <!-- Hock for inserting scripts after a selected one -->
110 <xsl:template name="insert_script_after">
111 <!-- Inherited values -->
112 <xsl:param name="reference" select="foo"/>
113 <xsl:param name="order" select="foo"/>
114 <!-- Added a string to be sure that this scripts are run
115 after the selected one -->
116 <xsl:variable name="insert_order" select="concat($order,'_z')"/>
117 <!-- Add an xsl:if block for each referenced sect1 you want
118 to insert scripts after -->
119 <xsl:if test="$reference = 'ID_of_selected_sect1'">
120 <!-- Add an exsl:document block for each script to be inserted
121 at this point of the build. This one is only a dummy example. -->
122 <exsl:document href="{$insert_order}01-dummy" method="text">
123 <xsl:call-template name="header"/>
124 <xsl:text>
125PKG_PHASE=dummy
126PACKAGE=dummy
127VERSION=0.0.0
128TARBALL=dummy-0.0.0.tar.bz2
129 </xsl:text>
130 <xsl:call-template name="disk_usage"/>
131 <xsl:call-template name="unpack"/>
132 <xsl:text>
133cd $PKGDIR
134./configure --prefix=/usr
135make
136make check
137make install
138 </xsl:text>
139 <xsl:call-template name="disk_usage"/>
140 <xsl:call-template name="clean_sources"/>
141 <xsl:call-template name="footer"/>
142 </exsl:document>
143 </xsl:if>
144 </xsl:template>
145
146
147 <!-- Hock for creating a custom tools directory containing scripts
148 to be run after the system has been built
149 (to be moved to a separate file) -->
150 <xsl:template name="custom-tools">
151 <!-- Fixed directory and ch_order values -->
152 <xsl:variable name="basedir">custom-tools/20_</xsl:variable>
153 <!-- Add an exsl:document block for each script to be created.
154 This one is only a dummy example. You must replace "01" by
155 the proper build order and "dummy" by the script name -->
156 <exsl:document href="{$basedir}01-dummy" method="text">
157 <xsl:call-template name="header"/>
158 <xsl:text>
159PKG_PHASE=dummy
160PACKAGE=dummy
161VERSION=0.0.0
162TARBALL=dummy-0.0.0.tar.bz2
163 </xsl:text>
164 <xsl:call-template name="disk_usage"/>
165 <xsl:call-template name="unpack"/>
166 <xsl:text>
167cd $PKGDIR
168./configure --prefix=/usr
169make
170make check
171make install
172 </xsl:text>
173 <xsl:call-template name="disk_usage"/>
174 <xsl:call-template name="clean_sources"/>
175 <xsl:call-template name="footer"/>
176 </exsl:document>
177 </xsl:template>
178
179
180<!-- ####################################################################### -->
181
182<!-- ########################### NAMED TEMPLATES ########################### -->
183
184 <!-- Chapter directory name (the same used for HTML output) -->
185 <xsl:template name="dirname">
186 <xsl:variable name="pi-dir" select="processing-instruction('dbhtml')"/>
187 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
188 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
189 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
190 <xsl:value-of select="$dirname"/>
191 </xsl:template>
192
193
194 <!-- Base file name (the same used for HTML output) -->
195 <xsl:template name="filename">
196 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
197 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
198 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
199 <xsl:value-of select="$filename"/>
200 </xsl:template>
201
202
203 <!-- Script header -->
204 <xsl:template name="header">
205 <xsl:if test="not(@id='ch-system-chroot') and
206 not(@id='ch-system-revisedchroot')">
207 <!-- Set the shabang -->
208 <xsl:choose>
209 <xsl:when test="@id='ch-system-creatingdirs' or
210 @id='ch-system-createfiles' or
211 @id='ch-system-strippingagain'">
212 <xsl:text>#!/tools/bin/bash&#xA;</xsl:text>
213 </xsl:when>
214 <xsl:otherwise>
215 <xsl:text>#!/bin/bash&#xA;</xsl:text>
216 </xsl:otherwise>
217 </xsl:choose>
218 <!-- Set +h -->
219 <xsl:text>set +h&#xA;</xsl:text>
220 <!-- Set -e -->
221 <xsl:if test="not(@id='ch-tools-stripping') and
222 not(@id='ch-system-strippingagain')">
223 <xsl:text>set -e&#xA;</xsl:text>
224 </xsl:if>
225 <!-- Dump a time stamp -->
226 <xsl:text>&#xA;echo -e "\n`date`\n"&#xA;</xsl:text>
227 </xsl:if>
228 </xsl:template>
229
230
231 <!-- Dump current disk usage -->
232 <xsl:template name="disk_usage">
233 <xsl:if test="not(@id='ch-system-chroot') and
234 not(@id='ch-system-revisedchroot')">
235 <xsl:choose>
236 <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
237 <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"&#xA;</xsl:text>
238 </xsl:when>
239 <xsl:otherwise>
240 <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"&#xA;</xsl:text>
241 </xsl:otherwise>
242 </xsl:choose>
243 </xsl:if>
244 </xsl:template>
245
246
247 <!-- Enter to the sources dir, clean it, unpack the tarball,
248 and reset the seconds counter -->
249 <xsl:template name="unpack">
250 <xsl:text>cd </xsl:text>
251 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
252 <xsl:text>$LFS</xsl:text>
253 </xsl:if>
254 <xsl:text>/sources
255PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
256if [ -d $PKGDIR ]; then
257 rm -rf $PKGDIR
258fi
259if [ -d ${PKGDIR%-*}-build ]; then
260 rm -rf ${PKGDIR%-*}-build
261fi
262tar -xf $TARBALL
263SECONDS=0
264 </xsl:text>
265 </xsl:template>
266
267
268 <!-- Extra previous commands needed by the book but not inside screen tags -->
269 <xsl:template name="pre_commands">
270 <xsl:if test="sect2[@role='installation']">
271 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
272 </xsl:if>
273 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
274 <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1&#xA;</xsl:text>
275 </xsl:if>
276 </xsl:template>
277
278
279 <!-- Extra post commands needed by the book but not inside screen tags -->
280 <xsl:template name="post_commands">
281 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
282 <xsl:variable name="content" select="//userinput[@remap='locale-test']"/>
283 <xsl:value-of select="substring-before($content,'/usr/lib/locale')"/>
284 <xsl:text>/tools/lib/locale</xsl:text>
285 <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/>
286 </xsl:if>
287 </xsl:template>
288
289
290 <!-- Remove sources and build dirs, skipping it from seconds meassurament -->
291 <xsl:template name="clean_sources">
292 <xsl:text>cd </xsl:text>
293 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
294 <xsl:text>$LFS</xsl:text>
295 </xsl:if>
296 <xsl:text>/sources
297SECS=$SECONDS
298rm -rf $PKGDIR
299rm -rf ${PKGDIR%-*}-build
300SECONDS=$SECS
301 </xsl:text>
302 </xsl:template>
303
304
305 <!-- Script footer -->
306 <xsl:template name="footer">
307 <!-- Dump the build time and exit -->
308 <xsl:if test="not(@id='ch-system-chroot') and
309 not(@id='ch-system-revisedchroot')">
310 <xsl:text>
311echo -e "\n\nTotalseconds: $SECONDS\n"
312
313exit
314 </xsl:text>
315 </xsl:if>
316 </xsl:template>
317
318
319 <!-- Extra commads needed at the start of some screen block
320 to allow automatization -->
321 <xsl:template name="top_screen_build_fixes">
322 <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
323 <xsl:if test="contains(string(),'firmware,udev')">
324 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
325 </xsl:if>
326 </xsl:template>
327
328
329 <!-- Extra commads needed at the end of some screen block
330 to allow automatization -->
331 <xsl:template name="bottom_screen_build_fixes">
332 <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
333 <xsl:if test="contains(string(),'firmware,udev')">
334 <xsl:text>&#xA;fi</xsl:text>
335 </xsl:if>
336 <!-- Copying the kernel config file -->
337 <xsl:if test="string() = 'make mrproper'">
338 <xsl:text>&#xA;cp -v ../kernel-config .config</xsl:text>
339 </xsl:if>
340 <!-- Don't stop on strip run -->
341 <xsl:if test="contains(string(),'strip --strip')">
342 <xsl:text> || true</xsl:text>
343 </xsl:if>
344 </xsl:template>
345
346
347 <!-- Extract a package name from a package URL -->
348 <xsl:template name="package_name">
349 <xsl:param name="url" select="foo"/>
350 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
351 <xsl:choose>
352 <xsl:when test="contains($sub-url,'/')">
353 <xsl:call-template name="package_name">
354 <xsl:with-param name="url" select="$sub-url"/>
355 </xsl:call-template>
356 </xsl:when>
357 <xsl:otherwise>
358 <xsl:value-of select="$sub-url"/>
359 </xsl:otherwise>
360 </xsl:choose>
361 </xsl:template>
362
363
364 <!-- Check if a package testsuite must be run -->
365 <xsl:template name="run_this_test">
366 <xsl:choose>
367 <xsl:when test=".//userinput[@remap='test']">
368 <xsl:choose>
369 <!-- No testsuites run on level 0 -->
370 <xsl:when test="$testsuite = '0'">0</xsl:when>
371 <!-- On level 1, only final system toolchain testsuites are run -->
372 <xsl:when test="$testsuite = '1' and
373 not(@id='ch-system-gcc') and
374 not(@id='ch-system-glibc') and
375 not(@id='ch-system-binutils')">0</xsl:when>
376 <!-- On level 2, temp tools testsuites are not run -->
377 <xsl:when test="$testsuite = '2' and
378 ../@id='chapter-temporary-tools'">0</xsl:when>
379 <xsl:otherwise>1</xsl:otherwise>
380 </xsl:choose>
381 </xsl:when>
382 <xsl:otherwise>0</xsl:otherwise>
383 </xsl:choose>
384 </xsl:template>
385
386
387 <!-- Adds blfs-tool support scripts (to be moved to a separate file) -->
388 <xsl:template name="blfs-tool">
389 <!-- Fixed directory and ch_order values -->
390 <xsl:variable name="basedir">blfs-tool-deps/30_</xsl:variable>
391 <!-- One exsl:document block for each blfs-tool dependency
392 TO BE WRITTEN -->
393 <exsl:document href="{$basedir}01-dummy" method="text">
394 <xsl:call-template name="header"/>
395 <xsl:text>
396PKG_PHASE=dummy
397PACKAGE=dummy
398VERSION=0.0.0
399TARBALL=dummy-0.0.0.tar.bz2
400 </xsl:text>
401 <xsl:call-template name="disk_usage"/>
402 <xsl:call-template name="unpack"/>
403 <xsl:text>
404cd $PKGDIR
405./configure --prefix=/usr
406make
407make check
408make install
409 </xsl:text>
410 <xsl:call-template name="disk_usage"/>
411 <xsl:call-template name="clean_sources"/>
412 <xsl:call-template name="footer"/>
413 </exsl:document>
414 </xsl:template>
415
416
417<!-- ######################################################################## -->
418
419<!-- ############################# MATCH TEMPLATES ########################## -->
420
421 <!-- Root element -->
422 <xsl:template match="/">
423 <!-- Start processing at chapter level -->
424 <xsl:apply-templates select="//chapter"/>
425 <!-- Process custom tools scripts -->
426 <xsl:if test="$custom-tools = 'y'">
427 <xsl:call-template name="custom-tools"/>
428 </xsl:if>
429 <!-- Process blfs-tool scripts -->
430 <xsl:if test="$blfs-tool = 'y'">
431 <xsl:call-template name="blfs-tool"/>
432 </xsl:if>
433 </xsl:template>
434
435
436 <!-- chapter -->
437 <xsl:template match="chapter">
438 <xsl:if test="@id='chapter-temporary-tools' or @id='chapter-building-system'
439 or @id='chapter-bootscripts' or @id='chapter-bootable'">
440 <!-- The dir name -->
441 <xsl:variable name="dirname">
442 <xsl:call-template name="dirname"/>
443 </xsl:variable>
444 <!-- The chapter order position -->
445 <xsl:variable name="ch_position" select="position()"/>
446 <xsl:variable name="ch_order">
447 <xsl:choose>
448 <xsl:when test="string-length($ch_position) = 1">
449 <xsl:text>0</xsl:text>
450 <xsl:value-of select="$ch_position"/>
451 </xsl:when>
452 <xsl:otherwise>
453 <xsl:value-of select="$ch_position"/>
454 </xsl:otherwise>
455 </xsl:choose>
456 </xsl:variable>
457 <!-- Process the childrens -->
458 <xsl:apply-templates select="sect1">
459 <xsl:with-param name="ch_order" select="$ch_order"/>
460 <xsl:with-param name="dirname" select="$dirname"/>
461 </xsl:apply-templates>
462 </xsl:if>
463 </xsl:template>
464
465
466 <!-- sect1 -->
467 <xsl:template match="sect1">
468 <!-- Inherited chapter order -->
469 <xsl:param name="ch_order" select="foo"/>
470 <!-- Inherited dir name -->
471 <xsl:param name="dirname" select="foo"/>
472 <!-- Process only files with actual build commands -->
473 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
474 count(descendant::screen/userinput) &gt;
475 count(descendant::screen[@role='nodump'])">
476 <!-- Base file name -->
477 <xsl:variable name="filename">
478 <xsl:call-template name="filename"/>
479 </xsl:variable>
480 <!-- Sect1 order position -->
481 <xsl:variable name="sect1_position" select="position()"/>
482 <xsl:variable name="sect1_order">
483 <xsl:choose>
484 <xsl:when test="string-length($sect1_position) = 1">
485 <xsl:text>0</xsl:text>
486 <xsl:value-of select="$sect1_position"/>
487 </xsl:when>
488 <xsl:otherwise>
489 <xsl:value-of select="$sect1_position"/>
490 </xsl:otherwise>
491 </xsl:choose>
492 </xsl:variable>
493 <!-- Script build order -->
494 <xsl:variable name="order" select="concat($dirname,'/',$ch_order,'_',$sect1_order)"/>
495 <!-- Must the package test suite, if any, be run? -->
496 <xsl:variable name="run_this_test">
497 <xsl:call-template name="run_this_test"/>
498 </xsl:variable>
499 <!-- Hock to insert scripts before the current one -->
500 <xsl:call-template name="insert_script_before">
501 <xsl:with-param name="reference" select="@id"/>
502 <xsl:with-param name="order" select="$order"/>
503 </xsl:call-template>
504 <!-- Creating dirs and files -->
505 <exsl:document href="{$order}-{$filename}" method="text">
506 <xsl:call-template name="header"/>
507 <xsl:call-template name="user_header"/>
508 <xsl:apply-templates select="sect1info[@condition='script']">
509 <xsl:with-param name="phase" select="$filename"/>
510 <xsl:with-param name="run_this_test" select="$run_this_test"/>
511 <xsl:with-param name="testlogfile" select="concat($ch_order,'_',$sect1_order,'-',$filename)"/>
512 </xsl:apply-templates>
513 <xsl:call-template name="disk_usage"/>
514 <xsl:if test="sect2[@role='installation']">
515 <xsl:call-template name="unpack"/>
516 </xsl:if>
517 <xsl:call-template name="user_pre_commands"/>
518 <xsl:call-template name="pre_commands"/>
519 <xsl:apply-templates select=".//screen">
520 <xsl:with-param name="run_this_test" select="$run_this_test"/>
521 </xsl:apply-templates>
522 <xsl:call-template name="post_commands"/>
523 <xsl:call-template name="user_footer"/>
524 <xsl:call-template name="disk_usage"/>
525 <xsl:if test="sect2[@role='installation']">
526 <xsl:call-template name="clean_sources"/>
527 </xsl:if>
528 <xsl:call-template name="footer"/>
529 </exsl:document>
530 <!-- Hock to insert scripts after the current one -->
531 <xsl:call-template name="insert_script_after">
532 <xsl:with-param name="reference" select="@id"/>
533 <xsl:with-param name="order" select="$order"/>
534 </xsl:call-template>
535 </xsl:if>
536 </xsl:template>
537
538
539 <!-- sect1info -->
540 <xsl:template match="sect1info">
541 <!-- Used to set and initialize the testuite log file -->
542 <xsl:param name="testlogfile" select="foo"/>
543 <xsl:param name="run_this_test" select="foo"/>
544 <!-- Build phase (base file name) to be used for PM -->
545 <xsl:param name="phase" select="foo"/>
546 <xsl:text>&#xA;PKG_PHASE=</xsl:text>
547 <xsl:value-of select="$phase"/>
548 <!-- Package name -->
549 <xsl:apply-templates select="productname"/>
550 <!-- Package version -->
551 <xsl:apply-templates select="productnumber"/>
552 <!-- Tarball name -->
553 <xsl:apply-templates select="address"/>
554 <xsl:if test="$run_this_test = '1'">
555 <xsl:text>&#xA;TEST_LOG=</xsl:text>
556 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
557 <xsl:text>$LFS</xsl:text>
558 </xsl:if>
559 <xsl:text>/jhalfs/test-logs/</xsl:text>
560 <xsl:value-of select="$testlogfile"/>
561 <xsl:text>&#xA;echo -e "\n`date`\n" > $TEST_LOG</xsl:text>
562 </xsl:if>
563 <xsl:text>&#xA;&#xA;</xsl:text>
564 </xsl:template>
565
566
567 <!-- productname -->
568 <xsl:template match="productname">
569 <xsl:text>&#xA;PACKAGE=</xsl:text>
570 <xsl:apply-templates/>
571 </xsl:template>
572
573
574 <!-- productnumber -->
575 <xsl:template match="productnumber">
576 <xsl:text>&#xA;VERSION=</xsl:text>
577 <xsl:apply-templates/>
578 </xsl:template>
579
580
581 <!-- address -->
582 <xsl:template match="address">
583 <xsl:text>&#xA;TARBALL=</xsl:text>
584 <xsl:call-template name="package_name">
585 <xsl:with-param name="url">
586 <xsl:apply-templates/>
587 </xsl:with-param>
588 </xsl:call-template>
589 <xsl:apply-templates select="otheraddr" mode="tarball"/>
590 </xsl:template>
591
592
593 <!-- otheraddr -->
594 <xsl:template match="otheraddr"/>
595 <xsl:template match="otheraddr" mode="tarball">
596 <xsl:text>&#xA;TARBALL_</xsl:text>
597 <xsl:value-of select="position()"/>
598 <xsl:text>=</xsl:text>
599 <xsl:call-template name="package_name">
600 <xsl:with-param name="url" select="."/>
601 </xsl:call-template>
602 </xsl:template>
603
604
605 <!-- screen -->
606 <xsl:template match="screen">
607 <xsl:param name="run_this_test" select="foo"/>
608 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
609 <xsl:call-template name="top_screen_build_fixes"/>
610 <xsl:apply-templates>
611 <xsl:with-param name="run_this_test" select="$run_this_test"/>
612 </xsl:apply-templates>
613 <xsl:call-template name="bottom_screen_build_fixes"/>
614 <xsl:text>&#xA;</xsl:text>
615 </xsl:if>
616 </xsl:template>
617
618
619 <!-- userinput @remap='test' -->
620 <xsl:template match="userinput[@remap='test']">
621 <xsl:param name="run_this_test" select="foo"/>
622 <xsl:apply-templates select="." mode="test">
623 <xsl:with-param name="run_this_test" select="$run_this_test"/>
624 </xsl:apply-templates>
625 </xsl:template>
626
627
628 <!-- userinput @remap='pre' -->
629 <xsl:template match="userinput[@remap='pre']">
630 <xsl:apply-templates select="." mode="pre"/>
631 </xsl:template>
632
633
634 <!-- userinput @remap='configure' -->
635 <xsl:template match="userinput[@remap='configure']">
636 <xsl:apply-templates select="." mode="configure"/>
637 </xsl:template>
638
639
640 <!-- userinput @remap='make' -->
641 <xsl:template match="userinput[@remap='make']">
642 <xsl:apply-templates select="." mode="make"/>
643 </xsl:template>
644
645
646 <!-- userinput @remap='install' -->
647 <xsl:template match="userinput[@remap='install']">
648 <xsl:apply-templates select="." mode="install"/>
649 </xsl:template>
650
651
652 <!-- userinput @remap='adjust' -->
653 <xsl:template match="userinput[@remap='adjust']">
654 <xsl:apply-templates select="." mode="adjust"/>
655 </xsl:template>
656
657
658 <!-- userinput @remap='locale-test' -->
659 <xsl:template match="userinput[@remap='locale-test']">
660 <xsl:apply-templates select="." mode="locale-test"/>
661 </xsl:template>
662
663
664 <!-- userinput @remap='locale-full' -->
665 <xsl:template match="userinput[@remap='locale-full']">
666 <xsl:apply-templates select="." mode="locale-full"/>
667 </xsl:template>
668
669
670
671 <!-- userinput without @remap -->
672 <xsl:template match="userinput">
673 <xsl:choose>
674 <xsl:when test="ancestor::sect2[@role='configuration']">
675 <xsl:apply-templates select="." mode="configuration_section"/>
676 </xsl:when>
677 <xsl:otherwise>
678 <xsl:apply-templates select="." mode="no_remap"/>
679 </xsl:otherwise>
680 </xsl:choose>
681 </xsl:template>
682
683
684 <!-- replaceable -->
685 <xsl:template match="replaceable">
686 <xsl:choose>
687 <!-- Configuring the Time Zone -->
688 <xsl:when test="ancestor::sect2[@id='conf-glibc'] and string()='&lt;xxx&gt;'">
689 <xsl:value-of select="$timezone"/>
690 </xsl:when>
691 <!-- Set paper size for Groff build -->
692 <xsl:when test="string()='&lt;paper_size&gt;'">
693 <xsl:value-of select="$page"/>
694 </xsl:when>
695 <!-- LANG setting in /etc/profile -->
696 <xsl:when test="contains(string(),'&lt;ll&gt;_&lt;CC&gt;')">
697 <xsl:value-of select="$lang"/>
698 </xsl:when>
699 <xsl:otherwise>
700 <xsl:text>**EDITME</xsl:text>
701 <xsl:apply-templates/>
702 <xsl:text>EDITME**</xsl:text>
703 </xsl:otherwise>
704 </xsl:choose>
705 </xsl:template>
706
707
708<!-- ######################################################################## -->
709
710<!-- ############################# MODE TEMPLATES ########################### -->
711
712
713 <!-- mode test -->
714 <xsl:template match="userinput" mode="test">
715 <xsl:param name="run_this_test" select="foo"/>
716 <xsl:if test="$run_this_test = '1'">
717 <xsl:choose>
718 <!-- Final system Glibc -->
719 <xsl:when test="contains(string(),'glibc-check-log')">
720 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
721 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
722 </xsl:when>
723 <!-- Module-Init-Tools -->
724 <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
725 and contains(string(),'make check')">
726 <xsl:value-of select="substring-before(string(),' check')"/>
727 <xsl:if test="$bomb-testsuite = 'n'">
728 <xsl:text> -k</xsl:text>
729 </xsl:if>
730 <xsl:text> check &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
731 <xsl:if test="$bomb-testsuite = 'n'">
732 <xsl:text> || true</xsl:text>
733 </xsl:if>
734 <xsl:value-of select="substring-after(string(),' check')"/>
735 </xsl:when>
736 <!-- If the book uses -k, the testsuite should never bomb -->
737 <xsl:when test="contains(string(),'make -k ')">
738 <xsl:apply-templates select="." mode="default"/>
739 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
740 </xsl:when>
741 <!-- Extra commands in Binutils and GCC -->
742 <xsl:when test="contains(string(),'test_summary') or
743 contains(string(),'expect -c')">
744 <xsl:apply-templates select="." mode="default"/>
745 <xsl:text> &gt;&gt; $TEST_LOG</xsl:text>
746 </xsl:when>
747 <!-- Remaining extra testsuite commads that don't need be hacked -->
748 <xsl:when test="not(contains(string(),'make '))">
749 <xsl:apply-templates select="." mode="default"/>
750 </xsl:when>
751 <!-- Normal testsites run -->
752 <xsl:otherwise>
753 <xsl:choose>
754 <!-- No bomb on failures -->
755 <xsl:when test="$bomb-testsuite = 'n'">
756 <xsl:value-of select="substring-before(string(),'make ')"/>
757 <xsl:text>make -k </xsl:text>
758 <xsl:value-of select="substring-after(string(),'make ')"/>
759 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
760 </xsl:when>
761 <!-- Bomb at the first failure -->
762 <xsl:otherwise>
763 <xsl:apply-templates select="." mode="default"/>
764 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
765 </xsl:otherwise>
766 </xsl:choose>
767 </xsl:otherwise>
768 </xsl:choose>
769 </xsl:if>
770 </xsl:template>
771
772
773 <!-- mode pre -->
774 <xsl:template match="userinput" mode="pre">
775 <xsl:apply-templates select="." mode="default"/>
776 </xsl:template>
777
778
779 <!-- mode configure -->
780 <xsl:template match="userinput" mode="configure">
781 <xsl:apply-templates select="." mode="default"/>
782 </xsl:template>
783
784
785 <!-- mode make -->
786 <xsl:template match="userinput" mode="make">
787 <xsl:apply-templates select="." mode="default"/>
788 </xsl:template>
789
790
791 <!-- mode install -->
792 <xsl:template match="userinput" mode="install">
793 <xsl:apply-templates select="." mode="default"/>
794 </xsl:template>
795
796
797 <!-- mode adjust -->
798 <xsl:template match="userinput" mode="adjust">
799 <xsl:apply-templates select="." mode="default"/>
800 </xsl:template>
801
802
803 <!-- mode locale-test -->
804 <xsl:template match="userinput" mode="locale-test">
805 <xsl:apply-templates select="." mode="default"/>
806 </xsl:template>
807
808
809 <!-- mode locale-full -->
810 <xsl:template match="userinput" mode="locale-full">
811 <xsl:apply-templates select="." mode="default"/>
812 </xsl:template>
813
814
815 <!-- mode configuration_section -->
816 <xsl:template match="userinput" mode="configuration_section">
817 <xsl:apply-templates select="." mode="default"/>
818 </xsl:template>
819
820
821 <!-- mode no_remap -->
822 <xsl:template match="userinput" mode="no_remap">
823 <xsl:apply-templates select="." mode="default"/>
824 </xsl:template>
825
826
827 <!-- mode default -->
828 <xsl:template match="userinput" mode="default">
829 <xsl:apply-templates/>
830 </xsl:template>
831
832</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.