source: LFS/lfs.xsl@ 570c9f3

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

Unpacking the tarballs from inside the build scripts.

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