source: LFS/lfs.xsl@ f11a672

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

Do disk usage meassurament from inside build scripts
plus other fixes to can keep accurate disk usage and SBU reports.
Chroot scripts clean-up.

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