source: LFS/lfs.xsl@ 1d4eebf

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

LFS: Fixed Bash testsuite run.

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