source: dump-lfs-scripts.xsl@ 43757c2

0.2 1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 43757c2 was 2a54650, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Added support to set the local time zone.

  • Property mode set to 100644
File size: 7.2 KB
RevLine 
[557fe91]1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 extension-element-prefixes="exsl"
5 version="1.0">
6
[63b2859]7<!-- XSLT stylesheet to create shell scripts from LFS books. -->
[557fe91]8
[01e51a1]9 <!-- Run optional test suites? -->
[db9cec6]10 <xsl:param name="testsuite" select="0"/>
11
[01e51a1]12 <!-- Run toolchain test suites? -->
13 <xsl:param name="toolchaintest" select="1"/>
14
[557fe91]15 <xsl:template match="/">
16 <xsl:apply-templates select="//sect1"/>
17 </xsl:template>
18
19 <xsl:template match="sect1">
[c4cf6de]20 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
21 count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
22 <!-- The dirs names -->
23 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
24 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
25 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
26 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
27 <!-- The file names -->
28 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
29 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
30 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
31 <!-- The build order -->
32 <xsl:variable name="position" select="position()"/>
33 <xsl:variable name="order">
34 <xsl:choose>
35 <xsl:when test="string-length($position) = 1">
36 <xsl:text>00</xsl:text>
37 <xsl:value-of select="$position"/>
38 </xsl:when>
39 <xsl:when test="string-length($position) = 2">
40 <xsl:text>0</xsl:text>
41 <xsl:value-of select="$position"/>
42 </xsl:when>
43 <xsl:otherwise>
44 <xsl:value-of select="$position"/>
45 </xsl:otherwise>
46 </xsl:choose>
47 </xsl:variable>
48 <!-- Creating dirs and files -->
49 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[76fad58]50 <xsl:choose>
51 <xsl:when test="@id='ch-system-changingowner' or
52 @id='ch-system-creatingdirs' or
53 @id='ch-system-createfiles'">
54 <xsl:text>#!/tools/bin/bash&#xA;&#xA;</xsl:text>
55 </xsl:when>
56 <xsl:otherwise>
57 <xsl:text>#!/bin/sh&#xA;&#xA;</xsl:text>
58 </xsl:otherwise>
59 </xsl:choose>
[56dd1e2]60 <xsl:if test="sect2[@role='installation'] or
61 @id='ch-tools-adjusting' or
62 @id='ch-system-readjusting'">
[44f88e3]63 <xsl:text>cd $PKGDIR &amp;&amp;&#xA;</xsl:text>
64 </xsl:if>
[db9cec6]65 <xsl:apply-templates select=".//para/userinput | .//screen"/>
[816f3f43]66 <xsl:text>exit</xsl:text>
[c4cf6de]67 </exsl:document>
68 </xsl:if>
[557fe91]69 </xsl:template>
70
71 <xsl:template match="screen">
72 <xsl:if test="child::* = userinput">
73 <xsl:choose>
74 <xsl:when test="@role = 'nodump'"/>
75 <xsl:otherwise>
[db9cec6]76 <xsl:apply-templates select="userinput" mode="screen"/>
[557fe91]77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:if>
80 </xsl:template>
81
[db9cec6]82 <xsl:template match="para/userinput">
[56dd1e2]83 <xsl:if test="$testsuite != '0' and
84 (contains(string(),'test') or
85 contains(string(),'check'))">
[3eb60fa]86 <xsl:value-of select="substring-before(string(),'make')"/>
87 <xsl:text>make -k</xsl:text>
88 <xsl:value-of select="substring-after(string(),'make')"/>
[d310939]89 <xsl:text> &#xA;</xsl:text>
[db9cec6]90 </xsl:if>
91 </xsl:template>
92
93 <xsl:template match="userinput" mode="screen">
[3eb60fa]94 <xsl:choose>
[f0f60d0]95 <xsl:when test="string() = 'make mrproper'">
96 <xsl:text>make mrproper &amp;&amp;&#xA;</xsl:text>
97 <xsl:text>cp -v ../kernel-config .config &amp;&amp;&#xA;</xsl:text>
98 </xsl:when>
[92568bf]99 <xsl:when test="contains(string(),'tar.gz')">
100 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
101 <xsl:text>tar.bz2</xsl:text>
102 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
103 <xsl:text> &amp;&amp;&#xA;</xsl:text>
104 </xsl:when>
[79f7cf9]105 <xsl:when test="$testsuite = '0' and
106 ancestor::sect1[@id='ch-system-coreutils'] and
107 (contains(string(),'check') or
108 contains(string(),'dummy'))"/>
[01e51a1]109 <xsl:when test="string() = 'make check' or
110 string() = 'make -k check'">
111 <xsl:choose>
112 <xsl:when test="$toolchaintest = '0'"/>
113 <xsl:otherwise>
114 <xsl:text>make -k check</xsl:text>
115 <xsl:text>&#xA;</xsl:text>
116 </xsl:otherwise>
117 </xsl:choose>
118 </xsl:when>
119 <xsl:when test="contains(string(),'glibc-check-log') or
[92568bf]120 contains(string(),'test_summary') or
121 contains(string(),'expect -c')">
[01e51a1]122 <xsl:choose>
123 <xsl:when test="$toolchaintest = '0'"/>
124 <xsl:otherwise>
125 <xsl:apply-templates/>
126 <xsl:text> &amp;&amp;&#xA;</xsl:text>
127 </xsl:otherwise>
128 </xsl:choose>
[3eb60fa]129 </xsl:when>
[6ec43e3]130 <xsl:when test="contains(string(),'EOF')">
[1f025ca]131 <xsl:value-of select="substring-before(string(),'cat &gt;')"/>
132 <xsl:text>&#xA;(&#xA;cat &lt;&lt; EOF&#xA;</xsl:text>
133 <xsl:apply-templates select="literal"/>
134 <xsl:text>&#xA;EOF&#xA;) &gt;</xsl:text>
135 <xsl:value-of select="substring-after((substring-before(string(),'&lt;&lt;')),'cat &gt;')"/>
[01e51a1]136 <xsl:text> &amp;&amp;&#xA;</xsl:text>
[1f025ca]137 <xsl:if test="string-length(substring-after(string(),'EOF&#xA;')) &gt; 0">
138 <xsl:value-of select="substring-after(string(),'EOF&#xA;')"/>
139 <xsl:text> &amp;&amp;&#xA;</xsl:text>
140 </xsl:if>
[6ec43e3]141 </xsl:when>
[56353fb]142 <xsl:when test="contains(string(),'debian_fixes')">
143 <xsl:value-of select="substring-before(string(),'patch')"/>
144 <xsl:text>patch -Z</xsl:text>
145 <xsl:value-of select="substring-after(string(),'patch')"/>
[2ee568e]146 <xsl:text> &amp;&amp;&#xA;</xsl:text>
[56353fb]147 </xsl:when>
[3eb60fa]148 <xsl:otherwise>
149 <xsl:apply-templates/>
[01e51a1]150 <xsl:if test="not(contains(string(),'check')) and
151 not(contains(string(),'strip '))">
152 <xsl:text> &amp;&amp;</xsl:text>
153 </xsl:if>
154 <xsl:text>&#xA;</xsl:text>
[3eb60fa]155 </xsl:otherwise>
156 </xsl:choose>
[557fe91]157 </xsl:template>
158
[1f025ca]159 <xsl:template match="literal">
160 <xsl:choose>
161 <xsl:when test="contains(string(),'$@')">
162 <xsl:variable name="content">
163 <xsl:apply-templates/>
164 </xsl:variable>
165 <xsl:value-of select="substring-before(string($content),'$@')"/>
166 <xsl:text>\$@</xsl:text>
167 <xsl:value-of select="substring-after(string($content),'$@')"/>
168 </xsl:when>
169 <xsl:otherwise>
170 <xsl:apply-templates/>
171 </xsl:otherwise>
172 </xsl:choose>
173 </xsl:template>
174
[557fe91]175 <xsl:template match="replaceable">
[a41ce58]176 <xsl:choose>
[2a54650]177 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
178 <xsl:text>$TIMEZONE</xsl:text>
179 </xsl:when>
[a41ce58]180 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
181 <xsl:text>$PAGE</xsl:text>
182 </xsl:when>
183 <xsl:otherwise>
184 <xsl:text>**EDITME</xsl:text>
185 <xsl:apply-templates/>
186 <xsl:text>EDITME**</xsl:text>
187 </xsl:otherwise>
188 </xsl:choose>
[557fe91]189 </xsl:template>
190
191</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.