source: CLFS/clfs.xsl@ f5413aa

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

Final system strip command scripts need to use #!/tools/bin/bash

  • Property mode set to 100644
File size: 11.3 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']">
105 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
106 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
107 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
108 </xsl:if>
109 </xsl:if>
110 <xsl:apply-templates select=".//para/userinput | .//screen"/>
111 <xsl:text>exit</xsl:text>
112 </exsl:document>
113 </xsl:if>
114 </xsl:otherwise>
115 </xsl:choose>
116 </xsl:template>
117
118 <xsl:template match="screen">
119 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
120 <xsl:apply-templates select="userinput" mode="screen"/>
121 </xsl:if>
122 </xsl:template>
123
124 <xsl:template match="para/userinput">
125 <xsl:if test="(contains(string(),'test') or
126 contains(string(),'check')) and
127 ($testsuite = '2' or $testsuite = '3')">
128 <xsl:choose>
129 <xsl:when test="$bomb-testsuite = 'n'">
130 <xsl:value-of select="substring-before(string(),'make')"/>
131 <xsl:text>make -k</xsl:text>
132 <xsl:value-of select="substring-after(string(),'make')"/>
133 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
134 </xsl:when>
135 <xsl:otherwise>
136 <xsl:apply-templates/>
137 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
138 <xsl:if test="contains(string(),' -k ')">
139 <xsl:text> || true</xsl:text>
140 </xsl:if>
141 <xsl:text>&#xA;</xsl:text>
142 </xsl:otherwise>
143 </xsl:choose>
144 </xsl:if>
145 </xsl:template>
146
147 <xsl:template match="userinput" mode="screen">
148 <xsl:choose>
149 <!-- Estandarized package formats -->
150 <xsl:when test="contains(string(),'tar.gz')">
151 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
152 <xsl:text>tar.*</xsl:text>
153 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
154 <xsl:text>&#xA;</xsl:text>
155 </xsl:when>
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"/>
162 <xsl:value-of select="substring-after(string(),'charmap]')"/>
163 <xsl:text>&#xA;</xsl:text>
164 </xsl:when>
165 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
166 <xsl:when test="contains(string(),'defkeymap')"/>
167 <!-- Copying the kernel config file -->
168 <xsl:when test="string() = 'make mrproper'">
169 <xsl:text>make mrproper&#xA;</xsl:text>
170 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
171 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
172 </xsl:if>
173 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
174 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
175 </xsl:if>
176 </xsl:when>
177 <!-- No interactive commands are needed if the .config file is the proper one -->
178 <xsl:when test="contains(string(),'menuconfig')"/>
179 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
180 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
181 ancestor::sect1[@id='ch-system-module-init-tools']) and
182 (contains(string(),'check') or
183 contains(string(),'dummy'))">
184 <xsl:choose>
185 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
186 <xsl:otherwise>
187 <xsl:if test="not(contains(string(),'check'))">
188 <xsl:apply-templates/>
189 <xsl:text>&#xA;</xsl:text>
190 </xsl:if>
191 <xsl:if test="contains(string(),'check')">
192 <xsl:choose>
193 <xsl:when test="$bomb-testsuite = 'n'">
194 <xsl:value-of select="substring-before(string(),'check')"/>
195 <xsl:text>-k check</xsl:text>
196 <xsl:value-of select="substring-after(string(),'check')"/>
197 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
198 </xsl:when>
199 <xsl:otherwise>
200 <xsl:apply-templates/>
201 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
202 <xsl:if test="contains(string(),' -k ')">
203 <xsl:text> || true</xsl:text>
204 </xsl:if>
205 <xsl:text>&#xA;</xsl:text>
206 </xsl:otherwise>
207 </xsl:choose>
208 </xsl:if>
209 </xsl:otherwise>
210 </xsl:choose>
211 </xsl:when>
212 <!-- Fixing toolchain test suites run -->
213 <xsl:when test="string() = 'make check' or
214 string() = 'make -k check'">
215 <xsl:choose>
216 <xsl:when test="$testsuite != '0'">
217 <xsl:choose>
218 <xsl:when test="$bomb-testsuite = 'n'">
219 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
220 </xsl:when>
221 <xsl:otherwise>
222 <xsl:apply-templates/>
223 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
224 <xsl:if test="contains(string(),' -k ')">
225 <xsl:text> || true</xsl:text>
226 </xsl:if>
227 <xsl:text>&#xA;</xsl:text>
228 </xsl:otherwise>
229 </xsl:choose>
230 </xsl:when>
231 </xsl:choose>
232 </xsl:when>
233 <xsl:when test="contains(string(),'glibc-check-log')">
234 <xsl:choose>
235 <xsl:when test="$testsuite != '0'">
236 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
237 <xsl:choose>
238 <xsl:when test="$bomb-testsuite = 'n'">
239 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
240 </xsl:when>
241 <xsl:otherwise>
242 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
243 <xsl:if test="contains(string(),' -k ')">
244 <xsl:text> || true</xsl:text>
245 </xsl:if>
246 <xsl:text>&#xA;</xsl:text>
247 </xsl:otherwise>
248 </xsl:choose>
249 </xsl:when>
250 </xsl:choose>
251 </xsl:when>
252 <xsl:when test="contains(string(),'test_summary') or
253 contains(string(),'expect -c')">
254 <xsl:choose>
255 <xsl:when test="$testsuite != '0'">
256 <xsl:apply-templates/>
257 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
258 </xsl:when>
259 </xsl:choose>
260 </xsl:when>
261 <!-- Don't stop on strip run -->
262 <xsl:when test="contains(string(),'strip ')">
263 <xsl:apply-templates/>
264 <xsl:text> || true&#xA;</xsl:text>
265 </xsl:when>
266 <!-- The rest of commands -->
267 <xsl:otherwise>
268 <xsl:apply-templates/>
269 <xsl:text>&#xA;</xsl:text>
270 </xsl:otherwise>
271 </xsl:choose>
272 </xsl:template>
273
274 <xsl:template match="replaceable">
275 <xsl:choose>
276 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
277 <xsl:value-of select="$timezone"/>
278 </xsl:when>
279 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
280 <xsl:value-of select="$page"/>
281 </xsl:when>
282 <xsl:otherwise>
283 <xsl:text>**EDITME</xsl:text>
284 <xsl:apply-templates/>
285 <xsl:text>EDITME**</xsl:text>
286 </xsl:otherwise>
287 </xsl:choose>
288 </xsl:template>
289
290</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.