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