[0170229] | 1 | <?xml version="1.0"?>
|
---|
| 2 |
|
---|
[3a5c9cc] | 3 | <!-- $Id$ -->
|
---|
| 4 |
|
---|
[0170229] | 5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 6 | xmlns:exsl="http://exslt.org/common"
|
---|
| 7 | extension-element-prefixes="exsl"
|
---|
| 8 | version="1.0">
|
---|
| 9 |
|
---|
| 10 | <!-- XSLT stylesheet to create shell scripts from LFS books. -->
|
---|
| 11 |
|
---|
[1f10495] | 12 | <!-- Including common extensions templates -->
|
---|
| 13 | <xsl:include href="../XSL/user.xsl"/>
|
---|
| 14 |
|
---|
[3778352] | 15 | <!-- ####################### PARAMETERS ################################### -->
|
---|
| 16 |
|
---|
[6db1464] | 17 | <!-- Run test suites?
|
---|
| 18 | 0 = none
|
---|
| 19 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
| 20 | 2 = all chapter06 testsuites
|
---|
[056486c] | 21 | 3 = all chapter05 and chapter06 testsuites
|
---|
| 22 | -->
|
---|
[c0f8256] | 23 | <xsl:param name="testsuite">1</xsl:param>
|
---|
[0170229] | 24 |
|
---|
[056486c] | 25 | <!-- Bomb on test suites failures?
|
---|
[47fddc8] | 26 | n = no, I want to build the full system and review the logs
|
---|
| 27 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
[056486c] | 28 | -->
|
---|
[c0f8256] | 29 | <xsl:param name="bomb-testsuite">n</xsl:param>
|
---|
[056486c] | 30 |
|
---|
[0170229] | 31 | <!-- Install vim-lang package? -->
|
---|
[c0f8256] | 32 | <xsl:param name="vim-lang">y</xsl:param>
|
---|
[0170229] | 33 |
|
---|
[ad71d98] | 34 | <!-- Time zone -->
|
---|
[c0f8256] | 35 | <xsl:param name="timezone">GMT</xsl:param>
|
---|
[ad71d98] | 36 |
|
---|
| 37 | <!-- Page size -->
|
---|
[c0f8256] | 38 | <xsl:param name="page">letter</xsl:param>
|
---|
[ad71d98] | 39 |
|
---|
[3778352] | 40 | <!-- Locale setting -->
|
---|
[c0f8256] | 41 | <xsl:param name="lang">C</xsl:param>
|
---|
| 42 |
|
---|
| 43 | <!-- Custom tools support -->
|
---|
| 44 | <xsl:param name="custom-tools">n</xsl:param>
|
---|
| 45 |
|
---|
| 46 | <!-- blfs-tool support -->
|
---|
| 47 | <xsl:param name="blfs-tool">n</xsl:param>
|
---|
[d87b293] | 48 |
|
---|
[13b4ab5] | 49 |
|
---|
| 50 | <!-- ####################################################################### -->
|
---|
| 51 |
|
---|
| 52 | <!-- ########### NAMED USER TEMPLATES TO ALLOW CUSTOMIZATIONS ############## -->
|
---|
[f5f857d] | 53 | <!-- ############ Maybe should be placed on a separate file ################ -->
|
---|
[13b4ab5] | 54 |
|
---|
[097df00] | 55 |
|
---|
[c0f8256] | 56 | <!-- Hock for creating a custom tools directory containing scripts
|
---|
[f5f857d] | 57 | to be run after the system has been built
|
---|
| 58 | (to be moved to a separate file) -->
|
---|
[c0f8256] | 59 | <xsl:template name="custom-tools">
|
---|
[097df00] | 60 | <!-- Fixed directory and ch_order values -->
|
---|
[c0f8256] | 61 | <xsl:variable name="basedir">custom-tools/20_</xsl:variable>
|
---|
[097df00] | 62 | <!-- Add an exsl:document block for each script to be created.
|
---|
[c0f8256] | 63 | This one is only a dummy example. You must replace "01" by
|
---|
| 64 | the proper build order and "dummy" by the script name -->
|
---|
| 65 | <exsl:document href="{$basedir}01-dummy" method="text">
|
---|
| 66 | <xsl:call-template name="header"/>
|
---|
| 67 | <xsl:text>
|
---|
| 68 | PKG_PHASE=dummy
|
---|
| 69 | PACKAGE=dummy
|
---|
| 70 | VERSION=0.0.0
|
---|
| 71 | TARBALL=dummy-0.0.0.tar.bz2
|
---|
[570c9f3] | 72 | </xsl:text>
|
---|
[51e3d23] | 73 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 74 | <xsl:call-template name="unpack"/>
|
---|
| 75 | <xsl:text>
|
---|
[c0f8256] | 76 | cd $PKGDIR
|
---|
| 77 | ./configure --prefix=/usr
|
---|
| 78 | make
|
---|
| 79 | make check
|
---|
| 80 | make install
|
---|
| 81 | </xsl:text>
|
---|
[51e3d23] | 82 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 83 | <xsl:call-template name="clean_sources"/>
|
---|
[c0f8256] | 84 | <xsl:call-template name="footer"/>
|
---|
| 85 | </exsl:document>
|
---|
| 86 | </xsl:template>
|
---|
| 87 |
|
---|
| 88 |
|
---|
[3778352] | 89 | <!-- ####################################################################### -->
|
---|
| 90 |
|
---|
| 91 | <!-- ########################### NAMED TEMPLATES ########################### -->
|
---|
| 92 |
|
---|
| 93 | <!-- Chapter directory name (the same used for HTML output) -->
|
---|
| 94 | <xsl:template name="dirname">
|
---|
| 95 | <xsl:variable name="pi-dir" select="processing-instruction('dbhtml')"/>
|
---|
| 96 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 97 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 98 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 99 | <xsl:value-of select="$dirname"/>
|
---|
| 100 | </xsl:template>
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | <!-- Base file name (the same used for HTML output) -->
|
---|
| 104 | <xsl:template name="filename">
|
---|
| 105 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 106 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 107 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 108 | <xsl:value-of select="$filename"/>
|
---|
| 109 | </xsl:template>
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | <!-- Script header -->
|
---|
| 113 | <xsl:template name="header">
|
---|
[51e3d23] | 114 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 115 | not(@id='ch-system-revisedchroot')">
|
---|
| 116 | <!-- Set the shabang -->
|
---|
| 117 | <xsl:choose>
|
---|
| 118 | <xsl:when test="@id='ch-system-creatingdirs' or
|
---|
| 119 | @id='ch-system-createfiles' or
|
---|
| 120 | @id='ch-system-strippingagain'">
|
---|
| 121 | <xsl:text>#!/tools/bin/bash
</xsl:text>
|
---|
| 122 | </xsl:when>
|
---|
| 123 | <xsl:otherwise>
|
---|
| 124 | <xsl:text>#!/bin/bash
</xsl:text>
|
---|
| 125 | </xsl:otherwise>
|
---|
| 126 | </xsl:choose>
|
---|
| 127 | <!-- Set +h -->
|
---|
| 128 | <xsl:text>set +h
</xsl:text>
|
---|
| 129 | <!-- Set -e -->
|
---|
| 130 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
| 131 | not(@id='ch-system-strippingagain')">
|
---|
| 132 | <xsl:text>set -e
</xsl:text>
|
---|
| 133 | </xsl:if>
|
---|
| 134 | <!-- Dump a time stamp -->
|
---|
| 135 | <xsl:text>
echo -e "\n`date`\n"
</xsl:text>
|
---|
[3778352] | 136 | </xsl:if>
|
---|
| 137 | </xsl:template>
|
---|
| 138 |
|
---|
| 139 |
|
---|
[51e3d23] | 140 | <!-- Dump current disk usage -->
|
---|
| 141 | <xsl:template name="disk_usage">
|
---|
| 142 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 143 | not(@id='ch-system-revisedchroot')">
|
---|
| 144 | <xsl:choose>
|
---|
| 145 | <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 146 | <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"
</xsl:text>
|
---|
| 147 | </xsl:when>
|
---|
| 148 | <xsl:otherwise>
|
---|
| 149 | <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"
</xsl:text>
|
---|
| 150 | </xsl:otherwise>
|
---|
| 151 | </xsl:choose>
|
---|
| 152 | </xsl:if>
|
---|
| 153 | </xsl:template>
|
---|
| 154 |
|
---|
| 155 |
|
---|
| 156 | <!-- Enter to the sources dir, clean it, unpack the tarball,
|
---|
| 157 | and reset the seconds counter -->
|
---|
[570c9f3] | 158 | <xsl:template name="unpack">
|
---|
[f5f857d] | 159 | <xsl:text>cd </xsl:text>
|
---|
| 160 | <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 161 | <xsl:text>$LFS</xsl:text>
|
---|
| 162 | </xsl:if>
|
---|
| 163 | <xsl:text>/sources
|
---|
[570c9f3] | 164 | PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
|
---|
| 165 | if [ -d $PKGDIR ]; then
|
---|
| 166 | rm -rf $PKGDIR
|
---|
| 167 | fi
|
---|
| 168 | if [ -d ${PKGDIR%-*}-build ]; then
|
---|
| 169 | rm -rf ${PKGDIR%-*}-build
|
---|
| 170 | fi
|
---|
| 171 | tar -xf $TARBALL
|
---|
[51e3d23] | 172 | SECONDS=0
|
---|
[570c9f3] | 173 | </xsl:text>
|
---|
| 174 | </xsl:template>
|
---|
| 175 |
|
---|
| 176 |
|
---|
[3778352] | 177 | <!-- Extra previous commands needed by the book but not inside screen tags -->
|
---|
| 178 | <xsl:template name="pre_commands">
|
---|
| 179 | <xsl:if test="sect2[@role='installation']">
|
---|
| 180 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
| 181 | </xsl:if>
|
---|
| 182 | <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
---|
[570c9f3] | 183 | <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1
</xsl:text>
|
---|
[3778352] | 184 | </xsl:if>
|
---|
| 185 | </xsl:template>
|
---|
| 186 |
|
---|
| 187 |
|
---|
| 188 | <!-- Extra post commands needed by the book but not inside screen tags -->
|
---|
| 189 | <xsl:template name="post_commands">
|
---|
| 190 | <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
|
---|
[8533c26] | 191 | <xsl:variable name="content" select="//userinput[@remap='locale-test']"/>
|
---|
| 192 | <xsl:value-of select="substring-before($content,'/usr/lib/locale')"/>
|
---|
| 193 | <xsl:text>/tools/lib/locale</xsl:text>
|
---|
| 194 | <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/>
|
---|
[3778352] | 195 | </xsl:if>
|
---|
| 196 | </xsl:template>
|
---|
| 197 |
|
---|
| 198 |
|
---|
[51e3d23] | 199 | <!-- Remove sources and build dirs, skipping it from seconds meassurament -->
|
---|
[570c9f3] | 200 | <xsl:template name="clean_sources">
|
---|
[f5f857d] | 201 | <xsl:text>cd </xsl:text>
|
---|
| 202 | <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 203 | <xsl:text>$LFS</xsl:text>
|
---|
| 204 | </xsl:if>
|
---|
| 205 | <xsl:text>/sources
|
---|
[51e3d23] | 206 | SECS=$SECONDS
|
---|
[570c9f3] | 207 | rm -rf $PKGDIR
|
---|
| 208 | rm -rf ${PKGDIR%-*}-build
|
---|
[51e3d23] | 209 | SECONDS=$SECS
|
---|
[570c9f3] | 210 | </xsl:text>
|
---|
| 211 | </xsl:template>
|
---|
| 212 |
|
---|
| 213 |
|
---|
[3778352] | 214 | <!-- Script footer -->
|
---|
| 215 | <xsl:template name="footer">
|
---|
[51e3d23] | 216 | <!-- Dump the build time and exit -->
|
---|
[3778352] | 217 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 218 | not(@id='ch-system-revisedchroot')">
|
---|
[51e3d23] | 219 | <xsl:text>
|
---|
| 220 | echo -e "\n\nTotalseconds: $SECONDS\n"
|
---|
| 221 |
|
---|
| 222 | exit
|
---|
| 223 | </xsl:text>
|
---|
[3778352] | 224 | </xsl:if>
|
---|
[13b4ab5] | 225 | </xsl:template>
|
---|
[3778352] | 226 |
|
---|
[13b4ab5] | 227 |
|
---|
[fa1b640] | 228 | <!-- Extra commads needed at the start of some screen block
|
---|
| 229 | to allow automatization -->
|
---|
| 230 | <xsl:template name="top_screen_build_fixes">
|
---|
| 231 | <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
|
---|
| 232 | <xsl:if test="contains(string(),'firmware,udev')">
|
---|
| 233 | <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>
|
---|
| 234 | </xsl:if>
|
---|
| 235 | </xsl:template>
|
---|
| 236 |
|
---|
| 237 |
|
---|
| 238 | <!-- Extra commads needed at the end of some screen block
|
---|
| 239 | to allow automatization -->
|
---|
| 240 | <xsl:template name="bottom_screen_build_fixes">
|
---|
| 241 | <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
|
---|
| 242 | <xsl:if test="contains(string(),'firmware,udev')">
|
---|
| 243 | <xsl:text>
fi</xsl:text>
|
---|
| 244 | </xsl:if>
|
---|
| 245 | <!-- Copying the kernel config file -->
|
---|
| 246 | <xsl:if test="string() = 'make mrproper'">
|
---|
| 247 | <xsl:text>
cp -v ../kernel-config .config</xsl:text>
|
---|
| 248 | </xsl:if>
|
---|
| 249 | <!-- Don't stop on strip run -->
|
---|
| 250 | <xsl:if test="contains(string(),'strip --strip')">
|
---|
| 251 | <xsl:text> || true</xsl:text>
|
---|
| 252 | </xsl:if>
|
---|
| 253 | </xsl:template>
|
---|
| 254 |
|
---|
| 255 |
|
---|
[13b4ab5] | 256 | <!-- Extract a package name from a package URL -->
|
---|
| 257 | <xsl:template name="package_name">
|
---|
| 258 | <xsl:param name="url" select="foo"/>
|
---|
| 259 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 260 | <xsl:choose>
|
---|
| 261 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 262 | <xsl:call-template name="package_name">
|
---|
| 263 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 264 | </xsl:call-template>
|
---|
| 265 | </xsl:when>
|
---|
| 266 | <xsl:otherwise>
|
---|
| 267 | <xsl:value-of select="$sub-url"/>
|
---|
| 268 | </xsl:otherwise>
|
---|
| 269 | </xsl:choose>
|
---|
[3778352] | 270 | </xsl:template>
|
---|
| 271 |
|
---|
[13b4ab5] | 272 |
|
---|
[f5f857d] | 273 | <!-- Check if a package testsuite must be run -->
|
---|
| 274 | <xsl:template name="run_this_test">
|
---|
| 275 | <xsl:choose>
|
---|
| 276 | <xsl:when test=".//userinput[@remap='test']">
|
---|
| 277 | <xsl:choose>
|
---|
| 278 | <!-- No testsuites run on level 0 -->
|
---|
| 279 | <xsl:when test="$testsuite = '0'">0</xsl:when>
|
---|
| 280 | <!-- On level 1, only final system toolchain testsuites are run -->
|
---|
| 281 | <xsl:when test="$testsuite = '1' and
|
---|
| 282 | not(@id='ch-system-gcc') and
|
---|
| 283 | not(@id='ch-system-glibc') and
|
---|
| 284 | not(@id='ch-system-binutils')">0</xsl:when>
|
---|
| 285 | <!-- On level 2, temp tools testsuites are not run -->
|
---|
| 286 | <xsl:when test="$testsuite = '2' and
|
---|
| 287 | ../@id='chapter-temporary-tools'">0</xsl:when>
|
---|
| 288 | <xsl:otherwise>1</xsl:otherwise>
|
---|
| 289 | </xsl:choose>
|
---|
| 290 | </xsl:when>
|
---|
| 291 | <xsl:otherwise>0</xsl:otherwise>
|
---|
| 292 | </xsl:choose>
|
---|
| 293 | </xsl:template>
|
---|
| 294 |
|
---|
| 295 |
|
---|
| 296 | <!-- Adds blfs-tool support scripts (to be moved to a separate file) -->
|
---|
[c0f8256] | 297 | <xsl:template name="blfs-tool">
|
---|
[097df00] | 298 | <!-- Fixed directory and ch_order values -->
|
---|
[c0f8256] | 299 | <xsl:variable name="basedir">blfs-tool-deps/30_</xsl:variable>
|
---|
| 300 | <!-- One exsl:document block for each blfs-tool dependency
|
---|
| 301 | TO BE WRITTEN -->
|
---|
| 302 | <exsl:document href="{$basedir}01-dummy" method="text">
|
---|
| 303 | <xsl:call-template name="header"/>
|
---|
| 304 | <xsl:text>
|
---|
| 305 | PKG_PHASE=dummy
|
---|
| 306 | PACKAGE=dummy
|
---|
| 307 | VERSION=0.0.0
|
---|
| 308 | TARBALL=dummy-0.0.0.tar.bz2
|
---|
[570c9f3] | 309 | </xsl:text>
|
---|
[51e3d23] | 310 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 311 | <xsl:call-template name="unpack"/>
|
---|
| 312 | <xsl:text>
|
---|
[c0f8256] | 313 | cd $PKGDIR
|
---|
| 314 | ./configure --prefix=/usr
|
---|
| 315 | make
|
---|
| 316 | make check
|
---|
| 317 | make install
|
---|
| 318 | </xsl:text>
|
---|
[51e3d23] | 319 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 320 | <xsl:call-template name="clean_sources"/>
|
---|
[c0f8256] | 321 | <xsl:call-template name="footer"/>
|
---|
| 322 | </exsl:document>
|
---|
| 323 | </xsl:template>
|
---|
| 324 |
|
---|
| 325 |
|
---|
[3778352] | 326 | <!-- ######################################################################## -->
|
---|
| 327 |
|
---|
| 328 | <!-- ############################# MATCH TEMPLATES ########################## -->
|
---|
| 329 |
|
---|
| 330 | <!-- Root element -->
|
---|
[0170229] | 331 | <xsl:template match="/">
|
---|
[13b4ab5] | 332 | <!-- Start processing at chapter level -->
|
---|
[3778352] | 333 | <xsl:apply-templates select="//chapter"/>
|
---|
[c0f8256] | 334 | <!-- Process custom tools scripts -->
|
---|
| 335 | <xsl:if test="$custom-tools = 'y'">
|
---|
| 336 | <xsl:call-template name="custom-tools"/>
|
---|
| 337 | </xsl:if>
|
---|
| 338 | <!-- Process blfs-tool scripts -->
|
---|
| 339 | <xsl:if test="$blfs-tool = 'y'">
|
---|
| 340 | <xsl:call-template name="blfs-tool"/>
|
---|
| 341 | </xsl:if>
|
---|
[0170229] | 342 | </xsl:template>
|
---|
| 343 |
|
---|
[3778352] | 344 |
|
---|
| 345 | <!-- chapter -->
|
---|
| 346 | <xsl:template match="chapter">
|
---|
| 347 | <xsl:if test="@id='chapter-temporary-tools' or @id='chapter-building-system'
|
---|
| 348 | or @id='chapter-bootscripts' or @id='chapter-bootable'">
|
---|
| 349 | <!-- The dir name -->
|
---|
| 350 | <xsl:variable name="dirname">
|
---|
| 351 | <xsl:call-template name="dirname"/>
|
---|
| 352 | </xsl:variable>
|
---|
| 353 | <!-- The chapter order position -->
|
---|
| 354 | <xsl:variable name="ch_position" select="position()"/>
|
---|
| 355 | <xsl:variable name="ch_order">
|
---|
[0170229] | 356 | <xsl:choose>
|
---|
[3778352] | 357 | <xsl:when test="string-length($ch_position) = 1">
|
---|
[0170229] | 358 | <xsl:text>0</xsl:text>
|
---|
[3778352] | 359 | <xsl:value-of select="$ch_position"/>
|
---|
[0170229] | 360 | </xsl:when>
|
---|
| 361 | <xsl:otherwise>
|
---|
[3778352] | 362 | <xsl:value-of select="$ch_position"/>
|
---|
[0170229] | 363 | </xsl:otherwise>
|
---|
| 364 | </xsl:choose>
|
---|
| 365 | </xsl:variable>
|
---|
[13b4ab5] | 366 | <!-- Process the childrens -->
|
---|
[3778352] | 367 | <xsl:apply-templates select="sect1">
|
---|
| 368 | <xsl:with-param name="ch_order" select="$ch_order"/>
|
---|
| 369 | <xsl:with-param name="dirname" select="$dirname"/>
|
---|
| 370 | </xsl:apply-templates>
|
---|
| 371 | </xsl:if>
|
---|
| 372 | </xsl:template>
|
---|
| 373 |
|
---|
| 374 |
|
---|
| 375 | <!-- sect1 -->
|
---|
| 376 | <xsl:template match="sect1">
|
---|
| 377 | <!-- Inherited chapter order -->
|
---|
| 378 | <xsl:param name="ch_order" select="foo"/>
|
---|
| 379 | <!-- Inherited dir name -->
|
---|
| 380 | <xsl:param name="dirname" select="foo"/>
|
---|
[e213e4c] | 381 | <!-- Process only files with actual build commands -->
|
---|
[3778352] | 382 | <xsl:if test="count(descendant::screen/userinput) > 0 and
|
---|
| 383 | count(descendant::screen/userinput) >
|
---|
| 384 | count(descendant::screen[@role='nodump'])">
|
---|
| 385 | <!-- Base file name -->
|
---|
| 386 | <xsl:variable name="filename">
|
---|
| 387 | <xsl:call-template name="filename"/>
|
---|
| 388 | </xsl:variable>
|
---|
| 389 | <!-- Sect1 order position -->
|
---|
| 390 | <xsl:variable name="sect1_position" select="position()"/>
|
---|
| 391 | <xsl:variable name="sect1_order">
|
---|
[0170229] | 392 | <xsl:choose>
|
---|
[3778352] | 393 | <xsl:when test="string-length($sect1_position) = 1">
|
---|
| 394 | <xsl:text>0</xsl:text>
|
---|
| 395 | <xsl:value-of select="$sect1_position"/>
|
---|
[0170229] | 396 | </xsl:when>
|
---|
| 397 | <xsl:otherwise>
|
---|
[3778352] | 398 | <xsl:value-of select="$sect1_position"/>
|
---|
[0170229] | 399 | </xsl:otherwise>
|
---|
| 400 | </xsl:choose>
|
---|
[3778352] | 401 | </xsl:variable>
|
---|
| 402 | <!-- Script build order -->
|
---|
[097df00] | 403 | <xsl:variable name="order" select="concat($dirname,'/',$ch_order,'_',$sect1_order)"/>
|
---|
[f5f857d] | 404 | <!-- Must the package test suite, if any, be run? -->
|
---|
| 405 | <xsl:variable name="run_this_test">
|
---|
| 406 | <xsl:call-template name="run_this_test"/>
|
---|
| 407 | </xsl:variable>
|
---|
[097df00] | 408 | <!-- Hock to insert scripts before the current one -->
|
---|
| 409 | <xsl:call-template name="insert_script_before">
|
---|
| 410 | <xsl:with-param name="reference" select="@id"/>
|
---|
| 411 | <xsl:with-param name="order" select="$order"/>
|
---|
| 412 | </xsl:call-template>
|
---|
[3778352] | 413 | <!-- Creating dirs and files -->
|
---|
[097df00] | 414 | <exsl:document href="{$order}-{$filename}" method="text">
|
---|
[3778352] | 415 | <xsl:call-template name="header"/>
|
---|
[13b4ab5] | 416 | <xsl:call-template name="user_header"/>
|
---|
| 417 | <xsl:apply-templates select="sect1info[@condition='script']">
|
---|
| 418 | <xsl:with-param name="phase" select="$filename"/>
|
---|
[f5f857d] | 419 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 420 | <xsl:with-param name="testlogfile" select="concat($ch_order,'_',$sect1_order,'-',$filename)"/>
|
---|
[13b4ab5] | 421 | </xsl:apply-templates>
|
---|
[51e3d23] | 422 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 423 | <xsl:if test="sect2[@role='installation']">
|
---|
| 424 | <xsl:call-template name="unpack"/>
|
---|
| 425 | </xsl:if>
|
---|
[13b4ab5] | 426 | <xsl:call-template name="user_pre_commands"/>
|
---|
[3778352] | 427 | <xsl:call-template name="pre_commands"/>
|
---|
[f5f857d] | 428 | <xsl:apply-templates select=".//screen">
|
---|
| 429 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 430 | </xsl:apply-templates>
|
---|
[3778352] | 431 | <xsl:call-template name="post_commands"/>
|
---|
[13b4ab5] | 432 | <xsl:call-template name="user_footer"/>
|
---|
[51e3d23] | 433 | <xsl:call-template name="disk_usage"/>
|
---|
[570c9f3] | 434 | <xsl:if test="sect2[@role='installation']">
|
---|
| 435 | <xsl:call-template name="clean_sources"/>
|
---|
| 436 | </xsl:if>
|
---|
[3778352] | 437 | <xsl:call-template name="footer"/>
|
---|
[0170229] | 438 | </exsl:document>
|
---|
[097df00] | 439 | <!-- Hock to insert scripts after the current one -->
|
---|
| 440 | <xsl:call-template name="insert_script_after">
|
---|
| 441 | <xsl:with-param name="reference" select="@id"/>
|
---|
| 442 | <xsl:with-param name="order" select="$order"/>
|
---|
| 443 | </xsl:call-template>
|
---|
[0170229] | 444 | </xsl:if>
|
---|
| 445 | </xsl:template>
|
---|
| 446 |
|
---|
[3778352] | 447 |
|
---|
[13b4ab5] | 448 | <!-- sect1info -->
|
---|
| 449 | <xsl:template match="sect1info">
|
---|
[f5f857d] | 450 | <!-- Used to set and initialize the testuite log file -->
|
---|
| 451 | <xsl:param name="testlogfile" select="foo"/>
|
---|
| 452 | <xsl:param name="run_this_test" select="foo"/>
|
---|
[13b4ab5] | 453 | <!-- Build phase (base file name) to be used for PM -->
|
---|
| 454 | <xsl:param name="phase" select="foo"/>
|
---|
| 455 | <xsl:text>
PKG_PHASE=</xsl:text>
|
---|
| 456 | <xsl:value-of select="$phase"/>
|
---|
| 457 | <!-- Package name -->
|
---|
| 458 | <xsl:apply-templates select="productname"/>
|
---|
| 459 | <!-- Package version -->
|
---|
| 460 | <xsl:apply-templates select="productnumber"/>
|
---|
| 461 | <!-- Tarball name -->
|
---|
| 462 | <xsl:apply-templates select="address"/>
|
---|
[f5f857d] | 463 | <xsl:if test="$run_this_test = '1'">
|
---|
| 464 | <xsl:text>
TEST_LOG=</xsl:text>
|
---|
| 465 | <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 466 | <xsl:text>$LFS</xsl:text>
|
---|
| 467 | </xsl:if>
|
---|
| 468 | <xsl:text>/jhalfs/test-logs/</xsl:text>
|
---|
| 469 | <xsl:value-of select="$testlogfile"/>
|
---|
| 470 | <xsl:text>
echo -e "\n`date`\n" > $TEST_LOG</xsl:text>
|
---|
| 471 | </xsl:if>
|
---|
[13b4ab5] | 472 | <xsl:text>

