source: LFS/lfs.xsl@ 40700e9

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 40700e9 was 40700e9, checked in by George Boudreau <georgeb@…>, 18 years ago

Mistake::: restore lfs.xsl file

  • Property mode set to 100644
File size: 10.8 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 LFS books. -->
15
16 <!-- Run test suites?
17 0 = none
18 1 = only chapter06 Glibc, GCC and Binutils testsuites
19 2 = all chapter06 testsuites
20 3 = all chapter05 and chapter06 testsuites
21 -->
22 <xsl:param name="testsuite" select="1"/>
23
24 <!-- Bomb on test suites failures?
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
27 -->
28 <xsl:param name="bomb-testsuite" select="n"/>
29
30 <!-- Install vim-lang package? -->
31 <xsl:param name="vim-lang" select="y"/>
32
33 <!-- Time zone -->
34 <xsl:param name="timezone" select="GMT"/>
35
36 <!-- Page size -->
37 <xsl:param name="page" select="letter"/>
38
39 <!-- Locale settings -->
40 <xsl:param name="lang" select="C"/>
41
42 <xsl:template match="/">
43 <xsl:apply-templates select="//sect1"/>
44 </xsl:template>
45
46 <xsl:template match="sect1">
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">
77 <xsl:choose>
78 <xsl:when test="@id='ch-system-changingowner' or
79 @id='ch-system-creatingdirs' or
80 @id='ch-system-createfiles'">
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>
86 </xsl:when>
87 <xsl:otherwise>
88 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
89 </xsl:otherwise>
90 </xsl:choose>
91 <xsl:if test="sect2[@role='installation']">
92 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
93 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
94 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
95 </xsl:if>
96 </xsl:if>
97 <xsl:apply-templates select=".//para/userinput | .//screen"/>
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>
102 <xsl:text>exit</xsl:text>
103 </exsl:document>
104 </xsl:if>
105 </xsl:template>
106
107 <xsl:template match="screen">
108 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
109 <xsl:apply-templates select="userinput" mode="screen"/>
110 </xsl:if>
111 </xsl:template>
112
113 <xsl:template match="para/userinput">
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')">
119 <xsl:choose>
120 <xsl:when test="$bomb-testsuite = 'n'">
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</xsl:text>
129 <xsl:if test="contains(string(),' -k ')">
130 <xsl:text> || true</xsl:text>
131 </xsl:if>
132 <xsl:text>&#xA;</xsl:text>
133 </xsl:otherwise>
134 </xsl:choose>
135 </xsl:if>
136 </xsl:template>
137
138 <xsl:template match="userinput" mode="screen">
139 <xsl:choose>
140 <!-- Estandarized package formats -->
141 <xsl:when test="contains(string(),'tar.gz')">
142 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
143 <xsl:text>tar.*</xsl:text>
144 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
145 <xsl:text>&#xA;</xsl:text>
146 </xsl:when>
147 <!-- Avoiding a race condition in a patch -->
148 <xsl:when test="contains(string(),'debian_fixes')">
149 <xsl:value-of select="substring-before(string(),'patch')"/>
150 <xsl:text>patch -Z</xsl:text>
151 <xsl:value-of select="substring-after(string(),'patch')"/>
152 <xsl:text>&#xA;</xsl:text>
153 </xsl:when>
154 <!-- Fix Udev reinstallation after a build failure -->
155 <xsl:when test="contains(string(),'firmware,udev')">
156 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
157 <xsl:apply-templates/>
158 <xsl:text>&#xA;fi&#xA;</xsl:text>
159 </xsl:when>
160 <!-- Setting $LANG for /etc/profile -->
161 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
162 contains(string(),'export LANG=')">
163 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
164 <xsl:text>export LANG=</xsl:text>
165 <xsl:value-of select="$lang"/>
166 <xsl:value-of select="substring-after(string(),'modifiers>')"/>
167 <xsl:text>&#xA;</xsl:text>
168 </xsl:when>
169 <!-- Copying the kernel config file -->
170 <xsl:when test="string() = 'make mrproper'">
171 <xsl:text>make mrproper&#xA;</xsl:text>
172 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
173 </xsl:when>
174 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
175 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
176 ancestor::sect1[@id='ch-system-module-init-tools']) and
177 (contains(string(),'check') or
178 contains(string(),'dummy'))">
179 <xsl:choose>
180 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
181 <xsl:otherwise>
182 <xsl:if test="not(contains(string(),'check'))">
183 <xsl:apply-templates/>
184 <xsl:text>&#xA;</xsl:text>
185 </xsl:if>
186 <xsl:if test="contains(string(),'check')">
187 <xsl:choose>
188 <xsl:when test="$bomb-testsuite = 'n'">
189 <xsl:value-of select="substring-before(string(),'check')"/>
190 <xsl:text>-k check</xsl:text>
191 <xsl:value-of select="substring-after(string(),'check')"/>
192 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
193 </xsl:when>
194 <xsl:otherwise>
195 <xsl:apply-templates/>
196 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
197 <xsl:if test="contains(string(),' -k ')">
198 <xsl:text> || true</xsl:text>
199 </xsl:if>
200 <xsl:text>&#xA;</xsl:text>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:if>
204 </xsl:otherwise>
205 </xsl:choose>
206 </xsl:when>
207 <!-- Fixing toolchain test suites run -->
208 <xsl:when test="string() = 'make check' or
209 string() = 'make -k check'">
210 <xsl:choose>
211 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
212 ancestor::chapter[@id='chapter-building-system']) or
213 $testsuite = '3'">
214 <xsl:choose>
215 <xsl:when test="$bomb-testsuite = 'n'">
216 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
217 </xsl:when>
218 <xsl:otherwise>
219 <xsl:apply-templates/>
220 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
221 <xsl:if test="contains(string(),' -k ')">
222 <xsl:text> || true</xsl:text>
223 </xsl:if>
224 <xsl:text>&#xA;</xsl:text>
225 </xsl:otherwise>
226 </xsl:choose>
227 </xsl:when>
228 </xsl:choose>
229 </xsl:when>
230 <xsl:when test="contains(string(),'glibc-check-log')">
231 <xsl:choose>
232 <xsl:when test="$testsuite != '0'">
233 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
234 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
235 </xsl:when>
236 </xsl:choose>
237 </xsl:when>
238 <xsl:when test="contains(string(),'test_summary') or
239 contains(string(),'expect -c')">
240 <xsl:choose>
241 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
242 ancestor::chapter[@id='chapter-building-system']) or
243 $testsuite = '3'">
244 <xsl:apply-templates/>
245 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
246 </xsl:when>
247 </xsl:choose>
248 </xsl:when>
249 <!-- Don't stop on strip run -->
250 <xsl:when test="contains(string(),'strip ')">
251 <xsl:apply-templates/>
252 <xsl:text> || true&#xA;</xsl:text>
253 </xsl:when>
254 <!-- The rest of commands -->
255 <xsl:otherwise>
256 <xsl:apply-templates/>
257 <xsl:text>&#xA;</xsl:text>
258 </xsl:otherwise>
259 </xsl:choose>
260 </xsl:template>
261
262 <xsl:template match="replaceable">
263 <xsl:choose>
264 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
265 <xsl:value-of select="$timezone"/>
266 </xsl:when>
267 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
268 <xsl:value-of select="$page"/>
269 </xsl:when>
270 <xsl:otherwise>
271 <xsl:text>**EDITME</xsl:text>
272 <xsl:apply-templates/>
273 <xsl:text>EDITME**</xsl:text>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:template>
277
278</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.