Changeset 174a8e9 for HLFS


Ignore:
Timestamp:
03/16/2006 09:26:27 PM (19 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
5365c39
Parents:
57ca090
Message:

First revision of hlfs.xsl.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • HLFS/hlfs.xsl

    r57ca090 r174a8e9  
    55]>
    66
     7<!-- $Id$ -->
     8
    79<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    810    xmlns:exsl="http://exslt.org/common"
     
    1012    version="1.0">
    1113
    12 <!-- XSLT stylesheet to create shell scripts from LFS books. -->
    13 
    14   <!-- Run optional test suites? -->
    15   <xsl:param name="testsuite" select="0"/>
    16 
    17   <!-- Run toolchain test suites? -->
    18   <xsl:param name="toolchaintest" select="1"/>
     14<!-- XSLT stylesheet to create shell scripts from HLFS books. -->
     15
     16  <!-- What libc implentation must be used? -->
     17  <xsl:param name="model" select="glibc"/>
     18
     19  <!-- Run test suites?
     20       0 = none
     21       1 = only chapter06 Glibc, GCC and Binutils testsuites
     22       2 = all chapter06 testsuites
     23       3 = all chapter05 and chapter06 testsuites-->
     24  <xsl:param name="testsuite" select="1"/>
    1925
    2026  <!-- Install vim-lang package? -->
     
    2632
    2733  <xsl:template match="sect1">
    28     <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
    29       count(descendant::screen/userinput) &gt; count(descendant::screen[@role='nodump'])">
     34    <xsl:if test="(../@id='chapter-temporary-tools' or
     35                  ../@id='chapter-building-system' or
     36                  ../@id='chapter-bootable') and
     37                  ((@condition=$model or not(@condition)) and
     38                  count(descendant::screen/userinput) &gt; 0 and
     39                  count(descendant::screen/userinput) &gt;
     40                  count(descendant::screen[@role='nodump']))">
    3041        <!-- The dirs names -->
    3142      <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
     
    5465        </xsl:choose>
    5566      </xsl:variable>
    56          
    5767        <!-- Creating dirs and files -->
    5868      <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
    59                 <!-- Add a header to each script -->
    6069        <xsl:choose>
    6170          <xsl:when test="@id='ch-system-changingowner' or
    62                           @id='ch-system-creatingdirs' or
    63                           @id='ch-system-createfiles'">
     71                    @id='ch-system-creatingdirs' or
     72                    @id='ch-system-createfiles'">
    6473            <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
    6574          </xsl:when>
    66 
    6775          <xsl:when test="@id='ch-tools-stripping' or
    68                           @id='ch-system-strippingagain'">
     76                    @id='ch-system-strippingagain'">
    6977            <xsl:text>#!/bin/sh&#xA;</xsl:text>
    7078          </xsl:when>
    71 
    7279          <xsl:otherwise>
    7380            <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
    7481          </xsl:otherwise>
    7582        </xsl:choose>
    76  
    7783        <xsl:if test="sect2[@role='installation'] or
    7884                     @id='ch-tools-adjusting' or
     
    8288            <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
    8389          </xsl:if>
    84           <xsl:if test="@id='ch-tools-uclibc'">
     90          <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
    8591             <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
    8692          </xsl:if>
    87           <xsl:if test="@id='ch-system-uclibc'">
    88              <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
    89           </xsl:if>
    90           <xsl:if test="@id='ch-system-glibc'">
     93          <xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
    9194             <xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*&#xA;</xsl:text>
    9295          </xsl:if>
    93           <xsl:if test="@id='ch-tools-glibc'">
    94              <xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*&#xA;</xsl:text>
    95           </xsl:if>
    96           <xsl:if test="@id='ch-system-gcc'">
     96          <xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
    9797             <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; &#xA;</xsl:text>
    9898          </xsl:if>
    99           <xsl:if test="@id='ch-tools-gcc'">
    100              <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; &#xA;</xsl:text>
     99          <xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
     100            <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
     101          </xsl:if>
     102          <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
     103            <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
    101104          </xsl:if>
    102105          <xsl:if test="@id='bootable-bootscripts'">
     
    111114
    112115  <xsl:template match="screen">
    113     <xsl:if test="child::* = userinput">
    114       <xsl:choose>
    115         <xsl:when test="@role = 'nodump'"/>
    116         <xsl:when test="@condition != $model"/>
    117         <xsl:otherwise>
    118           <xsl:apply-templates select="userinput" mode="screen"/>
    119         </xsl:otherwise>
    120       </xsl:choose>
     116    <xsl:if test="(@condition=$model or not(@condition)) and
     117                  child::* = userinput and not(@role = 'nodump')">
     118      <xsl:apply-templates select="userinput" mode="screen"/>
    121119    </xsl:if>
    122120  </xsl:template>
    123121
    124122  <xsl:template match="para/userinput">
    125     <xsl:if test="$testsuite != '0' and
    126             (contains(string(),'test') or contains(string(),'check'))">
     123    <xsl:if test="(contains(string(),'test') or
     124            contains(string(),'check')) and
     125            (($testsuite = '1' and
     126            (ancestor::sect1[@id='ch-system-gcc'] or
     127            ancestor::sect1[@id='ch-system-glibc'])) or
     128            ($testsuite = '2' and
     129            ancestor::chapter[@id='chapter-building-system']) or
     130            $testsuite = '3')">
    127131      <xsl:value-of select="substring-before(string(),'make')"/>
    128132      <xsl:text>make -k</xsl:text>
     
    148152        <xsl:text>&#xA;</xsl:text>
    149153      </xsl:when>
    150 
     154      <!-- Setting $LC_ALL and $LANG for /etc/profile -->
     155      <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
     156                contains(string(),'export LANG=')">
     157        <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
     158        <xsl:text>export LC_ALL=$LC_ALL&#xA;export LANG=$LANG&#xA;</xsl:text>
     159        <xsl:text>export INPUTRC</xsl:text>
     160        <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
     161        <xsl:text>&#xA;</xsl:text>
     162      </xsl:when>
    151163      <!-- Copying the kernel config file -->
    152164      <xsl:when test="string() = 'make mrproper'">
     
    154166        <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
    155167      </xsl:when>
    156 
    157168      <!-- The Coreutils and Module-Init-Tools test suites are optional -->
    158       <xsl:when test="$testsuite = '0' and
     169      <xsl:when test="($testsuite = '0' or $testsuite = '1') and
    159170                (ancestor::sect1[@id='ch-system-coreutils'] or
    160                  ancestor::sect1[@id='ch-system-module-init-tools']) and
     171                ancestor::sect1[@id='ch-system-module-init-tools']) and
    161172                (contains(string(),'check') or
    162                  contains(string(),'dummy'))"/>
    163 
     173                contains(string(),'distclean') or
     174                contains(string(),'dummy'))"/>
    164175      <!-- Fixing toolchain test suites run -->
    165176      <xsl:when test="string() = 'make check' or
    166                       string() = 'make -k check'">
    167         <xsl:choose>
    168           <xsl:when test="$toolchaintest = '0'"/>
    169           <xsl:otherwise>
     177                string() = 'make -k check'">
     178        <xsl:choose>
     179          <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
     180                    ancestor::chapter[@id='chapter-building-system']) or
     181                    $testsuite = '3'">
    170182            <xsl:text>make -k check || true</xsl:text>
    171183            <xsl:text>&#xA;</xsl:text>
    172           </xsl:otherwise>
    173         </xsl:choose>
    174       </xsl:when>
    175       <xsl:when test="contains(string(),'glibc-check-log')">
    176         <xsl:choose>
    177           <xsl:when test="$toolchaintest = '0'"/>
    178           <xsl:otherwise>
    179             <xsl:value-of select="substring-before(string(),'&#xA;')"/>
    180             <xsl:text> || true&#xA;</xsl:text>
    181             <xsl:value-of select="substring-after(string(),'&#xA;')"/>
    182             <xsl:text>&#xA;</xsl:text>
    183           </xsl:otherwise>
    184         </xsl:choose>
    185       </xsl:when>
    186       <xsl:when test="contains(string(),'test_summary') or
    187                       contains(string(),'expect -c')">
    188         <xsl:choose>
    189           <xsl:when test="$toolchaintest = '0'"/>
    190           <xsl:otherwise>
    191             <xsl:apply-templates/>
    192             <xsl:text>&#xA;</xsl:text>
    193           </xsl:otherwise>
     184          </xsl:when>
     185        </xsl:choose>
     186      </xsl:when>
     187      <xsl:when test="contains(string(),'make check') and
     188                ancestor::sect1[@id='ch-system-binutils']">
     189        <xsl:choose>
     190          <xsl:when test="$testsuite != '0'">
     191            <xsl:value-of select="substring-before(string(),'make check')"/>
     192            <xsl:text>make -k check || true&#xA;</xsl:text>
     193          </xsl:when>
    194194        </xsl:choose>
    195195      </xsl:when>
     
    207207  </xsl:template>
    208208
    209 <!-- Deal with definable values defined inside <replaceable> -->
    210209  <xsl:template match="replaceable">
    211210    <xsl:choose>
    212       <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
    213         <xsl:text>$TIMEZONE</xsl:text>
    214       </xsl:when>
    215       <xsl:when test="ancestor::sect1[@id='ch-system-uclibc']">
     211      <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
     212                      ancestor::sect1[@id='ch-system-uclibc']">
    216213        <xsl:text>$TIMEZONE</xsl:text>
    217214      </xsl:when>
     
    228225
    229226</xsl:stylesheet>
    230 
Note: See TracChangeset for help on using the changeset viewer.