</xsl:text>
|
---|
| 473 | </xsl:template>
|
---|
| 474 |
|
---|
| 475 |
|
---|
| 476 | <!-- productname -->
|
---|
| 477 | <xsl:template match="productname">
|
---|
| 478 | <xsl:text>
PACKAGE=</xsl:text>
|
---|
| 479 | <xsl:apply-templates/>
|
---|
| 480 | </xsl:template>
|
---|
| 481 |
|
---|
| 482 |
|
---|
| 483 | <!-- productnumber -->
|
---|
| 484 | <xsl:template match="productnumber">
|
---|
| 485 | <xsl:text>
VERSION=</xsl:text>
|
---|
| 486 | <xsl:apply-templates/>
|
---|
| 487 | </xsl:template>
|
---|
| 488 |
|
---|
| 489 |
|
---|
| 490 | <!-- address -->
|
---|
| 491 | <xsl:template match="address">
|
---|
| 492 | <xsl:text>
TARBALL=</xsl:text>
|
---|
| 493 | <xsl:call-template name="package_name">
|
---|
| 494 | <xsl:with-param name="url">
|
---|
| 495 | <xsl:apply-templates/>
|
---|
| 496 | </xsl:with-param>
|
---|
| 497 | </xsl:call-template>
|
---|
| 498 | <xsl:apply-templates select="otheraddr" mode="tarball"/>
|
---|
| 499 | </xsl:template>
|
---|
[3778352] | 500 |
|
---|
| 501 |
|
---|
[13b4ab5] | 502 | <!-- otheraddr -->
|
---|
| 503 | <xsl:template match="otheraddr"/>
|
---|
| 504 | <xsl:template match="otheraddr" mode="tarball">
|
---|
| 505 | <xsl:text>
TARBALL_</xsl:text>
|
---|
| 506 | <xsl:value-of select="position()"/>
|
---|
| 507 | <xsl:text>=</xsl:text>
|
---|
| 508 | <xsl:call-template name="package_name">
|
---|
| 509 | <xsl:with-param name="url" select="."/>
|
---|
| 510 | </xsl:call-template>
|
---|
| 511 | </xsl:template>
|
---|
[3778352] | 512 |
|
---|
| 513 |
|
---|
[13b4ab5] | 514 | <!-- screen -->
|
---|
[0170229] | 515 | <xsl:template match="screen">
|
---|
[f5f857d] | 516 | <xsl:param name="run_this_test" select="foo"/>
|
---|
[6db1464] | 517 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
[fa1b640] | 518 | <xsl:call-template name="top_screen_build_fixes"/>
|
---|
[f5f857d] | 519 | <xsl:apply-templates>
|
---|
| 520 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 521 | </xsl:apply-templates>
|
---|
[fa1b640] | 522 | <xsl:call-template name="bottom_screen_build_fixes"/>
|
---|
| 523 | <xsl:text>
</xsl:text>
|
---|
[0170229] | 524 | </xsl:if>
|
---|
| 525 | </xsl:template>
|
---|
| 526 |
|
---|
[13b4ab5] | 527 |
|
---|
[f5f857d] | 528 | <!-- userinput @remap='test' -->
|
---|
| 529 | <xsl:template match="userinput[@remap='test']">
|
---|
| 530 | <xsl:param name="run_this_test" select="foo"/>
|
---|
| 531 | <xsl:apply-templates select="." mode="test">
|
---|
| 532 | <xsl:with-param name="run_this_test" select="$run_this_test"/>
|
---|
| 533 | </xsl:apply-templates>
|
---|
| 534 | </xsl:template>
|
---|
| 535 |
|
---|
| 536 |
|
---|
[e213e4c] | 537 | <!-- replaceable -->
|
---|
| 538 | <xsl:template match="replaceable">
|
---|
| 539 | <xsl:choose>
|
---|
| 540 | <!-- Configuring the Time Zone -->
|
---|
| 541 | <xsl:when test="ancestor::sect2[@id='conf-glibc'] and string()='<xxx>'">
|
---|
| 542 | <xsl:value-of select="$timezone"/>
|
---|
| 543 | </xsl:when>
|
---|
| 544 | <!-- Set paper size for Groff build -->
|
---|
| 545 | <xsl:when test="string()='<paper_size>'">
|
---|
| 546 | <xsl:value-of select="$page"/>
|
---|
| 547 | </xsl:when>
|
---|
| 548 | <!-- LANG setting in /etc/profile -->
|
---|
| 549 | <xsl:when test="contains(string(),'<ll>_<CC>')">
|
---|
| 550 | <xsl:value-of select="$lang"/>
|
---|
| 551 | </xsl:when>
|
---|
| 552 | <xsl:otherwise>
|
---|
| 553 | <xsl:text>**EDITME</xsl:text>
|
---|
| 554 | <xsl:apply-templates/>
|
---|
| 555 | <xsl:text>EDITME**</xsl:text>
|
---|
| 556 | </xsl:otherwise>
|
---|
| 557 | </xsl:choose>
|
---|
| 558 | </xsl:template>
|
---|
| 559 |
|
---|
| 560 |
|
---|
| 561 | <!-- ######################################################################## -->
|
---|
| 562 |
|
---|
| 563 | <!-- ############################# MODE TEMPLATES ########################### -->
|
---|
| 564 |
|
---|
| 565 |
|
---|
| 566 | <!-- mode test -->
|
---|
| 567 | <xsl:template match="userinput" mode="test">
|
---|
[f5f857d] | 568 | <xsl:param name="run_this_test" select="foo"/>
|
---|
| 569 | <xsl:if test="$run_this_test = '1'">
|
---|
| 570 | <xsl:choose>
|
---|
| 571 | <!-- Final system Glibc -->
|
---|
| 572 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 573 | <xsl:value-of select="substring-before(string(),'2>&1')"/>
|
---|
| 574 | <xsl:text>>> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 575 | </xsl:when>
|
---|
| 576 | <!-- Module-Init-Tools -->
|
---|
| 577 | <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
|
---|
| 578 | and contains(string(),'make check')">
|
---|
| 579 | <xsl:value-of select="substring-before(string(),' check')"/>
|
---|
| 580 | <xsl:if test="$bomb-testsuite = 'n'">
|
---|
| 581 | <xsl:text> -k</xsl:text>
|
---|
| 582 | </xsl:if>
|
---|
| 583 | <xsl:text> check >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 584 | <xsl:if test="$bomb-testsuite = 'n'">
|
---|
| 585 | <xsl:text> || true</xsl:text>
|
---|
| 586 | </xsl:if>
|
---|
| 587 | <xsl:value-of select="substring-after(string(),' check')"/>
|
---|
| 588 | </xsl:when>
|
---|
| 589 | <!-- If the book uses -k, the testsuite should never bomb -->
|
---|
| 590 | <xsl:when test="contains(string(),'make -k ')">
|
---|
| 591 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 592 | <xsl:text> >> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 593 | </xsl:when>
|
---|
| 594 | <!-- Extra commands in Binutils and GCC -->
|
---|
| 595 | <xsl:when test="contains(string(),'test_summary') or
|
---|
| 596 | contains(string(),'expect -c')">
|
---|
| 597 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 598 | <xsl:text> >> $TEST_LOG</xsl:text>
|
---|
| 599 | </xsl:when>
|
---|
| 600 | <!-- Remaining extra testsuite commads that don't need be hacked -->
|
---|
| 601 | <xsl:when test="not(contains(string(),'make '))">
|
---|
| 602 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 603 | </xsl:when>
|
---|
| 604 | <!-- Normal testsites run -->
|
---|
| 605 | <xsl:otherwise>
|
---|
| 606 | <xsl:choose>
|
---|
| 607 | <!-- No bomb on failures -->
|
---|
| 608 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
| 609 | <xsl:value-of select="substring-before(string(),'make ')"/>
|
---|
| 610 | <xsl:text>make -k </xsl:text>
|
---|
| 611 | <xsl:value-of select="substring-after(string(),'make ')"/>
|
---|
| 612 | <xsl:text> >> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 613 | </xsl:when>
|
---|
| 614 | <!-- Bomb at the first failure -->
|
---|
| 615 | <xsl:otherwise>
|
---|
| 616 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 617 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 618 | </xsl:otherwise>
|
---|
| 619 | </xsl:choose>
|
---|
| 620 | </xsl:otherwise>
|
---|
| 621 | </xsl:choose>
|
---|
| 622 | </xsl:if>
|
---|
[0170229] | 623 | </xsl:template>
|
---|
| 624 |
|
---|
| 625 | </xsl:stylesheet>
|
---|