source: dump-lfs-scripts.xsl@ e55d264

1.0 2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since e55d264 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
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'">
[fd691b4]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>
[76fad58]59 </xsl:when>
60 <xsl:otherwise>
[fd691b4]61 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
[76fad58]62 </xsl:otherwise>
63 </xsl:choose>
[56dd1e2]64 <xsl:if test="sect2[@role='installation'] or
65 @id='ch-tools-adjusting' or
66 @id='ch-system-readjusting'">
[fd691b4]67 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[44f88e3]68 </xsl:if>
[db9cec6]69 <xsl:apply-templates select=".//para/userinput | .//screen"/>
[816f3f43]70 <xsl:text>exit</xsl:text>
[c4cf6de]71 </exsl:document>
72 </xsl:if>
[557fe91]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>
[db9cec6]80 <xsl:apply-templates select="userinput" mode="screen"/>
[557fe91]81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:if>
84 </xsl:template>
85
[db9cec6]86 <xsl:template match="para/userinput">
[56dd1e2]87 <xsl:if test="$testsuite != '0' and
88 (contains(string(),'test') or
89 contains(string(),'check'))">
[3eb60fa]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')"/>
[fd691b4]93 <xsl:text> || true&#xA;</xsl:text>
[db9cec6]94 </xsl:if>
95 </xsl:template>
96
97 <xsl:template match="userinput" mode="screen">
[3eb60fa]98 <xsl:choose>
[fd691b4]99 <!-- Estandarized package formats -->
[92568bf]100 <xsl:when test="contains(string(),'tar.gz')">
101 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
[be9970b]102 <xsl:text>tar.*</xsl:text>
[92568bf]103 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
[fd691b4]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>
[92568bf]117 </xsl:when>
[4e9a3b3]118 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[79f7cf9]119 <xsl:when test="$testsuite = '0' and
[4e9a3b3]120 (ancestor::sect1[@id='ch-system-coreutils'] or
121 ancestor::sect1[@id='ch-system-module-init-tools']) and
[79f7cf9]122 (contains(string(),'check') or
123 contains(string(),'dummy'))"/>
[fd691b4]124 <!-- Fixing toolchain test suites run -->
[01e51a1]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>
[fd691b4]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;')"/>
[01e51a1]142 <xsl:text>&#xA;</xsl:text>
143 </xsl:otherwise>
144 </xsl:choose>
145 </xsl:when>
[fd691b4]146 <xsl:when test="contains(string(),'test_summary') or
[92568bf]147 contains(string(),'expect -c')">
[01e51a1]148 <xsl:choose>
149 <xsl:when test="$toolchaintest = '0'"/>
150 <xsl:otherwise>
151 <xsl:apply-templates/>
[fd691b4]152 <xsl:text>&#xA;</xsl:text>
[01e51a1]153 </xsl:otherwise>
154 </xsl:choose>
[3eb60fa]155 </xsl:when>
[fd691b4]156 <!-- Don't stop on strip run -->
157 <xsl:when test="contains(string(),'strip ')">
[3eb60fa]158 <xsl:apply-templates/>
[fd691b4]159 <xsl:text> || true&#xA;</xsl:text>
[1f025ca]160 </xsl:when>
[fd691b4]161 <!-- The rest of commands -->
[1f025ca]162 <xsl:otherwise>
163 <xsl:apply-templates/>
[fd691b4]164 <xsl:text>&#xA;</xsl:text>
[1f025ca]165 </xsl:otherwise>
166 </xsl:choose>
167 </xsl:template>
168
[557fe91]169 <xsl:template match="replaceable">
[a41ce58]170 <xsl:choose>
[2a54650]171 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
172 <xsl:text>$TIMEZONE</xsl:text>
173 </xsl:when>
[a41ce58]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>
[557fe91]183 </xsl:template>
184
185</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.