source: HLFS/hlfs.xsl@ 7c4730c

experimental
Last change on this file since 7c4730c was 7c4730c, checked in by George Boudreau <georgeb@…>, 18 years ago

Added trap for chap6 glibc testsuite to hlfs.xsl

  • Property mode set to 100644
File size: 12.1 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 HLFS books. -->
15
16 <!-- What libc implentation must be used? -->
17 <xsl:param name="model" select="glibc"/>
18
19 <!-- Is the host kernel using grsecurity? -->
20 <xsl:param name="grsecurity_host" select="0"/>
21
22 <!-- Compile the keymap into the kernel? -->
23 <xsl:param name="keymap" select="none"/>
24
25 <!-- Run test suites?
26 0 = none
27 1 = only chapter06 Glibc, GCC and Binutils testsuites
28 2 = all chapter06 testsuites
29 3 = all chapter05 and chapter06 testsuites-->
30 <xsl:param name="testsuite" select="1"/>
31
32 <!-- Time zone -->
33 <xsl:param name="timezone" select="GMT"/>
34
35 <!-- Page size -->
36 <xsl:param name="page" select="letter"/>
37
38 <!-- Locale settings -->
39 <xsl:param name="lang" select="C"/>
40 <xsl:param name="lc_all" 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="(../@id='chapter-temporary-tools' or
48 ../@id='chapter-building-system' or
49 ../@id='chapter-bootable') and
50 ((@condition=$model or not(@condition)) and
51 count(descendant::screen/userinput) &gt; 0 and
52 count(descendant::screen/userinput) &gt;
53 count(descendant::screen[@role='nodump']))">
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">
82 <xsl:choose>
83 <xsl:when test="@id='ch-system-changingowner' or
84 @id='ch-system-creatingdirs' or
85 @id='ch-system-createfiles'">
86 <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
87 </xsl:when>
88 <xsl:when test="@id='ch-tools-stripping' or
89 @id='ch-system-strippingagain'">
90 <xsl:text>#!/bin/sh&#xA;</xsl:text>
91 </xsl:when>
92 <xsl:otherwise>
93 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
94 </xsl:otherwise>
95 </xsl:choose>
96 <xsl:if test="(sect2[@role='installation'] and
97 not(@id='bootable-kernel'))">
98 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
99 <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
100 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
101 </xsl:if>
102
103 <!-- NEW toolchain format, from inside ./sources dir unpack binutils and gcc -->
104 <xsl:if test="@id='ch-tools-embryo-toolchain'">
105 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
106 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
107 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
108 </xsl:if>
109 <xsl:if test="@id='ch-tools-cocoon-toolchain'">
110 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
111 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
112 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
113 </xsl:if>
114 <xsl:if test="@id='ch-system-butterfly-toolchain'">
115 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
116 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
117 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
118 </xsl:if>
119 <!-- ONLY butterfly has a testsuite -->
120 <xsl:if test="@id='ch-tools-butterfly-toolchain' and $testsuite = '3'">
121 <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
122 </xsl:if>
123 <!-- END new toolchain format -->
124
125 <xsl:if test="@id='bootable-bootscripts'">
126 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
127 </xsl:if>
128 </xsl:if>
129 <xsl:apply-templates select=".//para/userinput | .//screen"/>
130 <xsl:text>exit</xsl:text>
131 </exsl:document>
132 </xsl:if>
133 </xsl:template>
134
135 <xsl:template match="literal">
136 <xsl:if test="@condition=$model or not(@condition)">
137 <xsl:apply-templates/>
138 </xsl:if>
139 </xsl:template>
140
141 <xsl:template match="screen">
142 <xsl:if test="(@condition=$model or not(@condition)) and
143 child::* = userinput and not(@role = 'nodump')">
144 <xsl:apply-templates select="userinput" mode="screen"/>
145 </xsl:if>
146 </xsl:template>
147
148 <xsl:template match="para/userinput">
149 <xsl:if test="(contains(string(),'test') or
150 contains(string(),'check')) and
151 (($testsuite = '1' and
152 (ancestor::sect1[@id='ch-system-gcc'] or
153 ancestor::sect1[@id='ch-system-glibc'])) or
154 ($testsuite = '2' and
155 ancestor::chapter[@id='chapter-building-system']) or
156 $testsuite = '3')">
157 <xsl:choose>
158 <xsl:when test="ancestor::sect1[@id='ch-system-gcc']">
159 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
160 </xsl:when>
161 <xsl:otherwise>
162 <xsl:value-of select="substring-before(string(),'make')"/>
163 <xsl:text>make -k</xsl:text>
164 <xsl:value-of select="substring-after(string(),'make')"/>
165 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:if>
169 </xsl:template>
170
171 <xsl:template match="userinput" mode="screen">
172 <xsl:choose>
173 <!-- Estandarized package formats -->
174 <xsl:when test="contains(string(),'tar.gz')">
175 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
176 <xsl:text>tar.*</xsl:text>
177 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
178 <xsl:text>&#xA;</xsl:text>
179 </xsl:when>
180 <!-- Avoiding a race condition in a patch -->
181 <xsl:when test="contains(string(),'debian_fixes')">
182 <xsl:value-of select="substring-before(string(),'patch')"/>
183 <xsl:text>patch -Z</xsl:text>
184 <xsl:value-of select="substring-after(string(),'patch')"/>
185 <xsl:text>&#xA;</xsl:text>
186 </xsl:when>
187 <!-- grsecurity kernel in the host? -->
188 <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
189 contains(string(),'sysctl')
190 and $grsecurity_host ='0'"/>
191 <!-- Setting $LC_ALL and $LANG for /etc/profile -->
192 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
193 contains(string(),'export LANG=')">
194 <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
195 <xsl:text>export LC_ALL=</xsl:text>
196 <xsl:value-of select="$lc_all"/>
197 <xsl:text>&#xA;export LANG=</xsl:text>
198 <xsl:value-of select="$lang"/>
199 <xsl:text>&#xA;export INPUTRC</xsl:text>
200 <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
201 <xsl:text>&#xA;</xsl:text>
202 </xsl:when>
203
204
205 <!-- Fixing bootscripts installation -->
206 <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
207 string() = 'make install'">
208 <xsl:text>make install&#xA;</xsl:text>
209 <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
210 </xsl:when>
211 <!-- Compile the keymap into the kernel? -->
212 <xsl:when test="contains(string(),'defkeymap') and
213 $keymap = 'none'"/>
214 <!-- Copying the kernel config file -->
215 <xsl:when test="string() = 'make mrproper'">
216 <xsl:text>make mrproper&#xA;</xsl:text>
217 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
218 </xsl:when>
219 <!-- No interactive commands are needed if the .config file is the proper one -->
220 <xsl:when test="string() = 'make menuconfig'"/>
221 <!-- For uClibc we need to cd to the Gettext package -->
222 <xsl:when test="contains(string(),'cd gettext-runtime/')">
223 <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
224 <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
225 <xsl:text>&#xA;</xsl:text>
226 </xsl:when>
227 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
228 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
229 ancestor::sect1[@id='ch-system-module-init-tools']) and
230 (contains(string(),'check') or
231 contains(string(),'distclean') or
232 contains(string(),'dummy'))">
233 <xsl:choose>
234 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
235 <xsl:otherwise>
236 <xsl:apply-templates/>
237 <xsl:if test="contains(string(),'check')">
238 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
239 </xsl:if>
240 <xsl:text>&#xA;</xsl:text>
241 </xsl:otherwise>
242 </xsl:choose>
243 </xsl:when>
244
245 <!-- Fixing toolchain test suites run -->
246 <xsl:when test="string() = 'make check' or
247 string() = 'make -k check'">
248 <xsl:choose>
249 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
250 ancestor::chapter[@id='chapter-building-system']) or
251 $testsuite = '3'">
252 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
253 </xsl:when>
254 </xsl:choose>
255 </xsl:when>
256
257 <!-- Disable any glibc checks -->
258 <xsl:when test="contains(string(),'gcc -fno-stack-protector') and
259 ancestor::sect1[@id='ch-system-glibc']
260 and $testsuite = '0'"/>
261
262 <!-- Don't stop on strip run and chapter05 GCC installation test-->
263 <xsl:when test="contains(string(),'strip ') or
264 ancestor::sect2[@id='testing-gcc'] and
265 not(contains(string(),'EOF'))">
266 <xsl:apply-templates/>
267 <xsl:text> || true&#xA;</xsl:text>
268 </xsl:when>
269
270 <!-- The rest of commands -->
271 <xsl:otherwise>
272 <xsl:apply-templates/>
273 <xsl:text>&#xA;</xsl:text>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:template>
277
278 <xsl:template match="replaceable">
279 <xsl:choose>
280 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
281 ancestor::sect1[@id='ch-system-uclibc']">
282 <xsl:value-of select="$timezone"/>
283 </xsl:when>
284 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
285 <xsl:value-of select="$page"/>
286 </xsl:when>
287 <xsl:when test="ancestor::sect1[@id='bootable-kernel']">
288 <xsl:value-of select="$keymap"/>
289 </xsl:when>
290 <xsl:otherwise>
291 <xsl:text>**EDITME</xsl:text>
292 <xsl:apply-templates/>
293 <xsl:text>EDITME**</xsl:text>
294 </xsl:otherwise>
295 </xsl:choose>
296 </xsl:template>
297
298</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.