source: HLFS/hlfs.xsl@ 7d018d1

experimental
Last change on this file since 7d018d1 was 1f89002, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Fixed Binutils and GCC chapter06 testsuites.

  • Property mode set to 100644
File size: 9.5 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 <!-- Run test suites?
20 0 = none
21 1 = only chapter06 Glibc, GCC and Binutils testsuites
22 2 = all chapter06 testsuites
23 3 = all chapter05 and chapter06 testsuites-->
24 <xsl:param name="testsuite" select="1"/>
25
26 <xsl:template match="/">
27 <xsl:apply-templates select="//sect1"/>
28 </xsl:template>
29
30 <xsl:template match="sect1">
31 <xsl:if test="(../@id='chapter-temporary-tools' or
32 ../@id='chapter-building-system' or
33 ../@id='chapter-bootable') and
34 ((@condition=$model or not(@condition)) and
35 count(descendant::screen/userinput) &gt; 0 and
36 count(descendant::screen/userinput) &gt;
37 count(descendant::screen[@role='nodump']))">
38 <!-- The dirs names -->
39 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
40 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
41 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
42 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
43 <!-- The file names -->
44 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
45 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
46 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
47 <!-- The build order -->
48 <xsl:variable name="position" select="position()"/>
49 <xsl:variable name="order">
50 <xsl:choose>
51 <xsl:when test="string-length($position) = 1">
52 <xsl:text>00</xsl:text>
53 <xsl:value-of select="$position"/>
54 </xsl:when>
55 <xsl:when test="string-length($position) = 2">
56 <xsl:text>0</xsl:text>
57 <xsl:value-of select="$position"/>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:value-of select="$position"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:variable>
64 <!-- Creating dirs and files -->
65 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
66 <xsl:choose>
67 <xsl:when test="@id='ch-system-changingowner' or
68 @id='ch-system-creatingdirs' or
69 @id='ch-system-createfiles'">
70 <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
71 </xsl:when>
72 <xsl:when test="@id='ch-tools-stripping' or
73 @id='ch-system-strippingagain'">
74 <xsl:text>#!/bin/sh&#xA;</xsl:text>
75 </xsl:when>
76 <xsl:otherwise>
77 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
78 </xsl:otherwise>
79 </xsl:choose>
80 <xsl:if test="sect2[@role='installation'] or
81 @id='ch-tools-adjusting' or
82 @id='ch-system-readjusting'">
83 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
84 <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
85 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
86 </xsl:if>
87 <xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
88 <xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*&#xA;</xsl:text>
89 </xsl:if>
90 <xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
91 <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; &#xA;</xsl:text>
92 </xsl:if>
93 <xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
94 <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
95 </xsl:if>
96 <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
97 <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
98 </xsl:if>
99 <xsl:if test="@id='bootable-bootscripts'">
100 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
101 </xsl:if>
102 </xsl:if>
103 <xsl:apply-templates select=".//para/userinput | .//screen"/>
104 <xsl:text>exit</xsl:text>
105 </exsl:document>
106 </xsl:if>
107 </xsl:template>
108
109 <xsl:template match="screen">
110 <xsl:if test="(@condition=$model or not(@condition)) and
111 child::* = userinput and not(@role = 'nodump')">
112 <xsl:apply-templates select="userinput" mode="screen"/>
113 </xsl:if>
114 </xsl:template>
115
116 <xsl:template match="para/userinput">
117 <xsl:if test="(contains(string(),'test') or
118 contains(string(),'check')) and
119 (($testsuite = '1' and
120 (ancestor::sect1[@id='ch-system-gcc'] or
121 ancestor::sect1[@id='ch-system-glibc'])) or
122 ($testsuite = '2' and
123 ancestor::chapter[@id='chapter-building-system']) or
124 $testsuite = '3')">
125 <xsl:choose>
126 <xsl:when test="ancestor::sect1[@id='ch-system-gcc']">
127 <xsl:text>make -k check || true&#xA;</xsl:text>
128 </xsl:when>
129 <xsl:otherwise>
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> || true&#xA;</xsl:text>
134 </xsl:otherwise>
135 </xsl:choose>
136 </xsl:if>
137 </xsl:template>
138
139 <xsl:template match="userinput" mode="screen">
140 <xsl:choose>
141 <!-- Estandarized package formats -->
142 <xsl:when test="contains(string(),'tar.gz')">
143 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
144 <xsl:text>tar.*</xsl:text>
145 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
146 <xsl:text>&#xA;</xsl:text>
147 </xsl:when>
148 <!-- Avoiding a race condition in a patch -->
149 <xsl:when test="contains(string(),'debian_fixes')">
150 <xsl:value-of select="substring-before(string(),'patch')"/>
151 <xsl:text>patch -Z</xsl:text>
152 <xsl:value-of select="substring-after(string(),'patch')"/>
153 <xsl:text>&#xA;</xsl:text>
154 </xsl:when>
155 <!-- Setting $LC_ALL and $LANG for /etc/profile -->
156 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
157 contains(string(),'export LANG=')">
158 <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
159 <xsl:text>export LC_ALL=$LC_ALL&#xA;export LANG=$LANG&#xA;</xsl:text>
160 <xsl:text>export INPUTRC</xsl:text>
161 <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
162 <xsl:text>&#xA;</xsl:text>
163 </xsl:when>
164 <!-- Copying the kernel config file -->
165 <xsl:when test="string() = 'make mrproper'">
166 <xsl:text>make mrproper&#xA;</xsl:text>
167 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
168 </xsl:when>
169 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
170 <xsl:when test="($testsuite = '0' or $testsuite = '1') and
171 (ancestor::sect1[@id='ch-system-coreutils'] or
172 ancestor::sect1[@id='ch-system-module-init-tools']) and
173 (contains(string(),'check') or
174 contains(string(),'distclean') or
175 contains(string(),'dummy'))"/>
176 <!-- Fixing toolchain test suites run -->
177 <xsl:when test="string() = 'make check' or
178 string() = 'make -k check'">
179 <xsl:choose>
180 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
181 ancestor::chapter[@id='chapter-building-system']) or
182 $testsuite = '3'">
183 <xsl:text>make -k check || true</xsl:text>
184 <xsl:text>&#xA;</xsl:text>
185 </xsl:when>
186 </xsl:choose>
187 </xsl:when>
188 <xsl:when test="contains(string(),'make check') and
189 ancestor::sect1[@id='ch-system-binutils']">
190 <xsl:choose>
191 <xsl:when test="$testsuite != '0'">
192 <xsl:value-of select="substring-before(string(),'make check')"/>
193 <xsl:text>make -k check || true&#xA;</xsl:text>
194 </xsl:when>
195 </xsl:choose>
196 </xsl:when>
197 <xsl:when test="contains(string(),'hardened-specs') and
198 ancestor::sect1[@id='ch-system-binutils']
199 and $testsuite = '0'"/>
200 <!-- Don't stop on strip run -->
201 <xsl:when test="contains(string(),'strip ')">
202 <xsl:apply-templates/>
203 <xsl:text> || true&#xA;</xsl:text>
204 </xsl:when>
205 <!-- The rest of commands -->
206 <xsl:otherwise>
207 <xsl:apply-templates/>
208 <xsl:text>&#xA;</xsl:text>
209 </xsl:otherwise>
210 </xsl:choose>
211 </xsl:template>
212
213 <xsl:template match="replaceable">
214 <xsl:choose>
215 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
216 ancestor::sect1[@id='ch-system-uclibc']">
217 <xsl:text>$TIMEZONE</xsl:text>
218 </xsl:when>
219 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
220 <xsl:text>$PAGE</xsl:text>
221 </xsl:when>
222 <xsl:otherwise>
223 <xsl:text>**EDITME</xsl:text>
224 <xsl:apply-templates/>
225 <xsl:text>EDITME**</xsl:text>
226 </xsl:otherwise>
227 </xsl:choose>
228 </xsl:template>
229
230</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.