source: LFS/lfs.xsl@ 6aeb5b7

experimental
Last change on this file since 6aeb5b7 was 6db1464, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Changed how the testsuites are handled and fixed the missing locales installation for chapter05 testsuites.

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