source: CLFS/clfs.xsl@ 113d767

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

There is no Groff debian fixes patch in HLFS or CLFS.

  • Property mode set to 100644
File size: 10.9 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 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
[28f4756]23 3 = alias to 2
24 -->
[877cc6a]25 <xsl:param name="testsuite" select="1"/>
26
[28f4756]27 <!-- Bomb on test suites failures?
[401f81e]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
[28f4756]30 -->
[401f81e]31 <xsl:param name="bomb-testsuite" select="n"/>
[28f4756]32
[877cc6a]33 <!-- Install vim-lang package? -->
[401f81e]34 <xsl:param name="vim-lang" select="y"/>
[877cc6a]35
36 <!-- Time zone -->
[a229600]37 <xsl:param name="timezone" select="GMT"/>
[877cc6a]38
39 <!-- Page size -->
40 <xsl:param name="page" select="letter"/>
41
42 <!-- Locale settings -->
[a229600]43 <xsl:param name="lang" select="C"/>
[877cc6a]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">
[5f4982d]89 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
90 <xsl:if test="not(@id='ch-system-stripping')">
91 <xsl:text>set -e</xsl:text>
92 </xsl:if>
93 <xsl:text>&#xA;</xsl:text>
[877cc6a]94 <xsl:if test="sect2[@role='installation']">
95 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[401f81e]96 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
[877cc6a]97 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
98 </xsl:if>
99 </xsl:if>
100 <xsl:apply-templates select=".//para/userinput | .//screen"/>
101 <xsl:text>exit</xsl:text>
102 </exsl:document>
103 </xsl:if>
104 </xsl:otherwise>
105 </xsl:choose>
106 </xsl:template>
107
108 <xsl:template match="screen">
109 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
110 <xsl:apply-templates select="userinput" mode="screen"/>
111 </xsl:if>
112 </xsl:template>
113
114 <xsl:template match="para/userinput">
115 <xsl:if test="(contains(string(),'test') or
116 contains(string(),'check')) and
117 ($testsuite = '2' or $testsuite = '3')">
[28f4756]118 <xsl:choose>
[401f81e]119 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]120 <xsl:value-of select="substring-before(string(),'make')"/>
121 <xsl:text>make -k</xsl:text>
122 <xsl:value-of select="substring-after(string(),'make')"/>
123 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
124 </xsl:when>
125 <xsl:otherwise>
126 <xsl:apply-templates/>
[a1f1969]127 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
128 <xsl:if test="contains(string(),' -k ')">
129 <xsl:text> || true</xsl:text>
130 </xsl:if>
131 <xsl:text>&#xA;</xsl:text>
[28f4756]132 </xsl:otherwise>
133 </xsl:choose>
[877cc6a]134 </xsl:if>
135 </xsl:template>
136
137 <xsl:template match="userinput" mode="screen">
138 <xsl:choose>
139 <!-- Estandarized package formats -->
140 <xsl:when test="contains(string(),'tar.gz')">
141 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
142 <xsl:text>tar.*</xsl:text>
143 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
144 <xsl:text>&#xA;</xsl:text>
145 </xsl:when>
146 <!-- Setting $LANG for /etc/profile -->
147 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
148 contains(string(),'export LANG=')">
149 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
150 <xsl:text>export LANG=</xsl:text>
151 <xsl:value-of select="$lang"/>
152 <xsl:value-of select="substring-after(string(),'charmap]')"/>
153 <xsl:text>&#xA;</xsl:text>
154 </xsl:when>
[f4caf9c]155 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
156 <xsl:when test="contains(string(),'defkeymap')"/>
[877cc6a]157 <!-- Copying the kernel config file -->
158 <xsl:when test="string() = 'make mrproper'">
159 <xsl:text>make mrproper&#xA;</xsl:text>
160 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
161 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
162 </xsl:if>
163 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
164 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
165 </xsl:if>
166 </xsl:when>
167 <!-- No interactive commands are needed if the .config file is the proper one -->
168 <xsl:when test="contains(string(),'menuconfig')"/>
169 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]170 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]171 ancestor::sect1[@id='ch-system-module-init-tools']) and
172 (contains(string(),'check') or
[a229600]173 contains(string(),'dummy'))">
174 <xsl:choose>
175 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
176 <xsl:otherwise>
[28f4756]177 <xsl:if test="not(contains(string(),'check'))">
178 <xsl:apply-templates/>
179 <xsl:text>&#xA;</xsl:text>
180 </xsl:if>
[a229600]181 <xsl:if test="contains(string(),'check')">
[28f4756]182 <xsl:choose>
[401f81e]183 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]184 <xsl:value-of select="substring-before(string(),'check')"/>
185 <xsl:text>-k check</xsl:text>
186 <xsl:value-of select="substring-after(string(),'check')"/>
187 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
188 </xsl:when>
189 <xsl:otherwise>
190 <xsl:apply-templates/>
[3014928]191 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]192 <xsl:if test="contains(string(),' -k ')">
193 <xsl:text> || true</xsl:text>
194 </xsl:if>
[f98695c]195 <xsl:text>&#xA;</xsl:text>
[28f4756]196 </xsl:otherwise>
197 </xsl:choose>
[a229600]198 </xsl:if>
199 </xsl:otherwise>
200 </xsl:choose>
201 </xsl:when>
[877cc6a]202 <!-- Fixing toolchain test suites run -->
203 <xsl:when test="string() = 'make check' or
204 string() = 'make -k check'">
205 <xsl:choose>
206 <xsl:when test="$testsuite != '0'">
[28f4756]207 <xsl:choose>
[401f81e]208 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]209 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
210 </xsl:when>
211 <xsl:otherwise>
212 <xsl:apply-templates/>
[a1f1969]213 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
214 <xsl:if test="contains(string(),' -k ')">
215 <xsl:text> || true</xsl:text>
216 </xsl:if>
217 <xsl:text>&#xA;</xsl:text>
[28f4756]218 </xsl:otherwise>
219 </xsl:choose>
[877cc6a]220 </xsl:when>
221 </xsl:choose>
222 </xsl:when>
223 <xsl:when test="contains(string(),'glibc-check-log')">
224 <xsl:choose>
225 <xsl:when test="$testsuite != '0'">
[a229600]226 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
[28f4756]227 <xsl:choose>
[401f81e]228 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]229 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
230 </xsl:when>
231 <xsl:otherwise>
[a1f1969]232 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
233 <xsl:if test="contains(string(),' -k ')">
234 <xsl:text> || true</xsl:text>
235 </xsl:if>
236 <xsl:text>&#xA;</xsl:text>
[28f4756]237 </xsl:otherwise>
238 </xsl:choose>
[877cc6a]239 </xsl:when>
240 </xsl:choose>
241 </xsl:when>
242 <xsl:when test="contains(string(),'test_summary') or
243 contains(string(),'expect -c')">
244 <xsl:choose>
245 <xsl:when test="$testsuite != '0'">
246 <xsl:apply-templates/>
[28f4756]247 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[877cc6a]248 </xsl:when>
249 </xsl:choose>
250 </xsl:when>
251 <!-- Don't stop on strip run -->
252 <xsl:when test="contains(string(),'strip ')">
253 <xsl:apply-templates/>
254 <xsl:text> || true&#xA;</xsl:text>
255 </xsl:when>
256 <!-- The rest of commands -->
257 <xsl:otherwise>
258 <xsl:apply-templates/>
259 <xsl:text>&#xA;</xsl:text>
260 </xsl:otherwise>
261 </xsl:choose>
262 </xsl:template>
263
264 <xsl:template match="replaceable">
265 <xsl:choose>
266 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
267 <xsl:value-of select="$timezone"/>
268 </xsl:when>
269 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
270 <xsl:value-of select="$page"/>
271 </xsl:when>
272 <xsl:otherwise>
273 <xsl:text>**EDITME</xsl:text>
274 <xsl:apply-templates/>
275 <xsl:text>EDITME**</xsl:text>
276 </xsl:otherwise>
277 </xsl:choose>
278 </xsl:template>
279
280</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.