source: dump-lfs-scripts.xsl@ 6480c2b

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

Added support for the Module-init-tools-testsuite package.

  • Property mode set to 100644
File size: 7.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;set -e&#xA;&#xA;</xsl:text>
55 </xsl:when>
56 <xsl:when test="@id='ch-tools-stripping' or
57 @id='ch-system-strippingagain'">
58 <xsl:text>#!/bin/sh&#xA;</xsl:text>
59 </xsl:when>
60 <xsl:otherwise>
61 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
62 </xsl:otherwise>
63 </xsl:choose>
64 <xsl:if test="sect2[@role='installation'] or
65 @id='ch-tools-adjusting' or
66 @id='ch-system-readjusting'">
67 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
68 </xsl:if>
69 <xsl:apply-templates select=".//para/userinput | .//screen"/>
70 <xsl:text>exit</xsl:text>
71 </exsl:document>
72 </xsl:if>
73 </xsl:template>
74
75 <xsl:template match="screen">
76 <xsl:if test="child::* = userinput">
77 <xsl:choose>
78 <xsl:when test="@role = 'nodump'"/>
79 <xsl:otherwise>
80 <xsl:apply-templates select="userinput" mode="screen"/>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:if>
84 </xsl:template>
85
86 <xsl:template match="para/userinput">
87 <xsl:if test="$testsuite != '0' and
88 (contains(string(),'test') or
89 contains(string(),'check'))">
90 <xsl:value-of select="substring-before(string(),'make')"/>
91 <xsl:text>make -k</xsl:text>
92 <xsl:value-of select="substring-after(string(),'make')"/>
93 <xsl:text> || true&#xA;</xsl:text>
94 </xsl:if>
95 </xsl:template>
96
97 <xsl:template match="userinput" mode="screen">
98 <xsl:choose>
99 <!-- Estandarized package formats -->
100 <xsl:when test="contains(string(),'tar.gz')">
101 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
102 <xsl:text>tar.*</xsl:text>
103 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
104 <xsl:text>&#xA;</xsl:text>
105 </xsl:when>
106 <!-- Avoiding a race condition in a patch -->
107 <xsl:when test="contains(string(),'debian_fixes')">
108 <xsl:value-of select="substring-before(string(),'patch')"/>
109 <xsl:text>patch -Z</xsl:text>
110 <xsl:value-of select="substring-after(string(),'patch')"/>
111 <xsl:text>&#xA;</xsl:text>
112 </xsl:when>
113 <!-- Copying the kernel config file -->
114 <xsl:when test="string() = 'make mrproper'">
115 <xsl:text>make mrproper&#xA;</xsl:text>
116 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
117 </xsl:when>
118 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
119 <xsl:when test="$testsuite = '0' and
120 (ancestor::sect1[@id='ch-system-coreutils'] or
121 ancestor::sect1[@id='ch-system-module-init-tools']) and
122 (contains(string(),'check') or
123 contains(string(),'dummy'))"/>
124 <!-- Fixing toolchain test suites run -->
125 <xsl:when test="string() = 'make check' or
126 string() = 'make -k check'">
127 <xsl:choose>
128 <xsl:when test="$toolchaintest = '0'"/>
129 <xsl:otherwise>
130 <xsl:text>make -k check || true</xsl:text>
131 <xsl:text>&#xA;</xsl:text>
132 </xsl:otherwise>
133 </xsl:choose>
134 </xsl:when>
135 <xsl:when test="contains(string(),'glibc-check-log')">
136 <xsl:choose>
137 <xsl:when test="$toolchaintest = '0'"/>
138 <xsl:otherwise>
139 <xsl:value-of select="substring-before(string(),'&#xA;')"/>
140 <xsl:text> || true&#xA;</xsl:text>
141 <xsl:value-of select="substring-after(string(),'&#xA;')"/>
142 <xsl:text>&#xA;</xsl:text>
143 </xsl:otherwise>
144 </xsl:choose>
145 </xsl:when>
146 <xsl:when test="contains(string(),'test_summary') or
147 contains(string(),'expect -c')">
148 <xsl:choose>
149 <xsl:when test="$toolchaintest = '0'"/>
150 <xsl:otherwise>
151 <xsl:apply-templates/>
152 <xsl:text>&#xA;</xsl:text>
153 </xsl:otherwise>
154 </xsl:choose>
155 </xsl:when>
156 <!-- Don't stop on strip run -->
157 <xsl:when test="contains(string(),'strip ')">
158 <xsl:apply-templates/>
159 <xsl:text> || true&#xA;</xsl:text>
160 </xsl:when>
161 <!-- The rest of commands -->
162 <xsl:otherwise>
163 <xsl:apply-templates/>
164 <xsl:text>&#xA;</xsl:text>
165 </xsl:otherwise>
166 </xsl:choose>
167 </xsl:template>
168
169 <xsl:template match="replaceable">
170 <xsl:choose>
171 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
172 <xsl:text>$TIMEZONE</xsl:text>
173 </xsl:when>
174 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
175 <xsl:text>$PAGE</xsl:text>
176 </xsl:when>
177 <xsl:otherwise>
178 <xsl:text>**EDITME</xsl:text>
179 <xsl:apply-templates/>
180 <xsl:text>EDITME**</xsl:text>
181 </xsl:otherwise>
182 </xsl:choose>
183 </xsl:template>
184
185</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.