source: LFS/lfs.xsl@ 5c1ceb5

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

Test 2

  • Property mode set to 100644
File size: 7.3 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$Id$
9$Author$$Rev$$Date$
10
11<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
12 xmlns:exsl="http://exslt.org/common"
13 extension-element-prefixes="exsl"
14 version="1.0">
15
16<!-- XSLT stylesheet to create shell scripts from LFS books. -->
17
18 <!-- Run optional test suites? -->
19 <xsl:param name="testsuite" select="0"/>
20
21 <!-- Run toolchain test suites? -->
22 <xsl:param name="toolchaintest" select="1"/>
23
24 <!-- Install vim-lang package? -->
25 <xsl:param name="vim-lang" select="1"/>
26
27 <xsl:template match="/">
28 <xsl:apply-templates select="//sect1"/>
29 </xsl:template>
30
31 <xsl:template match="sect1">
32 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
33 count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
34 <!-- The dirs names -->
35 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
36 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
37 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
38 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
39 <!-- The file names -->
40 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
41 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
42 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
43 <!-- The build order -->
44 <xsl:variable name="position" select="position()"/>
45 <xsl:variable name="order">
46 <xsl:choose>
47 <xsl:when test="string-length($position) = 1">
48 <xsl:text>00</xsl:text>
49 <xsl:value-of select="$position"/>
50 </xsl:when>
51 <xsl:when test="string-length($position) = 2">
52 <xsl:text>0</xsl:text>
53 <xsl:value-of select="$position"/>
54 </xsl:when>
55 <xsl:otherwise>
56 <xsl:value-of select="$position"/>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:variable>
60 <!-- Creating dirs and files -->
61 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
62 <xsl:choose>
63 <xsl:when test="@id='ch-system-changingowner' or
64 @id='ch-system-creatingdirs' or
65 @id='ch-system-createfiles'">
66 <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
67 </xsl:when>
68 <xsl:when test="@id='ch-tools-stripping' or
69 @id='ch-system-strippingagain'">
70 <xsl:text>#!/bin/sh&#xA;</xsl:text>
71 </xsl:when>
72 <xsl:otherwise>
73 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
74 </xsl:otherwise>
75 </xsl:choose>
76 <xsl:if test="sect2[@role='installation']">
77 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
78 <xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
79 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
80 </xsl:if>
81 </xsl:if>
82 <xsl:apply-templates select=".//para/userinput | .//screen"/>
83 <xsl:text>exit</xsl:text>
84 </exsl:document>
85 </xsl:if>
86 </xsl:template>
87
88 <xsl:template match="screen">
89 <xsl:if test="child::* = userinput">
90 <xsl:choose>
91 <xsl:when test="@role = 'nodump'"/>
92 <xsl:otherwise>
93 <xsl:apply-templates select="userinput" mode="screen"/>
94 </xsl:otherwise>
95 </xsl:choose>
96 </xsl:if>
97 </xsl:template>
98
99 <xsl:template match="para/userinput">
100 <xsl:if test="$testsuite != '0' and
101 (contains(string(),'test') or
102 contains(string(),'check'))">
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' 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="$toolchaintest = '0'"/>
142 <xsl:otherwise>
143 <xsl:text>make -k check || true</xsl:text>
144 <xsl:text>&#xA;</xsl:text>
145 </xsl:otherwise>
146 </xsl:choose>
147 </xsl:when>
148 <xsl:when test="contains(string(),'glibc-check-log')">
149 <xsl:choose>
150 <xsl:when test="$toolchaintest = '0'"/>
151 <xsl:otherwise>
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:otherwise>
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="$toolchaintest = '0'"/>
163 <xsl:otherwise>
164 <xsl:apply-templates/>
165 <xsl:text>&#xA;</xsl:text>
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:when>
169 <!-- Don't stop on strip run -->
170 <xsl:when test="contains(string(),'strip ')">
171 <xsl:apply-templates/>
172 <xsl:text> || true&#xA;</xsl:text>
173 </xsl:when>
174 <!-- The rest of commands -->
175 <xsl:otherwise>
176 <xsl:apply-templates/>
177 <xsl:text>&#xA;</xsl:text>
178 </xsl:otherwise>
179 </xsl:choose>
180 </xsl:template>
181
182 <xsl:template match="replaceable">
183 <xsl:choose>
184 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
185 <xsl:text>$TIMEZONE</xsl:text>
186 </xsl:when>
187 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
188 <xsl:text>$PAGE</xsl:text>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:text>**EDITME</xsl:text>
192 <xsl:apply-templates/>
193 <xsl:text>EDITME**</xsl:text>
194 </xsl:otherwise>
195 </xsl:choose>
196 </xsl:template>
197
198</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.