source: HLFS/hlfs.xsl@ ff43bb8

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

HLFS: revised testsuites run.

  • Property mode set to 100644
File size: 12.4 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
4 %general-entities;
5]>
6
7<!-- $Id$ -->
8
9<xsl:stylesheet 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
14<!-- XSLT stylesheet to create shell scripts from HLFS books. -->
15
16 <!-- What libc implentation must be used? -->
17 <xsl:param name="model" select="glibc"/>
18
19 <!-- Is the host kernel using grsecurity? -->
20 <xsl:param name="grsecurity_host" select="n"/>
21
22 <!-- Run test suites?
23 0 = none
24 1 = only chapter06 Glibc, GCC and Binutils testsuites
25 2 = all chapter06 testsuites
26 3 = alias to 2
27 -->
28 <xsl:param name="testsuite" select="1"/>
29
30 <!-- Bomb on test suites failures?
31 n = no, I want to build the full system and review the logs
32 y = yes, bomb at the first test suite failure to can review the build dir
33 -->
34 <xsl:param name="bomb-testsuite" select="n"/>
35
36 <!-- Time zone -->
37 <xsl:param name="timezone" select="GMT"/>
38
39 <!-- Page size -->
40 <xsl:param name="page" select="letter"/>
41
42 <!-- Locale settings -->
43 <xsl:param name="lang" select="C"/>
44 <xsl:param name="lc_all" select="C"/>
45
46 <xsl:template match="/">
47 <xsl:apply-templates select="//sect1"/>
48 </xsl:template>
49
50 <xsl:template match="sect1">
51 <xsl:if test="(../@id='chapter-temporary-tools' or
52 ../@id='chapter-building-system' or
53 ../@id='chapter-bootable') and
54 ((@condition=$model or not(@condition)) and
55 count(descendant::screen/userinput) &gt; 0 and
56 count(descendant::screen/userinput) &gt;
57 count(descendant::screen[@role='nodump']))">
58 <!-- The dirs names -->
59 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
60 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
61 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
62 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
63 <!-- The file names -->
64 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
65 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
66 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
67 <!-- The build order -->
68 <xsl:variable name="position" select="position()"/>
69 <xsl:variable name="order">
70 <xsl:choose>
71 <xsl:when test="string-length($position) = 1">
72 <xsl:text>00</xsl:text>
73 <xsl:value-of select="$position"/>
74 </xsl:when>
75 <xsl:when test="string-length($position) = 2">
76 <xsl:text>0</xsl:text>
77 <xsl:value-of select="$position"/>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:value-of select="$position"/>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:variable>
84 <!-- Creating dirs and files -->
85 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
86 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
87 <xsl:if test="not(@id='ch-tools-stripping') and
88 not(@id='ch-system-strippingagain')">
89 <xsl:text>set -e&#xA;</xsl:text>
90 </xsl:if>
91 <xsl:text>&#xA;</xsl:text>
92 <xsl:if test="(sect2[@role='installation'] and
93 not(@id='bootable-kernel'))">
94 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
95 <xsl:if test="@id='ch-system-uclibc'">
96 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
97 </xsl:if>
98
99 <!-- NEW toolchain format, from inside ./sources dir unpack binutils and gcc -->
100 <xsl:if test="@id='ch-tools-embryo-toolchain' or
101 @id='ch-tools-cocoon-toolchain' or
102 @id='ch-system-butterfly-toolchain'">
103 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
104 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
105 </xsl:if>
106 <xsl:if test="@id='ch-tools-cocoon-toolchain' or
107 @id='ch-system-butterfly-toolchain'">
108 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
109 </xsl:if>
110 <!-- ONLY butterfly has a testsuite -->
111 <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
112 <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
113 </xsl:if>
114 <!-- END new toolchain format -->
115
116 <xsl:if test="@id='bootable-bootscripts'">
117 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
118 </xsl:if>
119 </xsl:if>
120 <xsl:apply-templates select=".//para/userinput | .//screen"/>
121 <xsl:text>exit</xsl:text>
122 </exsl:document>
123 </xsl:if>
124 </xsl:template>
125
126 <xsl:template match="screen">
127 <xsl:if test="(@condition=$model or not(@condition)) and
128 child::* = userinput and not(@role = 'nodump')">
129 <xsl:apply-templates select="userinput" mode="screen"/>
130 </xsl:if>
131 </xsl:template>
132
133 <xsl:template match="para/userinput">
134 <xsl:if test="(contains(string(),'test') or
135 contains(string(),'check')) and
136 ($testsuite = '2' or $testsuite = '3')">
137 <xsl:choose>
138 <xsl:when test="$bomb-testsuite = 'n'">
139 <xsl:value-of select="substring-before(string(),'make')"/>
140 <xsl:text>make -k</xsl:text>
141 <xsl:value-of select="substring-after(string(),'make')"/>
142 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
143 </xsl:when>
144 <xsl:otherwise>
145 <xsl:apply-templates/>
146 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
147 <xsl:if test="contains(string(),' -k ')">
148 <xsl:text> || true</xsl:text>
149 </xsl:if>
150 <xsl:text>&#xA;</xsl:text>
151 </xsl:otherwise>
152 </xsl:choose>
153 </xsl:if>
154 </xsl:template>
155
156 <xsl:template match="userinput" mode="screen">
157 <xsl:choose>
158 <!-- Estandarized package formats -->
159 <xsl:when test="contains(string(),'tar.gz')">
160 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
161 <xsl:text>tar.*</xsl:text>
162 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
163 <xsl:text>&#xA;</xsl:text>
164 </xsl:when>
165 <!-- grsecurity kernel in the host? -->
166 <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
167 contains(string(),'sysctl')
168 and $grsecurity_host ='n'"/>
169 <!-- Setting $LC_ALL and $LANG for /etc/profile -->
170 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
171 contains(string(),'export LANG=')">
172 <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
173 <xsl:text>export LC_ALL=</xsl:text>
174 <xsl:value-of select="$lc_all"/>
175 <xsl:text>&#xA;export LANG=</xsl:text>
176 <xsl:value-of select="$lang"/>
177 <xsl:text>&#xA;export INPUTRC</xsl:text>
178 <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
179 <xsl:text>&#xA;</xsl:text>
180 </xsl:when>
181 <!-- Fixing bootscripts installation -->
182 <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
183 string() = 'make install'">
184 <xsl:text>make install&#xA;</xsl:text>
185 <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
186 </xsl:when>
187 <!-- Compile the keymap into the kernel has been dissabled -->
188 <xsl:when test="contains(string(),'defkeymap')"/>
189 <!-- Copying the kernel config file -->
190 <xsl:when test="string() = 'make mrproper'">
191 <xsl:text>make mrproper&#xA;</xsl:text>
192 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
193 </xsl:when>
194 <!-- No interactive commands are needed if the .config file is the proper one -->
195 <xsl:when test="string() = 'make menuconfig'"/>
196 <!-- For uClibc we need to cd to the Gettext package -->
197 <xsl:when test="contains(string(),'cd gettext-runtime/')">
198 <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
199 <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
200 <xsl:text>&#xA;</xsl:text>
201 </xsl:when>
202 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
203 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
204 ancestor::sect1[@id='ch-system-module-init-tools']) and
205 (contains(string(),'check') or
206 contains(string(),'distclean') or
207 contains(string(),'dummy'))">
208 <xsl:choose>
209 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
210 <xsl:otherwise>
211 <xsl:if test="not(contains(string(),'check'))">
212 <xsl:apply-templates/>
213 <xsl:text>&#xA;</xsl:text>
214 </xsl:if>
215 <xsl:if test="contains(string(),'check')">
216 <xsl:choose>
217 <xsl:when test="$bomb-testsuite = 'n'">
218 <xsl:value-of select="substring-before(string(),'check')"/>
219 <xsl:text>-k check</xsl:text>
220 <xsl:value-of select="substring-after(string(),'check')"/>
221 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
222 </xsl:when>
223 <xsl:otherwise>
224 <xsl:apply-templates/>
225 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
226 <xsl:if test="contains(string(),' -k ')">
227 <xsl:text> || true</xsl:text>
228 </xsl:if>
229 <xsl:text>&#xA;</xsl:text>
230 </xsl:otherwise>
231 </xsl:choose>
232 </xsl:if>
233 </xsl:otherwise>
234 </xsl:choose>
235 </xsl:when>
236 <!-- Fixing butterfly toolchain test suites run -->
237 <xsl:when test="string() = 'make -k check'
238 or string() = 'make check'
239 or string() = 'make tests'">
240 <xsl:choose>
241 <xsl:when test="(ancestor::sect1[@id='ch-system-butterfly-toolchain']
242 and $testsuite != '0') or
243 $testsuite = '2' or $testsuite = '3'">
244 <xsl:choose>
245 <xsl:when test="$bomb-testsuite = 'n'">
246 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
247 </xsl:when>
248 <xsl:otherwise>
249 <xsl:apply-templates/>
250 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
251 <xsl:if test="contains(string(),' -k ')">
252 <xsl:text> || true</xsl:text>
253 </xsl:if>
254 <xsl:text>&#xA;</xsl:text>
255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:when>
258 </xsl:choose>
259 </xsl:when>
260 <!-- Fixing Glbc test suite -->
261 <xsl:when test="contains(string(),'glibc-check-log')">
262 <xsl:choose>
263 <xsl:when test="$testsuite != '0'">
264 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
265 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
266 </xsl:when>
267 </xsl:choose>
268 </xsl:when>
269 <!-- Don't stop on strip run -->
270 <xsl:when test="contains(string(),'strip ') or
271 ancestor::sect2[@id='testing-gcc'] and
272 not(contains(string(),'EOF'))">
273 <xsl:apply-templates/>
274 <xsl:text> || true&#xA;</xsl:text>
275 </xsl:when>
276 <!-- The rest of commands -->
277 <xsl:otherwise>
278 <xsl:apply-templates/>
279 <xsl:text>&#xA;</xsl:text>
280 </xsl:otherwise>
281 </xsl:choose>
282 </xsl:template>
283
284 <xsl:template match="literal">
285 <xsl:if test="@condition=$model or not(@condition)">
286 <xsl:apply-templates/>
287 </xsl:if>
288 </xsl:template>
289
290 <xsl:template match="replaceable">
291 <xsl:choose>
292 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
293 ancestor::sect1[@id='ch-system-uclibc']">
294 <xsl:value-of select="$timezone"/>
295 </xsl:when>
296 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
297 <xsl:value-of select="$page"/>
298 </xsl:when>
299 <xsl:otherwise>
300 <xsl:text>**EDITME</xsl:text>
301 <xsl:apply-templates/>
302 <xsl:text>EDITME**</xsl:text>
303 </xsl:otherwise>
304 </xsl:choose>
305 </xsl:template>
306
307</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.