source: LFS/lfs.xsl@ 81a7fb8

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

Fix to track last book tagging change.

  • Property mode set to 100644
File size: 12.6 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>
[4afcedb]103 <xsl:apply-templates select=".//screen"/>
[31d6944]104 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
[4afcedb]105 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
[31d6944]106 <xsl:text>&#xA;</xsl:text>
107 </xsl:if>
[68713c9]108 <xsl:if test="not(@id='ch-system-chroot') and
109 not(@id='ch-system-revisedchroot')">
110 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
111 </xsl:if>
112 <xsl:text>exit&#xA;</xsl:text>
[c4cf6de]113 </exsl:document>
114 </xsl:if>
[557fe91]115 </xsl:template>
116
117 <xsl:template match="screen">
[31d6944]118 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
119 <xsl:apply-templates select="userinput" mode="screen"/>
[557fe91]120 </xsl:if>
121 </xsl:template>
122
[db9cec6]123 <xsl:template match="userinput" mode="screen">
[3eb60fa]124 <xsl:choose>
[fd691b4]125 <!-- Estandarized package formats -->
[92568bf]126 <xsl:when test="contains(string(),'tar.gz')">
127 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
[be9970b]128 <xsl:text>tar.*</xsl:text>
[92568bf]129 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
[fd691b4]130 <xsl:text>&#xA;</xsl:text>
131 </xsl:when>
132 <!-- Avoiding a race condition in a patch -->
133 <xsl:when test="contains(string(),'debian_fixes')">
134 <xsl:value-of select="substring-before(string(),'patch')"/>
135 <xsl:text>patch -Z</xsl:text>
136 <xsl:value-of select="substring-after(string(),'patch')"/>
137 <xsl:text>&#xA;</xsl:text>
138 </xsl:when>
[ccc7c2b]139 <!-- Fix Udev reinstallation after a build failure -->
140 <xsl:when test="contains(string(),'firmware,udev')">
141 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
142 <xsl:apply-templates/>
143 <xsl:text>&#xA;fi&#xA;</xsl:text>
144 </xsl:when>
[fd691b4]145 <!-- Copying the kernel config file -->
146 <xsl:when test="string() = 'make mrproper'">
147 <xsl:text>make mrproper&#xA;</xsl:text>
148 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
[92568bf]149 </xsl:when>
[49d4af4]150 <!-- The Bash, Coreutils, and Module-Init-Tools test suites are optional -->
[a229600]151 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[49d4af4]152 ancestor::sect1[@id='ch-system-bash'] or
[4afcedb]153 ancestor::sect1[@id='ch-system-module-init-tools'])
154 and @remap = 'test'">
[a229600]155 <xsl:choose>
156 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
157 <xsl:otherwise>
[49d4af4]158 <xsl:if test="not(contains(string(),'check')) and
[2c2d830]159 not(contains(string(),'make tests'))">
[28f4756]160 <xsl:apply-templates/>
161 <xsl:text>&#xA;</xsl:text>
162 </xsl:if>
[49d4af4]163 <!-- Coreutils and Module-Init-Tools -->
[a229600]164 <xsl:if test="contains(string(),'check')">
[28f4756]165 <xsl:choose>
[401f81e]166 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]167 <xsl:value-of select="substring-before(string(),'check')"/>
168 <xsl:text>-k check</xsl:text>
169 <xsl:value-of select="substring-after(string(),'check')"/>
170 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
171 </xsl:when>
172 <xsl:otherwise>
173 <xsl:apply-templates/>
[49d4af4]174 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
175 <xsl:if test="contains(string(),' -k ')">
176 <xsl:text> || true</xsl:text>
177 </xsl:if>
178 <xsl:text>&#xA;</xsl:text>
179 </xsl:otherwise>
180 </xsl:choose>
181 </xsl:if>
182 <!-- Bash -->
[2c2d830]183 <xsl:if test="contains(string(),'make tests')">
[49d4af4]184 <xsl:choose>
185 <xsl:when test="$bomb-testsuite = 'n'">
186 <xsl:value-of select="substring-before(string(),'tests')"/>
187 <xsl:text>-k tests</xsl:text>
188 <xsl:value-of select="substring-after(string(),'tests')"/>
189 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
190 </xsl:when>
191 <xsl:otherwise>
192 <xsl:apply-templates/>
[a1f1969]193 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
194 <xsl:if test="contains(string(),' -k ')">
195 <xsl:text> || true</xsl:text>
196 </xsl:if>
197 <xsl:text>&#xA;</xsl:text>
[28f4756]198 </xsl:otherwise>
199 </xsl:choose>
[a229600]200 </xsl:if>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:when>
[fd691b4]204 <!-- Fixing toolchain test suites run -->
[4afcedb]205 <xsl:when test="(string() = 'make check' or
206 string() = 'make -k check') and
207 (ancestor::sect1[@id='ch-system-gcc'] or
208 ancestor::sect1[@id='ch-system-glibc'] or
209 ancestor::sect1[@id='ch-system-binutils'] or
210 ancestor::sect1[@id='ch-tools-gcc-pass2'])">
[01e51a1]211 <xsl:choose>
[31d6944]212 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
213 ancestor::chapter[@id='chapter-building-system']) or
214 $testsuite = '3'">
[28f4756]215 <xsl:choose>
[401f81e]216 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]217 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
218 </xsl:when>
219 <xsl:otherwise>
220 <xsl:apply-templates/>
[a1f1969]221 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
222 <xsl:if test="contains(string(),' -k ')">
223 <xsl:text> || true</xsl:text>
224 </xsl:if>
225 <xsl:text>&#xA;</xsl:text>
[28f4756]226 </xsl:otherwise>
227 </xsl:choose>
[31d6944]228 </xsl:when>
[fd691b4]229 </xsl:choose>
230 </xsl:when>
231 <xsl:when test="contains(string(),'glibc-check-log')">
232 <xsl:choose>
[31d6944]233 <xsl:when test="$testsuite != '0'">
[a229600]234 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
235 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[31d6944]236 </xsl:when>
[01e51a1]237 </xsl:choose>
238 </xsl:when>
[fd691b4]239 <xsl:when test="contains(string(),'test_summary') or
[92568bf]240 contains(string(),'expect -c')">
[01e51a1]241 <xsl:choose>
[31d6944]242 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
243 ancestor::chapter[@id='chapter-building-system']) or
244 $testsuite = '3'">
[01e51a1]245 <xsl:apply-templates/>
[28f4756]246 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[31d6944]247 </xsl:when>
[01e51a1]248 </xsl:choose>
[3eb60fa]249 </xsl:when>
[4afcedb]250 <!-- The rest of testsuites -->
251 <xsl:when test="@remap = 'test'">
252 <xsl:choose>
253 <xsl:when test="$testsuite = '0'"/>
254 <xsl:when test="$testsuite = '1' and
255 not(ancestor::sect1[@id='ch-system-gcc']) and
256 not(ancestor::sect1[@id='ch-system-glibc']) and
257 not(ancestor::sect1[@id='ch-system-binutils'])"/>
258 <xsl:when test="$testsuite = '2' and
259 ancestor::chapter[@id='chapter-temporary-tools']"/>
260 <xsl:otherwise>
261 <xsl:choose>
262 <xsl:when test="$bomb-testsuite = 'n'">
263 <xsl:value-of select="substring-before(string(),'make')"/>
264 <xsl:text>make -k</xsl:text>
265 <xsl:value-of select="substring-after(string(),'make')"/>
266 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
267 </xsl:when>
268 <xsl:otherwise>
269 <xsl:apply-templates/>
270 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
271 <xsl:if test="contains(string(),' -k ')">
272 <xsl:text> || true</xsl:text>
273 </xsl:if>
274 <xsl:text>&#xA;</xsl:text>
275 </xsl:otherwise>
276 </xsl:choose>
277 </xsl:otherwise>
278 </xsl:choose>
279 </xsl:when>
[fd691b4]280 <!-- Don't stop on strip run -->
281 <xsl:when test="contains(string(),'strip ')">
[3eb60fa]282 <xsl:apply-templates/>
[fd691b4]283 <xsl:text> || true&#xA;</xsl:text>
[1f025ca]284 </xsl:when>
[fd691b4]285 <!-- The rest of commands -->
[1f025ca]286 <xsl:otherwise>
287 <xsl:apply-templates/>
[fd691b4]288 <xsl:text>&#xA;</xsl:text>
[1f025ca]289 </xsl:otherwise>
290 </xsl:choose>
291 </xsl:template>
292
[557fe91]293 <xsl:template match="replaceable">
[a41ce58]294 <xsl:choose>
[2a54650]295 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]296 <xsl:value-of select="$timezone"/>
[2a54650]297 </xsl:when>
[a41ce58]298 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]299 <xsl:value-of select="$page"/>
[a41ce58]300 </xsl:when>
[81a7fb8]301 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
302 <xsl:value-of select="$lang"/>
303 </xsl:when>
[a41ce58]304 <xsl:otherwise>
305 <xsl:text>**EDITME</xsl:text>
306 <xsl:apply-templates/>
307 <xsl:text>EDITME**</xsl:text>
308 </xsl:otherwise>
309 </xsl:choose>
[557fe91]310 </xsl:template>
311
312</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.