source: LFS/lfs.xsl@ d9daa95

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

Added config option to allow to bommb in test suites faiures.

  • Property mode set to 100644
File size: 10.3 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?
25 0 = no, I want to build the full system and review the logs
26 1 = yes, bomb at the first test suite failure to can review the build dir
27 -->
28 <xsl:param name="bomb-testsuite" select="0"/>
29
[db181c47]30 <!-- Install vim-lang package? -->
31 <xsl:param name="vim-lang" select="1"/>
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">
[c4cf6de]47 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
48 count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
49 <!-- The dirs names -->
50 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
51 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
52 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
53 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
54 <!-- The file names -->
55 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
56 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
57 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
58 <!-- The build order -->
59 <xsl:variable name="position" select="position()"/>
60 <xsl:variable name="order">
61 <xsl:choose>
62 <xsl:when test="string-length($position) = 1">
63 <xsl:text>00</xsl:text>
64 <xsl:value-of select="$position"/>
65 </xsl:when>
66 <xsl:when test="string-length($position) = 2">
67 <xsl:text>0</xsl:text>
68 <xsl:value-of select="$position"/>
69 </xsl:when>
70 <xsl:otherwise>
71 <xsl:value-of select="$position"/>
72 </xsl:otherwise>
73 </xsl:choose>
74 </xsl:variable>
75 <!-- Creating dirs and files -->
76 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[76fad58]77 <xsl:choose>
78 <xsl:when test="@id='ch-system-changingowner' or
79 @id='ch-system-creatingdirs' or
80 @id='ch-system-createfiles'">
[fd691b4]81 <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
82 </xsl:when>
83 <xsl:when test="@id='ch-tools-stripping' or
84 @id='ch-system-strippingagain'">
85 <xsl:text>#!/bin/sh&#xA;</xsl:text>
[76fad58]86 </xsl:when>
87 <xsl:otherwise>
[fd691b4]88 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
[76fad58]89 </xsl:otherwise>
90 </xsl:choose>
[0d52034]91 <xsl:if test="sect2[@role='installation']">
[fd691b4]92 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[db181c47]93 <xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
[f0eb956]94 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
[db181c47]95 </xsl:if>
[44f88e3]96 </xsl:if>
[db9cec6]97 <xsl:apply-templates select=".//para/userinput | .//screen"/>
[31d6944]98 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
99 <xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/>
100 <xsl:text>&#xA;</xsl:text>
101 </xsl:if>
[816f3f43]102 <xsl:text>exit</xsl:text>
[c4cf6de]103 </exsl:document>
104 </xsl:if>
[557fe91]105 </xsl:template>
106
107 <xsl:template match="screen">
[31d6944]108 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
109 <xsl:apply-templates select="userinput" mode="screen"/>
[557fe91]110 </xsl:if>
111 </xsl:template>
112
[db9cec6]113 <xsl:template match="para/userinput">
[31d6944]114 <xsl:if test="(contains(string(),'test') or
115 contains(string(),'check')) and
116 (($testsuite = '2' and
117 ancestor::chapter[@id='chapter-building-system']) or
118 $testsuite = '3')">
[28f4756]119 <xsl:choose>
120 <xsl:when test="$bomb-testsuite = '0'">
121 <xsl:value-of select="substring-before(string(),'make')"/>
122 <xsl:text>make -k</xsl:text>
123 <xsl:value-of select="substring-after(string(),'make')"/>
124 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
125 </xsl:when>
126 <xsl:otherwise>
127 <xsl:apply-templates/>
128 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
129 </xsl:otherwise>
130 </xsl:choose>
[db9cec6]131 </xsl:if>
132 </xsl:template>
133
134 <xsl:template match="userinput" mode="screen">
[3eb60fa]135 <xsl:choose>
[fd691b4]136 <!-- Estandarized package formats -->
[92568bf]137 <xsl:when test="contains(string(),'tar.gz')">
138 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
[be9970b]139 <xsl:text>tar.*</xsl:text>
[92568bf]140 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
[fd691b4]141 <xsl:text>&#xA;</xsl:text>
142 </xsl:when>
143 <!-- Avoiding a race condition in a patch -->
144 <xsl:when test="contains(string(),'debian_fixes')">
145 <xsl:value-of select="substring-before(string(),'patch')"/>
146 <xsl:text>patch -Z</xsl:text>
147 <xsl:value-of select="substring-after(string(),'patch')"/>
148 <xsl:text>&#xA;</xsl:text>
149 </xsl:when>
[ccc7c2b]150 <!-- Fix Udev reinstallation after a build failure -->
151 <xsl:when test="contains(string(),'firmware,udev')">
152 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
153 <xsl:apply-templates/>
154 <xsl:text>&#xA;fi&#xA;</xsl:text>
155 </xsl:when>
[877cc6a]156 <!-- Setting $LANG for /etc/profile -->
157 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
158 contains(string(),'export LANG=')">
159 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
160 <xsl:text>export LANG=</xsl:text>
161 <xsl:value-of select="$lang"/>
[71445e7]162 <xsl:value-of select="substring-after(string(),'modifiers>')"/>
[877cc6a]163 <xsl:text>&#xA;</xsl:text>
164 </xsl:when>
[fd691b4]165 <!-- Copying the kernel config file -->
166 <xsl:when test="string() = 'make mrproper'">
167 <xsl:text>make mrproper&#xA;</xsl:text>
168 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
[92568bf]169 </xsl:when>
[4e9a3b3]170 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]171 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[4e9a3b3]172 ancestor::sect1[@id='ch-system-module-init-tools']) and
[79f7cf9]173 (contains(string(),'check') or
[a229600]174 contains(string(),'dummy'))">
175 <xsl:choose>
176 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
177 <xsl:otherwise>
[28f4756]178 <xsl:if test="not(contains(string(),'check'))">
179 <xsl:apply-templates/>
180 <xsl:text>&#xA;</xsl:text>
181 </xsl:if>
[a229600]182 <xsl:if test="contains(string(),'check')">
[28f4756]183 <xsl:choose>
184 <xsl:when test="$bomb-testsuite = '0'">
185 <xsl:value-of select="substring-before(string(),'check')"/>
186 <xsl:text>-k check</xsl:text>
187 <xsl:value-of select="substring-after(string(),'check')"/>
188 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:apply-templates/>
192 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
193 </xsl:otherwise>
194 </xsl:choose>
[a229600]195 </xsl:if>
196 </xsl:otherwise>
197 </xsl:choose>
198 </xsl:when>
[fd691b4]199 <!-- Fixing toolchain test suites run -->
[01e51a1]200 <xsl:when test="string() = 'make check' or
201 string() = 'make -k check'">
202 <xsl:choose>
[31d6944]203 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
204 ancestor::chapter[@id='chapter-building-system']) or
205 $testsuite = '3'">
[28f4756]206 <xsl:choose>
207 <xsl:when test="$bomb-testsuite = '0'">
208 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
209 </xsl:when>
210 <xsl:otherwise>
211 <xsl:apply-templates/>
212 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
213 </xsl:otherwise>
214 </xsl:choose>
[31d6944]215 </xsl:when>
[fd691b4]216 </xsl:choose>
217 </xsl:when>
218 <xsl:when test="contains(string(),'glibc-check-log')">
219 <xsl:choose>
[31d6944]220 <xsl:when test="$testsuite != '0'">
[a229600]221 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
222 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[31d6944]223 </xsl:when>
[01e51a1]224 </xsl:choose>
225 </xsl:when>
[fd691b4]226 <xsl:when test="contains(string(),'test_summary') or
[92568bf]227 contains(string(),'expect -c')">
[01e51a1]228 <xsl:choose>
[31d6944]229 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
230 ancestor::chapter[@id='chapter-building-system']) or
231 $testsuite = '3'">
[01e51a1]232 <xsl:apply-templates/>
[28f4756]233 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[31d6944]234 </xsl:when>
[01e51a1]235 </xsl:choose>
[3eb60fa]236 </xsl:when>
[fd691b4]237 <!-- Don't stop on strip run -->
238 <xsl:when test="contains(string(),'strip ')">
[3eb60fa]239 <xsl:apply-templates/>
[fd691b4]240 <xsl:text> || true&#xA;</xsl:text>
[1f025ca]241 </xsl:when>
[fd691b4]242 <!-- The rest of commands -->
[1f025ca]243 <xsl:otherwise>
244 <xsl:apply-templates/>
[fd691b4]245 <xsl:text>&#xA;</xsl:text>
[1f025ca]246 </xsl:otherwise>
247 </xsl:choose>
248 </xsl:template>
249
[557fe91]250 <xsl:template match="replaceable">
[a41ce58]251 <xsl:choose>
[2a54650]252 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]253 <xsl:value-of select="$timezone"/>
[2a54650]254 </xsl:when>
[a41ce58]255 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]256 <xsl:value-of select="$page"/>
[a41ce58]257 </xsl:when>
258 <xsl:otherwise>
259 <xsl:text>**EDITME</xsl:text>
260 <xsl:apply-templates/>
261 <xsl:text>EDITME**</xsl:text>
262 </xsl:otherwise>
263 </xsl:choose>
[557fe91]264 </xsl:template>
265
266</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.