[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) > 0 and
|
---|
| 52 | count(descendant::screen/userinput) >
|
---|
| 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">
|
---|
[1330ebc] | 82 | <xsl:choose>
|
---|
| 83 | <xsl:when test="@id='ch-system-creatingdirs' or
|
---|
| 84 | @id='ch-system-createfiles'">
|
---|
| 85 | <xsl:text>#!/tools/bin/bash
set +h
</xsl:text>
|
---|
| 86 | </xsl:when>
|
---|
| 87 | <xsl:otherwise>
|
---|
| 88 | <xsl:text>#!/bin/bash
set +h
</xsl:text>
|
---|
| 89 | </xsl:otherwise>
|
---|
| 90 | </xsl:choose>
|
---|
[5f4982d] | 91 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
| 92 | not(@id='ch-system-strippingagain')">
|
---|
| 93 | <xsl:text>set -e
</xsl:text>
|
---|
| 94 | </xsl:if>
|
---|
| 95 | <xsl:text>
</xsl:text>
|
---|
[40700e9] | 96 | <xsl:if test="sect2[@role='installation']">
|
---|
| 97 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
| 98 | <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
---|
| 99 | <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</xsl:text>
|
---|
| 100 | </xsl:if>
|
---|
| 101 | </xsl:if>
|
---|
[db9cec6] | 102 | <xsl:apply-templates select=".//para/userinput | .//screen"/>
|
---|
[31d6944] | 103 | <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
|
---|
| 104 | <xsl:copy-of select="//sect1[@id='ch-system-glibc']/sect2[2]/screen[@role='nodump']"/>
|
---|
| 105 | <xsl:text>
</xsl:text>
|
---|
| 106 | </xsl:if>
|
---|
[40700e9] | 107 | <xsl:text>exit</xsl:text>
|
---|
[c4cf6de] | 108 | </exsl:document>
|
---|
| 109 | </xsl:if>
|
---|
[557fe91] | 110 | </xsl:template>
|
---|
| 111 |
|
---|
| 112 | <xsl:template match="screen">
|
---|
[31d6944] | 113 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
| 114 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
[557fe91] | 115 | </xsl:if>
|
---|
| 116 | </xsl:template>
|
---|
| 117 |
|
---|
[db9cec6] | 118 | <xsl:template match="para/userinput">
|
---|
[31d6944] | 119 | <xsl:if test="(contains(string(),'test') or
|
---|
| 120 | contains(string(),'check')) and
|
---|
| 121 | (($testsuite = '2' and
|
---|
| 122 | ancestor::chapter[@id='chapter-building-system']) or
|
---|
| 123 | $testsuite = '3')">
|
---|
[28f4756] | 124 | <xsl:choose>
|
---|
[401f81e] | 125 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 126 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 127 | <xsl:text>make -k</xsl:text>
|
---|
| 128 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 129 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 130 | </xsl:when>
|
---|
| 131 | <xsl:otherwise>
|
---|
| 132 | <xsl:apply-templates/>
|
---|
[a1f1969] | 133 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 134 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 135 | <xsl:text> || true</xsl:text>
|
---|
| 136 | </xsl:if>
|
---|
| 137 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 138 | </xsl:otherwise>
|
---|
| 139 | </xsl:choose>
|
---|
[db9cec6] | 140 | </xsl:if>
|
---|
| 141 | </xsl:template>
|
---|
| 142 |
|
---|
| 143 | <xsl:template match="userinput" mode="screen">
|
---|
[3eb60fa] | 144 | <xsl:choose>
|
---|
[fd691b4] | 145 | <!-- Estandarized package formats -->
|
---|
[92568bf] | 146 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 147 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
[be9970b] | 148 | <xsl:text>tar.*</xsl:text>
|
---|
[92568bf] | 149 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
[fd691b4] | 150 | <xsl:text>
</xsl:text>
|
---|
| 151 | </xsl:when>
|
---|
| 152 | <!-- Avoiding a race condition in a patch -->
|
---|
| 153 | <xsl:when test="contains(string(),'debian_fixes')">
|
---|
| 154 | <xsl:value-of select="substring-before(string(),'patch')"/>
|
---|
| 155 | <xsl:text>patch -Z</xsl:text>
|
---|
| 156 | <xsl:value-of select="substring-after(string(),'patch')"/>
|
---|
| 157 | <xsl:text>
</xsl:text>
|
---|
| 158 | </xsl:when>
|
---|
[ccc7c2b] | 159 | <!-- Fix Udev reinstallation after a build failure -->
|
---|
| 160 | <xsl:when test="contains(string(),'firmware,udev')">
|
---|
| 161 | <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>
|
---|
| 162 | <xsl:apply-templates/>
|
---|
| 163 | <xsl:text>
fi
</xsl:text>
|
---|
| 164 | </xsl:when>
|
---|
[877cc6a] | 165 | <!-- Setting $LANG for /etc/profile -->
|
---|
| 166 | <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
|
---|
| 167 | contains(string(),'export LANG=')">
|
---|
| 168 | <xsl:value-of select="substring-before(string(),'export LANG=')"/>
|
---|
| 169 | <xsl:text>export LANG=</xsl:text>
|
---|
| 170 | <xsl:value-of select="$lang"/>
|
---|
[71445e7] | 171 | <xsl:value-of select="substring-after(string(),'modifiers>')"/>
|
---|
[877cc6a] | 172 | <xsl:text>
</xsl:text>
|
---|
| 173 | </xsl:when>
|
---|
[fd691b4] | 174 | <!-- Copying the kernel config file -->
|
---|
| 175 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 176 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 177 | <xsl:text>cp -v ../kernel-config .config
</xsl:text>
|
---|
[92568bf] | 178 | </xsl:when>
|
---|
[4e9a3b3] | 179 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
[a229600] | 180 | <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
[4e9a3b3] | 181 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
[79f7cf9] | 182 | (contains(string(),'check') or
|
---|
[a229600] | 183 | contains(string(),'dummy'))">
|
---|
| 184 | <xsl:choose>
|
---|
| 185 | <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
|
---|
| 186 | <xsl:otherwise>
|
---|
[28f4756] | 187 | <xsl:if test="not(contains(string(),'check'))">
|
---|
| 188 | <xsl:apply-templates/>
|
---|
| 189 | <xsl:text>
</xsl:text>
|
---|
| 190 | </xsl:if>
|
---|
[a229600] | 191 | <xsl:if test="contains(string(),'check')">
|
---|
[28f4756] | 192 | <xsl:choose>
|
---|
[401f81e] | 193 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 194 | <xsl:value-of select="substring-before(string(),'check')"/>
|
---|
| 195 | <xsl:text>-k check</xsl:text>
|
---|
| 196 | <xsl:value-of select="substring-after(string(),'check')"/>
|
---|
| 197 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 198 | </xsl:when>
|
---|
| 199 | <xsl:otherwise>
|
---|
| 200 | <xsl:apply-templates/>
|
---|
[a1f1969] | 201 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 202 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 203 | <xsl:text> || true</xsl:text>
|
---|
| 204 | </xsl:if>
|
---|
| 205 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 206 | </xsl:otherwise>
|
---|
| 207 | </xsl:choose>
|
---|
[a229600] | 208 | </xsl:if>
|
---|
| 209 | </xsl:otherwise>
|
---|
| 210 | </xsl:choose>
|
---|
| 211 | </xsl:when>
|
---|
[fd691b4] | 212 | <!-- Fixing toolchain test suites run -->
|
---|
[01e51a1] | 213 | <xsl:when test="string() = 'make check' or
|
---|
| 214 | string() = 'make -k check'">
|
---|
| 215 | <xsl:choose>
|
---|
[31d6944] | 216 | <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
|
---|
| 217 | ancestor::chapter[@id='chapter-building-system']) or
|
---|
| 218 | $testsuite = '3'">
|
---|
[28f4756] | 219 | <xsl:choose>
|
---|
[401f81e] | 220 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 221 | <xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 222 | </xsl:when>
|
---|
| 223 | <xsl:otherwise>
|
---|
| 224 | <xsl:apply-templates/>
|
---|
[a1f1969] | 225 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 226 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 227 | <xsl:text> || true</xsl:text>
|
---|
| 228 | </xsl:if>
|
---|
| 229 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 230 | </xsl:otherwise>
|
---|
| 231 | </xsl:choose>
|
---|
[31d6944] | 232 | </xsl:when>
|
---|
[fd691b4] | 233 | </xsl:choose>
|
---|
| 234 | </xsl:when>
|
---|
| 235 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 236 | <xsl:choose>
|
---|
[31d6944] | 237 | <xsl:when test="$testsuite != '0'">
|
---|
[a229600] | 238 | <xsl:value-of select="substring-before(string(),'2>&1')"/>
|
---|
| 239 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
[31d6944] | 240 | </xsl:when>
|
---|
[01e51a1] | 241 | </xsl:choose>
|
---|
| 242 | </xsl:when>
|
---|
[fd691b4] | 243 | <xsl:when test="contains(string(),'test_summary') or
|
---|
[92568bf] | 244 | contains(string(),'expect -c')">
|
---|
[01e51a1] | 245 | <xsl:choose>
|
---|
[31d6944] | 246 | <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
|
---|
| 247 | ancestor::chapter[@id='chapter-building-system']) or
|
---|
| 248 | $testsuite = '3'">
|
---|
[01e51a1] | 249 | <xsl:apply-templates/>
|
---|
[28f4756] | 250 | <xsl:text> >> $TEST_LOG
</xsl:text>
|
---|
[31d6944] | 251 | </xsl:when>
|
---|
[01e51a1] | 252 | </xsl:choose>
|
---|
[3eb60fa] | 253 | </xsl:when>
|
---|
[fd691b4] | 254 | <!-- Don't stop on strip run -->
|
---|
| 255 | <xsl:when test="contains(string(),'strip ')">
|
---|
[3eb60fa] | 256 | <xsl:apply-templates/>
|
---|
[fd691b4] | 257 | <xsl:text> || true
</xsl:text>
|
---|
[1f025ca] | 258 | </xsl:when>
|
---|
[fd691b4] | 259 | <!-- The rest of commands -->
|
---|
[1f025ca] | 260 | <xsl:otherwise>
|
---|
| 261 | <xsl:apply-templates/>
|
---|
[fd691b4] | 262 | <xsl:text>
</xsl:text>
|
---|
[1f025ca] | 263 | </xsl:otherwise>
|
---|
| 264 | </xsl:choose>
|
---|
| 265 | </xsl:template>
|
---|
| 266 |
|
---|
[557fe91] | 267 | <xsl:template match="replaceable">
|
---|
[a41ce58] | 268 | <xsl:choose>
|
---|
[2a54650] | 269 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
---|
[877cc6a] | 270 | <xsl:value-of select="$timezone"/>
|
---|
[2a54650] | 271 | </xsl:when>
|
---|
[a41ce58] | 272 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
[877cc6a] | 273 | <xsl:value-of select="$page"/>
|
---|
[a41ce58] | 274 | </xsl:when>
|
---|
| 275 | <xsl:otherwise>
|
---|
| 276 | <xsl:text>**EDITME</xsl:text>
|
---|
| 277 | <xsl:apply-templates/>
|
---|
| 278 | <xsl:text>EDITME**</xsl:text>
|
---|
| 279 | </xsl:otherwise>
|
---|
| 280 | </xsl:choose>
|
---|
[557fe91] | 281 | </xsl:template>
|
---|
| 282 |
|
---|
| 283 | </xsl:stylesheet>
|
---|