source: dump-lfs-scripts.xsl@ a0ed344

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

Changed how the testsuites are handled and fixed the missing locales installation for chapter05 testsuites.

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