source: HLFS/hlfs.xsl@ 76d58bc

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

HLFS: Fixed Coccon sanity checks run.

  • Property mode set to 100644
File size: 13.0 KB
RevLine 
[877cc6a]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
[5c575e1]19 <!-- What kernel serie must be used? -->
20 <xsl:param name="kernel" select="2.6"/>
21
[877cc6a]22 <!-- Is the host kernel using grsecurity? -->
[401f81e]23 <xsl:param name="grsecurity_host" select="n"/>
[877cc6a]24
25 <!-- Run test suites?
26 0 = none
27 1 = only chapter06 Glibc, GCC and Binutils testsuites
28 2 = all chapter06 testsuites
[28f4756]29 3 = alias to 2
30 -->
[877cc6a]31 <xsl:param name="testsuite" select="1"/>
32
[28f4756]33 <!-- Bomb on test suites failures?
[401f81e]34 n = no, I want to build the full system and review the logs
35 y = yes, bomb at the first test suite failure to can review the build dir
[28f4756]36 -->
[401f81e]37 <xsl:param name="bomb-testsuite" select="n"/>
[28f4756]38
[d035526]39 <!-- Additional features -->
40 <xsl:param name="features">,ssp,aslr,pax,hardened_tmp,warnings,misc,blowfish,</xsl:param>
41
[877cc6a]42 <!-- Time zone -->
[a229600]43 <xsl:param name="timezone" select="GMT"/>
[877cc6a]44
45 <!-- Page size -->
46 <xsl:param name="page" select="letter"/>
47
48 <!-- Locale settings -->
[a229600]49 <xsl:param name="lang" select="C"/>
[877cc6a]50
51 <xsl:template match="/">
52 <xsl:apply-templates select="//sect1"/>
53 </xsl:template>
54
55 <xsl:template match="sect1">
56 <xsl:if test="(../@id='chapter-temporary-tools' or
57 ../@id='chapter-building-system' or
58 ../@id='chapter-bootable') and
[c1f28d5]59 (count(descendant::screen/userinput) &gt; 0 and
[877cc6a]60 count(descendant::screen/userinput) &gt;
[c1f28d5]61 count(descendant::screen[@role='nodump'])) and
62 ((@condition=$model or not(@condition)) and
63 (@vendor=$kernel or not(@vendor)))">
[877cc6a]64 <!-- The dirs names -->
65 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
66 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
67 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
68 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
69 <!-- The file names -->
70 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
71 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
72 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
73 <!-- The build order -->
74 <xsl:variable name="position" select="position()"/>
75 <xsl:variable name="order">
76 <xsl:choose>
77 <xsl:when test="string-length($position) = 1">
78 <xsl:text>00</xsl:text>
79 <xsl:value-of select="$position"/>
80 </xsl:when>
81 <xsl:when test="string-length($position) = 2">
82 <xsl:text>0</xsl:text>
83 <xsl:value-of select="$position"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:value-of select="$position"/>
87 </xsl:otherwise>
88 </xsl:choose>
89 </xsl:variable>
90 <!-- Creating dirs and files -->
91 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[1330ebc]92 <xsl:choose>
93 <xsl:when test="@id='ch-system-creatingdirs' or
[7d6fe10]94 @id='ch-system-createfiles' or
[1a39790]95 @id='ch-system-changingowner' or
[7d6fe10]96 @id='ch-system-strippingagain'">
[1330ebc]97 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
98 </xsl:when>
99 <xsl:otherwise>
100 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
101 </xsl:otherwise>
102 </xsl:choose>
[5f4982d]103 <xsl:if test="not(@id='ch-tools-stripping') and
104 not(@id='ch-system-strippingagain')">
105 <xsl:text>set -e&#xA;</xsl:text>
106 </xsl:if>
107 <xsl:text>&#xA;</xsl:text>
[a9d3a9a]108 <xsl:if test="(sect2[@role='installation'])">
[877cc6a]109 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[5e83595]110 <xsl:if test="@id='ch-system-uclibc'">
[877cc6a]111 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
112 </xsl:if>
[4d15d7f]113 <!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
[d81c640]114 <xsl:if test="@id='ch-tools-embryo-toolchain' or
115 @id='ch-tools-cocoon-toolchain' or
116 @id='ch-system-butterfly-toolchain'">
117 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
118 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
[877cc6a]119 </xsl:if>
[30d1215]120 <xsl:if test="@id='ch-tools-cocoon-toolchain' or
121 @id='ch-system-butterfly-toolchain'">
122 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
123 </xsl:if>
[d81c640]124 <!-- ONLY butterfly has a testsuite -->
[b2489fb]125 <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
[d81c640]126 <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
[877cc6a]127 </xsl:if>
[4d15d7f]128 <!-- END SVN toolchain format -->
[877cc6a]129 </xsl:if>
130 <xsl:apply-templates select=".//para/userinput | .//screen"/>
131 <xsl:text>exit</xsl:text>
132 </exsl:document>
133 </xsl:if>
134 </xsl:template>
135
136 <xsl:template match="screen">
137 <xsl:if test="(@condition=$model or not(@condition)) and
[5c575e1]138 (@vendor=$kernel or not(@vendor)) and
[d035526]139 child::* = userinput and (not(@role) or
140 (@role and contains($features,concat(',',@role,','))))">
[877cc6a]141 <xsl:apply-templates select="userinput" mode="screen"/>
142 </xsl:if>
143 </xsl:template>
144
145 <xsl:template match="para/userinput">
146 <xsl:if test="(contains(string(),'test') or
[d81c640]147 contains(string(),'check')) and
148 ($testsuite = '2' or $testsuite = '3')">
[28f4756]149 <xsl:choose>
[401f81e]150 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]151 <xsl:value-of select="substring-before(string(),'make')"/>
152 <xsl:text>make -k</xsl:text>
153 <xsl:value-of select="substring-after(string(),'make')"/>
154 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
155 </xsl:when>
156 <xsl:otherwise>
157 <xsl:apply-templates/>
[a1f1969]158 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
159 <xsl:if test="contains(string(),' -k ')">
160 <xsl:text> || true</xsl:text>
161 </xsl:if>
162 <xsl:text>&#xA;</xsl:text>
[28f4756]163 </xsl:otherwise>
164 </xsl:choose>
[877cc6a]165 </xsl:if>
166 </xsl:template>
167
168 <xsl:template match="userinput" mode="screen">
169 <xsl:choose>
170 <!-- grsecurity kernel in the host? -->
171 <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
172 contains(string(),'sysctl')
[401f81e]173 and $grsecurity_host ='n'"/>
[05760bc]174 <!-- Setting $LANG for /etc/profile -->
[877cc6a]175 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
176 contains(string(),'export LANG=')">
[05760bc]177 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
178 <xsl:text>export LANG=</xsl:text>
[877cc6a]179 <xsl:value-of select="$lang"/>
[05760bc]180 <xsl:value-of select="substring-after(string(),'CC]')"/>
[877cc6a]181 <xsl:text>&#xA;</xsl:text>
182 </xsl:when>
183 <!-- Copying the kernel config file -->
184 <xsl:when test="string() = 'make mrproper'">
185 <xsl:text>make mrproper&#xA;</xsl:text>
186 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
187 </xsl:when>
188 <!-- No interactive commands are needed if the .config file is the proper one -->
189 <xsl:when test="string() = 'make menuconfig'"/>
[3d75bc2]190 <!-- For uClibc we need to set CONFIG_SITE -->
191 <xsl:when test="contains(string(),'CONFIG_SITE')">
192 <xsl:value-of select="substring-before(string(),'export')"/>
193 <xsl:text>echo "export</xsl:text>
194 <xsl:value-of select="substring-after(string(),'export')"/>
195 <xsl:text>" &gt;&gt; ~/.bashrc&#xA;</xsl:text>
196 </xsl:when>
[877cc6a]197 <!-- For uClibc we need to cd to the Gettext package -->
198 <xsl:when test="contains(string(),'cd gettext-runtime/')">
199 <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
200 <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
201 <xsl:text>&#xA;</xsl:text>
202 </xsl:when>
203 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]204 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]205 ancestor::sect1[@id='ch-system-module-init-tools']) and
206 (contains(string(),'check') or
207 contains(string(),'distclean') or
[a229600]208 contains(string(),'dummy'))">
209 <xsl:choose>
210 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
211 <xsl:otherwise>
[28f4756]212 <xsl:if test="not(contains(string(),'check'))">
213 <xsl:apply-templates/>
214 <xsl:text>&#xA;</xsl:text>
215 </xsl:if>
[a229600]216 <xsl:if test="contains(string(),'check')">
[28f4756]217 <xsl:choose>
[401f81e]218 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]219 <xsl:value-of select="substring-before(string(),'check')"/>
220 <xsl:text>-k check</xsl:text>
221 <xsl:value-of select="substring-after(string(),'check')"/>
222 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
223 </xsl:when>
224 <xsl:otherwise>
225 <xsl:apply-templates/>
[a1f1969]226 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
227 <xsl:if test="contains(string(),' -k ')">
228 <xsl:text> || true</xsl:text>
229 </xsl:if>
230 <xsl:text>&#xA;</xsl:text>
[28f4756]231 </xsl:otherwise>
232 </xsl:choose>
[a229600]233 </xsl:if>
234 </xsl:otherwise>
235 </xsl:choose>
236 </xsl:when>
[3d75bc2]237 <!-- Fixing butterfly toolchain test suite run -->
238 <xsl:when test="ancestor::sect1[@id='ch-system-butterfly-toolchain']
239 and string() = 'make -k check'">
[877cc6a]240 <xsl:choose>
[3d75bc2]241 <xsl:when test="$testsuite != '0'">
[28f4756]242 <xsl:choose>
[401f81e]243 <xsl:when test="$bomb-testsuite = 'n'">
[ff43bb8]244 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[28f4756]245 </xsl:when>
246 <xsl:otherwise>
[ff43bb8]247 <xsl:apply-templates/>
[f98695c]248 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]249 <xsl:if test="contains(string(),' -k ')">
250 <xsl:text> || true</xsl:text>
251 </xsl:if>
[f98695c]252 <xsl:text>&#xA;</xsl:text>
[28f4756]253 </xsl:otherwise>
254 </xsl:choose>
[877cc6a]255 </xsl:when>
256 </xsl:choose>
257 </xsl:when>
[d81c640]258 <!-- Fixing Glbc test suite -->
[3d75bc2]259 <xsl:when test="contains(string(),'rm -v configparms') and
260 contains(string(),'-fno-stack-protector')">
261 <xsl:choose>
262 <xsl:when test="$testsuite != '0'">
263 <xsl:apply-templates/>
264 <xsl:text>&#xA;</xsl:text>
265 </xsl:when>
266 </xsl:choose>
267 </xsl:when>
[d81c640]268 <xsl:when test="contains(string(),'glibc-check-log')">
[877cc6a]269 <xsl:choose>
270 <xsl:when test="$testsuite != '0'">
[ff43bb8]271 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
272 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[877cc6a]273 </xsl:when>
274 </xsl:choose>
275 </xsl:when>
[ecfa220]276 <!-- Fixing Cocoon sanity checks -->
277 <xsl:when test="contains(string(),'./strcat-overflow')">
278 <xsl:text>set +e&#xA;</xsl:text>
279 <xsl:apply-templates/>
280 <xsl:text>&#xA;set -e&#xA;</xsl:text>
281 </xsl:when>
[39f5f3e]282 <!-- Fixing Butterfly sanity checks -->
283 <xsl:when test="contains(string(),'./fortify-test')
284 or contains(string(),'./ssp-test')">
[b6f6212]285 <xsl:text>! </xsl:text>
[39f5f3e]286 <xsl:apply-templates/>
287 <xsl:text>&#xA;</xsl:text>
288 </xsl:when>
[ff43bb8]289 <!-- Don't stop on strip run -->
[85077e7]290 <xsl:when test="contains(string(),'strip ')">
[877cc6a]291 <xsl:apply-templates/>
292 <xsl:text> || true&#xA;</xsl:text>
293 </xsl:when>
294 <!-- The rest of commands -->
295 <xsl:otherwise>
296 <xsl:apply-templates/>
297 <xsl:text>&#xA;</xsl:text>
298 </xsl:otherwise>
299 </xsl:choose>
300 </xsl:template>
301
[d81c640]302 <xsl:template match="literal">
[5c575e1]303 <xsl:if test="(@condition=$model or not(@condition)) and
304 (@vendor=$kernel or not(@vendor))">
[d81c640]305 <xsl:apply-templates/>
306 </xsl:if>
307 </xsl:template>
308
[877cc6a]309 <xsl:template match="replaceable">
310 <xsl:choose>
311 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
312 ancestor::sect1[@id='ch-system-uclibc']">
313 <xsl:value-of select="$timezone"/>
314 </xsl:when>
315 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
316 <xsl:value-of select="$page"/>
317 </xsl:when>
318 <xsl:otherwise>
319 <xsl:text>**EDITME</xsl:text>
320 <xsl:apply-templates/>
321 <xsl:text>EDITME**</xsl:text>
322 </xsl:otherwise>
323 </xsl:choose>
324 </xsl:template>
325
326</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.