source: dump-lfs-scripts.xsl@ 92568bf

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

Fixed a bug when no test suites will be run.
Fixed the extension for harcoded package names.

  • Property mode set to 100644
File size: 6.0 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:variable name="content">
128 <xsl:apply-templates/>
129 </xsl:variable>
130 <xsl:value-of select="substring-before(string($content), 'cat &gt;')"/>
131 <xsl:text>&#xA;(&#xA;cat &lt;&lt; EOF</xsl:text>
132 <xsl:value-of select="substring-after(string($content), '&quot;EOF&quot;')"/>
133 <xsl:text>&#xA;) &gt;</xsl:text>
134 <xsl:value-of select="substring-after((substring-before(string($content), '&lt;&lt;')), 'cat &gt;')"/>
135 <xsl:text> &amp;&amp;&#xA;</xsl:text>
136 </xsl:when>
137 <xsl:otherwise>
138 <xsl:apply-templates/>
139 <xsl:if test="not(contains(string(),'check')) and
140 not(contains(string(),'strip '))">
141 <xsl:text> &amp;&amp;</xsl:text>
142 </xsl:if>
143 <xsl:text>&#xA;</xsl:text>
144 </xsl:otherwise>
145 </xsl:choose>
146 </xsl:template>
147
148 <xsl:template match="replaceable">
149 <xsl:choose>
150 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
151 <xsl:text>$PAGE</xsl:text>
152 </xsl:when>
153 <xsl:otherwise>
154 <xsl:text>**EDITME</xsl:text>
155 <xsl:apply-templates/>
156 <xsl:text>EDITME**</xsl:text>
157 </xsl:otherwise>
158 </xsl:choose>
159 </xsl:template>
160
161</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.