source: LFS/lfs.xsl@ d4ef791

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since d4ef791 was 14eaa9f, checked in by Manuel Canales Esparcia <manuel@…>, 18 years ago

LFS changes:
Skip creation of chapters 4 and 9 scripts.
Creating /etc/lfs-release as part af all target.
Removed hardcoded script number.

  • Property mode set to 100644
File size: 10.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
[877cc6a]7<!-- $Id$ -->
8
[557fe91]9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:exsl="http://exslt.org/common"
11 extension-element-prefixes="exsl"
12 version="1.0">
13
[63b2859]14<!-- XSLT stylesheet to create shell scripts from LFS books. -->
[557fe91]15
[31d6944]16 <!-- Run test suites?
17 0 = none
18 1 = only chapter06 Glibc, GCC and Binutils testsuites
19 2 = all chapter06 testsuites
[28f4756]20 3 = all chapter05 and chapter06 testsuites
21 -->
[31d6944]22 <xsl:param name="testsuite" select="1"/>
[01e51a1]23
[28f4756]24 <!-- Bomb on test suites failures?
[401f81e]25 n = no, I want to build the full system and review the logs
26 y = yes, bomb at the first test suite failure to can review the build dir
[28f4756]27 -->
[401f81e]28 <xsl:param name="bomb-testsuite" select="n"/>
[28f4756]29
[db181c47]30 <!-- Install vim-lang package? -->
[401f81e]31 <xsl:param name="vim-lang" select="y"/>
[db181c47]32
[877cc6a]33 <!-- Time zone -->
[a229600]34 <xsl:param name="timezone" select="GMT"/>
[877cc6a]35
36 <!-- Page size -->
37 <xsl:param name="page" select="letter"/>
38
39 <!-- Locale settings -->
[a229600]40 <xsl:param name="lang" select="C"/>
[877cc6a]41
[557fe91]42 <xsl:template match="/">
43 <xsl:apply-templates select="//sect1"/>
44 </xsl:template>
45
46 <xsl:template match="sect1">
[14eaa9f]47 <xsl:if test="(../@id='chapter-temporary-tools' or
48 ../@id='chapter-building-system' or
49 ../@id='chapter-bootscripts' or
50 ../@id='chapter-bootable') and
51 count(descendant::screen/userinput) &gt; 0 and
52 count(descendant::screen/userinput) &gt;
53 count(descendant::screen[@role='nodump'])">
[c4cf6de]54 <!-- The dirs names -->
55 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
56 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
57 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
58 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
59 <!-- The file names -->
60 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
61 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
62 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
63 <!-- The build order -->
64 <xsl:variable name="position" select="position()"/>
65 <xsl:variable name="order">
66 <xsl:choose>
67 <xsl:when test="string-length($position) = 1">
68 <xsl:text>00</xsl:text>
69 <xsl:value-of select="$position"/>
70 </xsl:when>
71 <xsl:when test="string-length($position) = 2">
72 <xsl:text>0</xsl:text>
73 <xsl:value-of select="$position"/>
74 </xsl:when>
75 <xsl:otherwise>
76 <xsl:value-of select="$position"/>
77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:variable>
80 <!-- Creating dirs and files -->
81 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[5f4982d]82 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
83 <xsl:if test="not(@id='ch-tools-stripping') and
84 not(@id='ch-system-strippingagain')">
85 <xsl:text>set -e&#xA;</xsl:text>
86 </xsl:if>
87 <xsl:text>&#xA;</xsl:text>
[40700e9]88 <xsl:if test="sect2[@role='installation']">
89 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
90 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
91 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
92 </xsl:if>
93 </xsl:if>
[db9cec6]94 <xsl:apply-templates select=".//para/userinput | .//screen"/>
[31d6944]95 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
96 <xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/>
97 <xsl:text>&#xA;</xsl:text>
98 </xsl:if>
[40700e9]99 <xsl:text>exit</xsl:text>
[c4cf6de]100 </exsl:document>
101 </xsl:if>
[557fe91]102 </xsl:template>
103
104 <xsl:template match="screen">
[31d6944]105 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
106 <xsl:apply-templates select="userinput" mode="screen"/>
[557fe91]107 </xsl:if>
108 </xsl:template>
109
[db9cec6]110 <xsl:template match="para/userinput">
[31d6944]111 <xsl:if test="(contains(string(),'test') or
112 contains(string(),'check')) and
113 (($testsuite = '2' and
114 ancestor::chapter[@id='chapter-building-system']) or
115 $testsuite = '3')">
[28f4756]116 <xsl:choose>
[401f81e]117 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]118 <xsl:value-of select="substring-before(string(),'make')"/>
119 <xsl:text>make -k</xsl:text>
120 <xsl:value-of select="substring-after(string(),'make')"/>
121 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
122 </xsl:when>
123 <xsl:otherwise>
124 <xsl:apply-templates/>
[a1f1969]125 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
126 <xsl:if test="contains(string(),' -k ')">
127 <xsl:text> || true</xsl:text>
128 </xsl:if>
129 <xsl:text>&#xA;</xsl:text>
[28f4756]130 </xsl:otherwise>
131 </xsl:choose>
[db9cec6]132 </xsl:if>
133 </xsl:template>
134
135 <xsl:template match="userinput" mode="screen">
[3eb60fa]136 <xsl:choose>
[fd691b4]137 <!-- Estandarized package formats -->
[92568bf]138 <xsl:when test="contains(string(),'tar.gz')">
139 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
[be9970b]140 <xsl:text>tar.*</xsl:text>
[92568bf]141 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
[fd691b4]142 <xsl:text>&#xA;</xsl:text>
143 </xsl:when>
144 <!-- Avoiding a race condition in a patch -->
145 <xsl:when test="contains(string(),'debian_fixes')">
146 <xsl:value-of select="substring-before(string(),'patch')"/>
147 <xsl:text>patch -Z</xsl:text>
148 <xsl:value-of select="substring-after(string(),'patch')"/>
149 <xsl:text>&#xA;</xsl:text>
150 </xsl:when>
[ccc7c2b]151 <!-- Fix Udev reinstallation after a build failure -->
152 <xsl:when test="contains(string(),'firmware,udev')">
153 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
154 <xsl:apply-templates/>
155 <xsl:text>&#xA;fi&#xA;</xsl:text>
156 </xsl:when>
[877cc6a]157 <!-- Setting $LANG for /etc/profile -->
158 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
159 contains(string(),'export LANG=')">
160 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
161 <xsl:text>export LANG=</xsl:text>
162 <xsl:value-of select="$lang"/>
[71445e7]163 <xsl:value-of select="substring-after(string(),'modifiers>')"/>
[877cc6a]164 <xsl:text>&#xA;</xsl:text>
165 </xsl:when>
[fd691b4]166 <!-- Copying the kernel config file -->
167 <xsl:when test="string() = 'make mrproper'">
168 <xsl:text>make mrproper&#xA;</xsl:text>
169 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
[92568bf]170 </xsl:when>
[4e9a3b3]171 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]172 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[4e9a3b3]173 ancestor::sect1[@id='ch-system-module-init-tools']) and
[79f7cf9]174 (contains(string(),'check') or
[a229600]175 contains(string(),'dummy'))">
176 <xsl:choose>
177 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
178 <xsl:otherwise>
[28f4756]179 <xsl:if test="not(contains(string(),'check'))">
180 <xsl:apply-templates/>
181 <xsl:text>&#xA;</xsl:text>
182 </xsl:if>
[a229600]183 <xsl:if test="contains(string(),'check')">
[28f4756]184 <xsl:choose>
[401f81e]185 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]186 <xsl:value-of select="substring-before(string(),'check')"/>
187 <xsl:text>-k check</xsl:text>
188 <xsl:value-of select="substring-after(string(),'check')"/>
189 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
190 </xsl:when>
191 <xsl:otherwise>
192 <xsl:apply-templates/>
[a1f1969]193 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
194 <xsl:if test="contains(string(),' -k ')">
195 <xsl:text> || true</xsl:text>
196 </xsl:if>
197 <xsl:text>&#xA;</xsl:text>
[28f4756]198 </xsl:otherwise>
199 </xsl:choose>
[a229600]200 </xsl:if>
201 </xsl:otherwise>
202 </xsl:choose>
203 </xsl:when>
[fd691b4]204 <!-- Fixing toolchain test suites run -->
[01e51a1]205 <xsl:when test="string() = 'make check' or
206 string() = 'make -k check'">
207 <xsl:choose>
[31d6944]208 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
209 ancestor::chapter[@id='chapter-building-system']) or
210 $testsuite = '3'">
[28f4756]211 <xsl:choose>
[401f81e]212 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]213 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
214 </xsl:when>
215 <xsl:otherwise>
216 <xsl:apply-templates/>
[a1f1969]217 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
218 <xsl:if test="contains(string(),' -k ')">
219 <xsl:text> || true</xsl:text>
220 </xsl:if>
221 <xsl:text>&#xA;</xsl:text>
[28f4756]222 </xsl:otherwise>
223 </xsl:choose>
[31d6944]224 </xsl:when>
[fd691b4]225 </xsl:choose>
226 </xsl:when>
227 <xsl:when test="contains(string(),'glibc-check-log')">
228 <xsl:choose>
[31d6944]229 <xsl:when test="$testsuite != '0'">
[a229600]230 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
231 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[31d6944]232 </xsl:when>
[01e51a1]233 </xsl:choose>
234 </xsl:when>
[fd691b4]235 <xsl:when test="contains(string(),'test_summary') or
[92568bf]236 contains(string(),'expect -c')">
[01e51a1]237 <xsl:choose>
[31d6944]238 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
239 ancestor::chapter[@id='chapter-building-system']) or
240 $testsuite = '3'">
[01e51a1]241 <xsl:apply-templates/>
[28f4756]242 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[31d6944]243 </xsl:when>
[01e51a1]244 </xsl:choose>
[3eb60fa]245 </xsl:when>
[fd691b4]246 <!-- Don't stop on strip run -->
247 <xsl:when test="contains(string(),'strip ')">
[3eb60fa]248 <xsl:apply-templates/>
[fd691b4]249 <xsl:text> || true&#xA;</xsl:text>
[1f025ca]250 </xsl:when>
[fd691b4]251 <!-- The rest of commands -->
[1f025ca]252 <xsl:otherwise>
253 <xsl:apply-templates/>
[fd691b4]254 <xsl:text>&#xA;</xsl:text>
[1f025ca]255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:template>
258
[557fe91]259 <xsl:template match="replaceable">
[a41ce58]260 <xsl:choose>
[2a54650]261 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
[877cc6a]262 <xsl:value-of select="$timezone"/>
[2a54650]263 </xsl:when>
[a41ce58]264 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
[877cc6a]265 <xsl:value-of select="$page"/>
[a41ce58]266 </xsl:when>
267 <xsl:otherwise>
268 <xsl:text>**EDITME</xsl:text>
269 <xsl:apply-templates/>
270 <xsl:text>EDITME**</xsl:text>
271 </xsl:otherwise>
272 </xsl:choose>
[557fe91]273 </xsl:template>
274
275</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.