source: CLFS/clfs.xsl@ 513b259

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

CLFS: Removed "cd " from 108-multiarch_wrapper.
Thanks to Mario Lang for the report.

  • Property mode set to 100644
File size: 11.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 CLFS books. -->
15
16 <!-- Build method used -->
17 <xsl:param name="method" select="chroot"/>
18
19 <!-- Run test suites?
20 0 = none
21 1 = only Glibc, GCC and Binutils testsuites
22 2 = all testsuites
23 3 = alias to 2
24 -->
25 <xsl:param name="testsuite" select="1"/>
26
27 <!-- Bomb on test suites failures?
28 n = no, I want to build the full system and review the logs
29 y = yes, bomb at the first test suite failure to can review the build dir
30 -->
31 <xsl:param name="bomb-testsuite" select="n"/>
32
33 <!-- Install vim-lang package? -->
34 <xsl:param name="vim-lang" select="y"/>
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
45 <xsl:template match="/">
46 <xsl:apply-templates select="//sect1"/>
47 </xsl:template>
48
49 <xsl:template match="sect1">
50 <xsl:choose>
51 <xsl:when test="../@id='chapter-partitioning' or
52 ../@id='chapter-getting-materials' or
53 ../@id='chapter-final-preps'"/>
54 <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
55 <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
56 <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
57 <xsl:otherwise>
58 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
59 count(descendant::screen/userinput) &gt;
60 count(descendant::screen[@role='nodump'])">
61 <!-- The dirs names -->
62 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
63 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
64 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
65 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
66 <!-- The file names -->
67 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
68 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
69 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
70 <!-- The build order -->
71 <xsl:variable name="position" select="position()"/>
72 <xsl:variable name="order">
73 <xsl:choose>
74 <xsl:when test="string-length($position) = 1">
75 <xsl:text>00</xsl:text>
76 <xsl:value-of select="$position"/>
77 </xsl:when>
78 <xsl:when test="string-length($position) = 2">
79 <xsl:text>0</xsl:text>
80 <xsl:value-of select="$position"/>
81 </xsl:when>
82 <xsl:otherwise>
83 <xsl:value-of select="$position"/>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:variable>
87 <!-- Creating dirs and files -->
88 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
89 <xsl:choose>
90 <xsl:when test="@id='ch-chroot-changingowner' or
91 @id='ch-chroot-creatingdirs' or
92 @id='ch-chroot-createfiles' or
93 @id='ch-system-stripping'">
94 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
95 </xsl:when>
96 <xsl:otherwise>
97 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
98 </xsl:otherwise>
99 </xsl:choose>
100 <xsl:if test="not(@id='ch-system-stripping')">
101 <xsl:text>set -e</xsl:text>
102 </xsl:if>
103 <xsl:text>&#xA;</xsl:text>
104 <xsl:if test="sect2[@role='installation'] and
105 not(@id='ch-system-multiarch-wrapper')">
106 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
107 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
108 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
109 </xsl:if>
110 </xsl:if>
111 <xsl:apply-templates select=".//para/userinput | .//screen"/>
112 <xsl:text>exit</xsl:text>
113 </exsl:document>
114 </xsl:if>
115 </xsl:otherwise>
116 </xsl:choose>
117 </xsl:template>
118
119 <xsl:template match="screen">
120 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
121 <xsl:apply-templates select="userinput" mode="screen"/>
122 </xsl:if>
123 </xsl:template>
124
125 <xsl:template match="para/userinput">
126 <xsl:if test="(contains(string(),'test') or
127 contains(string(),'check')) and
128 ($testsuite = '2' or $testsuite = '3')">
129 <xsl:choose>
130 <xsl:when test="$bomb-testsuite = 'n'">
131 <xsl:value-of select="substring-before(string(),'make')"/>
132 <xsl:text>make -k</xsl:text>
133 <xsl:value-of select="substring-after(string(),'make')"/>
134 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
135 </xsl:when>
136 <xsl:otherwise>
137 <xsl:apply-templates/>
138 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
139 <xsl:if test="contains(string(),' -k ')">
140 <xsl:text> || true</xsl:text>
141 </xsl:if>
142 <xsl:text>&#xA;</xsl:text>
143 </xsl:otherwise>
144 </xsl:choose>
145 </xsl:if>
146 </xsl:template>
147
148 <xsl:template match="userinput" mode="screen">
149 <xsl:choose>
150 <!-- Estandarized package formats -->
151 <xsl:when test="contains(string(),'tar.gz')">
152 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
153 <xsl:text>tar.*</xsl:text>
154 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
155 <xsl:text>&#xA;</xsl:text>
156 </xsl:when>
157 <!-- Setting $LANG for /etc/profile -->
158 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
159 contains(string(),'export LANG=')">
160 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
161 <xsl:text>export LANG=</xsl:text>
162 <xsl:value-of select="$lang"/>
163 <xsl:value-of select="substring-after(string(),'charmap]')"/>
164 <xsl:text>&#xA;</xsl:text>
165 </xsl:when>
166 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
167 <xsl:when test="contains(string(),'defkeymap')"/>
168 <!-- Copying the kernel config file -->
169 <xsl:when test="string() = 'make mrproper'">
170 <xsl:text>make mrproper&#xA;</xsl:text>
171 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
172 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
173 </xsl:if>
174 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
175 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
176 </xsl:if>
177 </xsl:when>
178 <!-- No interactive commands are needed if the .config file is the proper one -->
179 <xsl:when test="contains(string(),'menuconfig')"/>
180 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
181 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
182 ancestor::sect1[@id='ch-system-module-init-tools']) and
183 (contains(string(),'check') or
184 contains(string(),'dummy'))">
185 <xsl:choose>
186 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
187 <xsl:otherwise>
188 <xsl:if test="not(contains(string(),'check'))">
189 <xsl:apply-templates/>
190 <xsl:text>&#xA;</xsl:text>
191 </xsl:if>
192 <xsl:if test="contains(string(),'check')">
193 <xsl:choose>
194 <xsl:when test="$bomb-testsuite = 'n'">
195 <xsl:value-of select="substring-before(string(),'check')"/>
196 <xsl:text>-k check</xsl:text>
197 <xsl:value-of select="substring-after(string(),'check')"/>
198 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
199 </xsl:when>
200 <xsl:otherwise>
201 <xsl:apply-templates/>
202 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
203 <xsl:if test="contains(string(),' -k ')">
204 <xsl:text> || true</xsl:text>
205 </xsl:if>
206 <xsl:text>&#xA;</xsl:text>
207 </xsl:otherwise>
208 </xsl:choose>
209 </xsl:if>
210 </xsl:otherwise>
211 </xsl:choose>
212 </xsl:when>
213 <!-- Fixing toolchain test suites run -->
214 <xsl:when test="string() = 'make check' or
215 string() = 'make -k check'">
216 <xsl:choose>
217 <xsl:when test="$testsuite != '0'">
218 <xsl:choose>
219 <xsl:when test="$bomb-testsuite = 'n'">
220 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
221 </xsl:when>
222 <xsl:otherwise>
223 <xsl:apply-templates/>
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>
229 </xsl:otherwise>
230 </xsl:choose>
231 </xsl:when>
232 </xsl:choose>
233 </xsl:when>
234 <xsl:when test="contains(string(),'glibc-check-log')">
235 <xsl:choose>
236 <xsl:when test="$testsuite != '0'">
237 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
238 <xsl:choose>
239 <xsl:when test="$bomb-testsuite = 'n'">
240 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
241 </xsl:when>
242 <xsl:otherwise>
243 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
244 <xsl:if test="contains(string(),' -k ')">
245 <xsl:text> || true</xsl:text>
246 </xsl:if>
247 <xsl:text>&#xA;</xsl:text>
248 </xsl:otherwise>
249 </xsl:choose>
250 </xsl:when>
251 </xsl:choose>
252 </xsl:when>
253 <xsl:when test="contains(string(),'test_summary') or
254 contains(string(),'expect -c')">
255 <xsl:choose>
256 <xsl:when test="$testsuite != '0'">
257 <xsl:apply-templates/>
258 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
259 </xsl:when>
260 </xsl:choose>
261 </xsl:when>
262 <!-- Don't stop on strip run -->
263 <xsl:when test="contains(string(),'strip ')">
264 <xsl:apply-templates/>
265 <xsl:text> || true&#xA;</xsl:text>
266 </xsl:when>
267 <!-- The rest of commands -->
268 <xsl:otherwise>
269 <xsl:apply-templates/>
270 <xsl:text>&#xA;</xsl:text>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:template>
274
275 <xsl:template match="replaceable">
276 <xsl:choose>
277 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
278 <xsl:value-of select="$timezone"/>
279 </xsl:when>
280 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
281 <xsl:value-of select="$page"/>
282 </xsl:when>
283 <xsl:otherwise>
284 <xsl:text>**EDITME</xsl:text>
285 <xsl:apply-templates/>
286 <xsl:text>EDITME**</xsl:text>
287 </xsl:otherwise>
288 </xsl:choose>
289 </xsl:template>
290
291</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.