source: dump-lfs-scripts.xsl@ 898f47a

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

Added && to the debian_fixes Flex patch.

  • Property mode set to 100644
File size: 6.9 KB
Line 
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
7<!-- XSLT stylesheet to create shell scripts from LFS books. -->
8
9 <!-- Run optional test suites? -->
10 <xsl:param name="testsuite" select="0"/>
11
12 <!-- Run toolchain test suites? -->
13 <xsl:param name="toolchaintest" select="1"/>
14
15 <xsl:template match="/">
16 <xsl:apply-templates select="//sect1"/>
17 </xsl:template>
18
19 <xsl:template match="sect1">
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">
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>
60 <xsl:if test="sect2[@role='installation'] or
61 @id='ch-tools-adjusting' or
62 @id='ch-system-readjusting'">
63 <xsl:text>cd $PKGDIR &amp;&amp;&#xA;</xsl:text>
64 </xsl:if>
65 <xsl:apply-templates select=".//para/userinput | .//screen"/>
66 <xsl:text>exit</xsl:text>
67 </exsl:document>
68 </xsl:if>
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>
76 <xsl:apply-templates select="userinput" mode="screen"/>
77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:if>
80 </xsl:template>
81
82 <xsl:template match="para/userinput">
83 <xsl:if test="$testsuite != '0' and
84 (contains(string(),'test') or
85 contains(string(),'check'))">
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')"/>
89 <xsl:text> &#xA;</xsl:text>
90 </xsl:if>
91 </xsl:template>
92
93 <xsl:template match="userinput" mode="screen">
94 <xsl:choose>
95 <xsl:when test="contains(string(),'tar.gz')">
96 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
97 <xsl:text>tar.bz2</xsl:text>
98 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
99 <xsl:text> &amp;&amp;&#xA;</xsl:text>
100 </xsl:when>
101 <xsl:when test="$testsuite = '0' and
102 ancestor::sect1[@id='ch-system-coreutils'] and
103 (contains(string(),'check') or
104 contains(string(),'dummy'))"/>
105 <xsl:when test="string() = 'make check' or
106 string() = 'make -k check'">
107 <xsl:choose>
108 <xsl:when test="$toolchaintest = '0'"/>
109 <xsl:otherwise>
110 <xsl:text>make -k check</xsl:text>
111 <xsl:text>&#xA;</xsl:text>
112 </xsl:otherwise>
113 </xsl:choose>
114 </xsl:when>
115 <xsl:when test="contains(string(),'glibc-check-log') or
116 contains(string(),'test_summary') or
117 contains(string(),'expect -c')">
118 <xsl:choose>
119 <xsl:when test="$toolchaintest = '0'"/>
120 <xsl:otherwise>
121 <xsl:apply-templates/>
122 <xsl:text> &amp;&amp;&#xA;</xsl:text>
123 </xsl:otherwise>
124 </xsl:choose>
125 </xsl:when>
126 <xsl:when test="contains(string(),'EOF')">
127 <xsl:value-of select="substring-before(string(),'cat &gt;')"/>
128 <xsl:text>&#xA;(&#xA;cat &lt;&lt; EOF&#xA;</xsl:text>
129 <xsl:apply-templates select="literal"/>
130 <xsl:text>&#xA;EOF&#xA;) &gt;</xsl:text>
131 <xsl:value-of select="substring-after((substring-before(string(),'&lt;&lt;')),'cat &gt;')"/>
132 <xsl:text> &amp;&amp;&#xA;</xsl:text>
133 <xsl:if test="string-length(substring-after(string(),'EOF&#xA;')) &gt; 0">
134 <xsl:value-of select="substring-after(string(),'EOF&#xA;')"/>
135 <xsl:text> &amp;&amp;&#xA;</xsl:text>
136 </xsl:if>
137 </xsl:when>
138 <xsl:when test="contains(string(),'debian_fixes')">
139 <xsl:value-of select="substring-before(string(),'patch')"/>
140 <xsl:text>patch -Z</xsl:text>
141 <xsl:value-of select="substring-after(string(),'patch')"/>
142 <xsl:text> &amp;&amp;&#xA;</xsl:text>
143 </xsl:when>
144 <xsl:otherwise>
145 <xsl:apply-templates/>
146 <xsl:if test="not(contains(string(),'check')) and
147 not(contains(string(),'strip '))">
148 <xsl:text> &amp;&amp;</xsl:text>
149 </xsl:if>
150 <xsl:text>&#xA;</xsl:text>
151 </xsl:otherwise>
152 </xsl:choose>
153 </xsl:template>
154
155 <xsl:template match="literal">
156 <xsl:choose>
157 <xsl:when test="contains(string(),'$@')">
158 <xsl:variable name="content">
159 <xsl:apply-templates/>
160 </xsl:variable>
161 <xsl:value-of select="substring-before(string($content),'$@')"/>
162 <xsl:text>\$@</xsl:text>
163 <xsl:value-of select="substring-after(string($content),'$@')"/>
164 </xsl:when>
165 <xsl:otherwise>
166 <xsl:apply-templates/>
167 </xsl:otherwise>
168 </xsl:choose>
169 </xsl:template>
170
171 <xsl:template match="replaceable">
172 <xsl:choose>
173 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
174 <xsl:text>$PAGE</xsl:text>
175 </xsl:when>
176 <xsl:otherwise>
177 <xsl:text>**EDITME</xsl:text>
178 <xsl:apply-templates/>
179 <xsl:text>EDITME**</xsl:text>
180 </xsl:otherwise>
181 </xsl:choose>
182 </xsl:template>
183
184</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.