[877cc6a] | 1 | <?xml version="1.0"?>
|
---|
| 2 | <!DOCTYPE xsl:stylesheet [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 |
|
---|
| 7 | <!-- $Id$ -->
|
---|
| 8 |
|
---|
| 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 |
|
---|
| 14 | <!-- XSLT stylesheet to create shell scripts from CLFS books. -->
|
---|
| 15 |
|
---|
| 16 | <!-- Build method used -->
|
---|
| 17 | <xsl:param name="method" select="chroot"/>
|
---|
| 18 |
|
---|
| 19 | <!-- Run test suites?
|
---|
| 20 | 0 = none
|
---|
| 21 | 1 = only Glibc, GCC and Binutils testsuites
|
---|
| 22 | 2 = all testsuites
|
---|
[28f4756] | 23 | 3 = alias to 2
|
---|
| 24 | -->
|
---|
[877cc6a] | 25 | <xsl:param name="testsuite" select="1"/>
|
---|
| 26 |
|
---|
[28f4756] | 27 | <!-- Bomb on test suites failures?
|
---|
[401f81e] | 28 | n = no, I want to build the full system and review the logs
|
---|
| 29 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
[28f4756] | 30 | -->
|
---|
[401f81e] | 31 | <xsl:param name="bomb-testsuite" select="n"/>
|
---|
[28f4756] | 32 |
|
---|
[877cc6a] | 33 | <!-- Install vim-lang package? -->
|
---|
[401f81e] | 34 | <xsl:param name="vim-lang" select="y"/>
|
---|
[877cc6a] | 35 |
|
---|
| 36 | <!-- Time zone -->
|
---|
[a229600] | 37 | <xsl:param name="timezone" select="GMT"/>
|
---|
[877cc6a] | 38 |
|
---|
| 39 | <!-- Page size -->
|
---|
| 40 | <xsl:param name="page" select="letter"/>
|
---|
| 41 |
|
---|
| 42 | <!-- Locale settings -->
|
---|
[a229600] | 43 | <xsl:param name="lang" select="C"/>
|
---|
[877cc6a] | 44 |
|
---|
| 45 | <xsl:template match="/">
|
---|
| 46 | <xsl:apply-templates select="//sect1"/>
|
---|
| 47 | </xsl:template>
|
---|
| 48 |
|
---|
| 49 | <xsl:template match="sect1">
|
---|
| 50 | <xsl:choose>
|
---|
| 51 | <xsl:when test="../@id='chapter-partitioning' or
|
---|
| 52 | ../@id='chapter-getting-materials' or
|
---|
| 53 | ../@id='chapter-final-preps'"/>
|
---|
| 54 | <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
|
---|
| 55 | <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
|
---|
| 56 | <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
|
---|
| 57 | <xsl:otherwise>
|
---|
| 58 | <xsl:if test="count(descendant::screen/userinput) > 0 and
|
---|
| 59 | count(descendant::screen/userinput) >
|
---|
| 60 | count(descendant::screen[@role='nodump'])">
|
---|
| 61 | <!-- The dirs names -->
|
---|
| 62 | <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
---|
| 63 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 64 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 65 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 66 | <!-- The file names -->
|
---|
| 67 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 68 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 69 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 70 | <!-- The build order -->
|
---|
| 71 | <xsl:variable name="position" select="position()"/>
|
---|
| 72 | <xsl:variable name="order">
|
---|
| 73 | <xsl:choose>
|
---|
| 74 | <xsl:when test="string-length($position) = 1">
|
---|
| 75 | <xsl:text>00</xsl:text>
|
---|
| 76 | <xsl:value-of select="$position"/>
|
---|
| 77 | </xsl:when>
|
---|
| 78 | <xsl:when test="string-length($position) = 2">
|
---|
| 79 | <xsl:text>0</xsl:text>
|
---|
| 80 | <xsl:value-of select="$position"/>
|
---|
| 81 | </xsl:when>
|
---|
| 82 | <xsl:otherwise>
|
---|
| 83 | <xsl:value-of select="$position"/>
|
---|
| 84 | </xsl:otherwise>
|
---|
| 85 | </xsl:choose>
|
---|
| 86 | </xsl:variable>
|
---|
| 87 | <!-- Creating dirs and files -->
|
---|
| 88 | <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
---|
[1330ebc] | 89 | <xsl:choose>
|
---|
| 90 | <xsl:when test="@id='ch-chroot-changingowner' or
|
---|
| 91 | @id='ch-chroot-creatingdirs' or
|
---|
| 92 | @id='ch-chroot-createfiles'">
|
---|
| 93 | <xsl:text>#!/tools/bin/bash
set +h
</xsl:text>
|
---|
| 94 | </xsl:when>
|
---|
| 95 | <xsl:otherwise>
|
---|
| 96 | <xsl:text>#!/bin/bash
set +h
</xsl:text>
|
---|
| 97 | </xsl:otherwise>
|
---|
| 98 | </xsl:choose>
|
---|
[5f4982d] | 99 | <xsl:if test="not(@id='ch-system-stripping')">
|
---|
| 100 | <xsl:text>set -e</xsl:text>
|
---|
| 101 | </xsl:if>
|
---|
| 102 | <xsl:text>
</xsl:text>
|
---|
[877cc6a] | 103 | <xsl:if test="sect2[@role='installation']">
|
---|
| 104 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
[401f81e] | 105 | <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
---|
[877cc6a] | 106 | <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</xsl:text>
|
---|
| 107 | </xsl:if>
|
---|
| 108 | </xsl:if>
|
---|
| 109 | <xsl:apply-templates select=".//para/userinput | .//screen"/>
|
---|
| 110 | <xsl:text>exit</xsl:text>
|
---|
| 111 | </exsl:document>
|
---|
| 112 | </xsl:if>
|
---|
| 113 | </xsl:otherwise>
|
---|
| 114 | </xsl:choose>
|
---|
| 115 | </xsl:template>
|
---|
| 116 |
|
---|
| 117 | <xsl:template match="screen">
|
---|
| 118 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
| 119 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
| 120 | </xsl:if>
|
---|
| 121 | </xsl:template>
|
---|
| 122 |
|
---|
| 123 | <xsl:template match="para/userinput">
|
---|
| 124 | <xsl:if test="(contains(string(),'test') or
|
---|
| 125 | contains(string(),'check')) and
|
---|
| 126 | ($testsuite = '2' or $testsuite = '3')">
|
---|
[28f4756] | 127 | <xsl:choose>
|
---|
[401f81e] | 128 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 129 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 130 | <xsl:text>make -k</xsl:text>
|
---|
| 131 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 132 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 133 | </xsl:when>
|
---|
| 134 | <xsl:otherwise>
|
---|
| 135 | <xsl:apply-templates/>
|
---|
[a1f1969] | 136 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 137 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 138 | <xsl:text> || true</xsl:text>
|
---|
| 139 | </xsl:if>
|
---|
| 140 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 141 | </xsl:otherwise>
|
---|
| 142 | </xsl:choose>
|
---|
[877cc6a] | 143 | </xsl:if>
|
---|
| 144 | </xsl:template>
|
---|
| 145 |
|
---|
| 146 | <xsl:template match="userinput" mode="screen">
|
---|
| 147 | <xsl:choose>
|
---|
| 148 | <!-- Estandarized package formats -->
|
---|
| 149 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 150 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 151 | <xsl:text>tar.*</xsl:text>
|
---|
| 152 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 153 | <xsl:text>
</xsl:text>
|
---|
| 154 | </xsl:when>
|
---|
| 155 | <!-- Setting $LANG for /etc/profile -->
|
---|
| 156 | <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
|
---|
| 157 | contains(string(),'export LANG=')">
|
---|
| 158 | <xsl:value-of select="substring-before(string(),'export LANG=')"/>
|
---|
| 159 | <xsl:text>export LANG=</xsl:text>
|
---|
| 160 | <xsl:value-of select="$lang"/>
|
---|
| 161 | <xsl:value-of select="substring-after(string(),'charmap]')"/>
|
---|
| 162 | <xsl:text>
</xsl:text>
|
---|
| 163 | </xsl:when>
|
---|
[f4caf9c] | 164 | <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
|
---|
| 165 | <xsl:when test="contains(string(),'defkeymap')"/>
|
---|
[877cc6a] | 166 | <!-- Copying the kernel config file -->
|
---|
| 167 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 168 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 169 | <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
|
---|
| 170 | <xsl:text>cp -v ../bootkernel-config .config
</xsl:text>
|
---|
| 171 | </xsl:if>
|
---|
| 172 | <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
|
---|
| 173 | <xsl:text>cp -v ../kernel-config .config
</xsl:text>
|
---|
| 174 | </xsl:if>
|
---|
| 175 | </xsl:when>
|
---|
| 176 | <!-- No interactive commands are needed if the .config file is the proper one -->
|
---|
| 177 | <xsl:when test="contains(string(),'menuconfig')"/>
|
---|
| 178 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
[a229600] | 179 | <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
[877cc6a] | 180 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
| 181 | (contains(string(),'check') or
|
---|
[a229600] | 182 | contains(string(),'dummy'))">
|
---|
| 183 | <xsl:choose>
|
---|
| 184 | <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
|
---|
| 185 | <xsl:otherwise>
|
---|
[28f4756] | 186 | <xsl:if test="not(contains(string(),'check'))">
|
---|
| 187 | <xsl:apply-templates/>
|
---|
| 188 | <xsl:text>
</xsl:text>
|
---|
| 189 | </xsl:if>
|
---|
[a229600] | 190 | <xsl:if test="contains(string(),'check')">
|
---|
[28f4756] | 191 | <xsl:choose>
|
---|
[401f81e] | 192 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 193 | <xsl:value-of select="substring-before(string(),'check')"/>
|
---|
| 194 | <xsl:text>-k check</xsl:text>
|
---|
| 195 | <xsl:value-of select="substring-after(string(),'check')"/>
|
---|
| 196 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 197 | </xsl:when>
|
---|
| 198 | <xsl:otherwise>
|
---|
| 199 | <xsl:apply-templates/>
|
---|
[3014928] | 200 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
[a1f1969] | 201 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 202 | <xsl:text> || true</xsl:text>
|
---|
| 203 | </xsl:if>
|
---|
[f98695c] | 204 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 205 | </xsl:otherwise>
|
---|
| 206 | </xsl:choose>
|
---|
[a229600] | 207 | </xsl:if>
|
---|
| 208 | </xsl:otherwise>
|
---|
| 209 | </xsl:choose>
|
---|
| 210 | </xsl:when>
|
---|
[877cc6a] | 211 | <!-- Fixing toolchain test suites run -->
|
---|
| 212 | <xsl:when test="string() = 'make check' or
|
---|
| 213 | string() = 'make -k check'">
|
---|
| 214 | <xsl:choose>
|
---|
| 215 | <xsl:when test="$testsuite != '0'">
|
---|
[28f4756] | 216 | <xsl:choose>
|
---|
[401f81e] | 217 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 218 | <xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 219 | </xsl:when>
|
---|
| 220 | <xsl:otherwise>
|
---|
| 221 | <xsl:apply-templates/>
|
---|
[a1f1969] | 222 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 223 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 224 | <xsl:text> || true</xsl:text>
|
---|
| 225 | </xsl:if>
|
---|
| 226 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 227 | </xsl:otherwise>
|
---|
| 228 | </xsl:choose>
|
---|
[877cc6a] | 229 | </xsl:when>
|
---|
| 230 | </xsl:choose>
|
---|
| 231 | </xsl:when>
|
---|
| 232 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 233 | <xsl:choose>
|
---|
| 234 | <xsl:when test="$testsuite != '0'">
|
---|
[a229600] | 235 | <xsl:value-of select="substring-before(string(),'>g')"/>
|
---|
[28f4756] | 236 | <xsl:choose>
|
---|
[401f81e] | 237 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 238 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 239 | </xsl:when>
|
---|
| 240 | <xsl:otherwise>
|
---|
[a1f1969] | 241 | <xsl:text>>> $TEST_LOG 2>&1</xsl:text>
|
---|
| 242 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 243 | <xsl:text> || true</xsl:text>
|
---|
| 244 | </xsl:if>
|
---|
| 245 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 246 | </xsl:otherwise>
|
---|
| 247 | </xsl:choose>
|
---|
[877cc6a] | 248 | </xsl:when>
|
---|
| 249 | </xsl:choose>
|
---|
| 250 | </xsl:when>
|
---|
| 251 | <xsl:when test="contains(string(),'test_summary') or
|
---|
| 252 | contains(string(),'expect -c')">
|
---|
| 253 | <xsl:choose>
|
---|
| 254 | <xsl:when test="$testsuite != '0'">
|
---|
| 255 | <xsl:apply-templates/>
|
---|
[28f4756] | 256 | <xsl:text> >> $TEST_LOG
</xsl:text>
|
---|
[877cc6a] | 257 | </xsl:when>
|
---|
| 258 | </xsl:choose>
|
---|
| 259 | </xsl:when>
|
---|
| 260 | <!-- Don't stop on strip run -->
|
---|
| 261 | <xsl:when test="contains(string(),'strip ')">
|
---|
| 262 | <xsl:apply-templates/>
|
---|
| 263 | <xsl:text> || true
</xsl:text>
|
---|
| 264 | </xsl:when>
|
---|
| 265 | <!-- The rest of commands -->
|
---|
| 266 | <xsl:otherwise>
|
---|
| 267 | <xsl:apply-templates/>
|
---|
| 268 | <xsl:text>
</xsl:text>
|
---|
| 269 | </xsl:otherwise>
|
---|
| 270 | </xsl:choose>
|
---|
| 271 | </xsl:template>
|
---|
| 272 |
|
---|
| 273 | <xsl:template match="replaceable">
|
---|
| 274 | <xsl:choose>
|
---|
| 275 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
---|
| 276 | <xsl:value-of select="$timezone"/>
|
---|
| 277 | </xsl:when>
|
---|
| 278 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
| 279 | <xsl:value-of select="$page"/>
|
---|
| 280 | </xsl:when>
|
---|
| 281 | <xsl:otherwise>
|
---|
| 282 | <xsl:text>**EDITME</xsl:text>
|
---|
| 283 | <xsl:apply-templates/>
|
---|
| 284 | <xsl:text>EDITME**</xsl:text>
|
---|
| 285 | </xsl:otherwise>
|
---|
| 286 | </xsl:choose>
|
---|
| 287 | </xsl:template>
|
---|
| 288 |
|
---|
| 289 | </xsl:stylesheet>
|
---|