Changeset e676ffa


Ignore:
Timestamp:
03/22/2006 10:52:32 PM (19 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
fcaf131
Parents:
ebba33f
Message:

Added specific CLFS XSL file.
At this momment the CLFS system build may be broken.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CLFS/clfs.xsl

    rebba33f re676ffa  
    11<?xml version="1.0"?>
     2<!DOCTYPE xsl:stylesheet [
     3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
     4  %general-entities;
     5]>
     6
     7<!-- $Id$ -->
     8
    29<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    310    xmlns:exsl="http://exslt.org/common"
     
    512    version="1.0">
    613
    7 <!-- XSLT stylesheet to extract commands from [B,H]LFS books. -->
     14<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
     15
     16  <!-- Build method used -->
     17  <xsl:param name="method" select="chroot"/>
     18
     19  <!-- Compile the keymap into the kernel? -->
     20  <xsl:param name="keymap" select="none"/>
     21
     22  <!-- Run test suites?
     23       0 = none
     24       1 = only Glibc, GCC and Binutils testsuites
     25       2 = all testsuites
     26       3 = alias to 2 -->
     27  <xsl:param name="testsuite" select="1"/>
     28
     29  <!-- Install vim-lang package? -->
     30  <xsl:param name="vim-lang" select="1"/>
     31
     32  <!-- Time zone -->
     33  <xsl:param name="timezone" select="America/Toronto"/>
     34
     35  <!-- Page size -->
     36  <xsl:param name="page" select="letter"/>
     37
     38  <!-- Locale settings -->
     39  <xsl:param name="lang" select="en_CA"/>
    840
    941  <xsl:template match="/">
     
    1244
    1345  <xsl:template match="sect1">
    14       <!-- The dirs names -->
    15     <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
    16     <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
    17     <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
    18     <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
    19       <!-- The file names -->
    20     <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
    21     <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
    22     <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
    23       <!-- The build order -->
    24     <xsl:variable name="position" select="position()"/>
    25     <xsl:variable name="order">
    26       <xsl:choose>
    27         <xsl:when test="string-length($position) = 1">
    28           <xsl:text>00</xsl:text>
    29           <xsl:value-of select="$position"/>
    30         </xsl:when>
    31         <xsl:when test="string-length($position) = 2">
    32           <xsl:text>0</xsl:text>
    33           <xsl:value-of select="$position"/>
    34         </xsl:when>
    35         <xsl:otherwise>
    36           <xsl:value-of select="$position"/>
    37         </xsl:otherwise>
    38       </xsl:choose>
    39     </xsl:variable>
    40       <!-- Creating dirs and files -->
    41     <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
    42       <xsl:apply-templates select=".//screen"/>
    43     </exsl:document>
     46    <xsl:choose>
     47      <xsl:when test="../@id='chapter-partitioning' or
     48                      ../@id='chapter-getting-materials' or
     49                      ../@id='chapter-final-preps'"/>
     50      <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
     51      <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
     52      <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
     53      <xsl:otherwise>
     54        <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
     55                      count(descendant::screen/userinput) &gt;
     56                      count(descendant::screen[@role='nodump'])">
     57            <!-- The dirs names -->
     58          <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
     59          <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
     60          <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
     61          <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
     62            <!-- The file names -->
     63          <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
     64          <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
     65          <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
     66            <!-- The build order -->
     67          <xsl:variable name="position" select="position()"/>
     68          <xsl:variable name="order">
     69            <xsl:choose>
     70              <xsl:when test="string-length($position) = 1">
     71                <xsl:text>00</xsl:text>
     72                <xsl:value-of select="$position"/>
     73              </xsl:when>
     74              <xsl:when test="string-length($position) = 2">
     75                <xsl:text>0</xsl:text>
     76                <xsl:value-of select="$position"/>
     77              </xsl:when>
     78              <xsl:otherwise>
     79                <xsl:value-of select="$position"/>
     80              </xsl:otherwise>
     81            </xsl:choose>
     82          </xsl:variable>
     83            <!-- Creating dirs and files -->
     84          <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
     85            <xsl:choose>
     86              <xsl:when test="../@id='chapter-chroot'">
     87                <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
     88              </xsl:when>
     89              <xsl:when test="@id='ch-system-stripping'">
     90                <xsl:text>#!/bin/sh&#xA;</xsl:text>
     91              </xsl:when>
     92              <xsl:otherwise>
     93                <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
     94              </xsl:otherwise>
     95            </xsl:choose>
     96            <xsl:if test="sect2[@role='installation']">
     97              <xsl:text>cd $PKGDIR&#xA;</xsl:text>
     98              <xsl:if test="@id='ch-system-vim' and $vim-lang = '1'">
     99                <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
     100              </xsl:if>
     101            </xsl:if>
     102            <xsl:apply-templates select=".//para/userinput | .//screen"/>
     103            <xsl:text>exit</xsl:text>
     104          </exsl:document>
     105        </xsl:if>
     106      </xsl:otherwise>
     107    </xsl:choose>
    44108  </xsl:template>
    45109
    46110  <xsl:template match="screen">
    47     <xsl:if test="child::* = userinput">
    48       <xsl:choose>
    49         <xsl:when test="@role = 'nodump'"/>
    50         <xsl:when test="@role = 'root'">
    51           <xsl:text>&#xA;</xsl:text>
    52           <xsl:text># Run this as root</xsl:text>
    53           <xsl:apply-templates select="userinput"/>
    54           <xsl:text># End root commands</xsl:text>
    55           <xsl:text>&#xA;</xsl:text>
    56         </xsl:when>
    57         <xsl:otherwise>
    58           <xsl:apply-templates select="userinput"/>
    59         </xsl:otherwise>
    60       </xsl:choose>
     111    <xsl:if test="child::* = userinput and not(@role = 'nodump')">
     112      <xsl:apply-templates select="userinput" mode="screen"/>
    61113    </xsl:if>
    62114  </xsl:template>
    63115
    64   <xsl:template match="userinput">
    65     <xsl:text>&#xA;</xsl:text>
    66     <xsl:if test=".//replaceable">
    67       <xsl:text># This block must be edited to suit your needs.</xsl:text>
     116  <xsl:template match="para/userinput">
     117    <xsl:if test="(contains(string(),'test') or
     118            contains(string(),'check')) and
     119            ($testsuite = '2' or $testsuite = '3')">
     120      <xsl:value-of select="substring-before(string(),'make')"/>
     121      <xsl:text>make -k</xsl:text>
     122      <xsl:value-of select="substring-after(string(),'make')"/>
     123      <xsl:text> || true&#xA;</xsl:text>
    68124    </xsl:if>
    69     <xsl:text>&#xA;</xsl:text>
    70     <xsl:apply-templates/>
    71     <xsl:text>&#xA;</xsl:text>
    72     <xsl:if test=".//replaceable">
    73       <xsl:text># End of editable block.</xsl:text>
    74     </xsl:if>
    75     <xsl:text>&#xA;</xsl:text>
     125  </xsl:template>
     126
     127  <xsl:template match="userinput" mode="screen">
     128    <xsl:choose>
     129      <!-- Estandarized package formats -->
     130      <xsl:when test="contains(string(),'tar.gz')">
     131        <xsl:value-of select="substring-before(string(),'tar.gz')"/>
     132        <xsl:text>tar.*</xsl:text>
     133        <xsl:value-of select="substring-after(string(),'tar.gz')"/>
     134        <xsl:text>&#xA;</xsl:text>
     135      </xsl:when>
     136      <!-- Avoiding a race condition in a patch -->
     137      <xsl:when test="contains(string(),'debian_fixes')">
     138        <xsl:value-of select="substring-before(string(),'patch')"/>
     139        <xsl:text>patch -Z</xsl:text>
     140        <xsl:value-of select="substring-after(string(),'patch')"/>
     141        <xsl:text>&#xA;</xsl:text>
     142      </xsl:when>
     143      <!-- Setting $LANG for /etc/profile -->
     144      <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
     145                contains(string(),'export LANG=')">
     146        <xsl:value-of select="substring-before(string(),'export LANG=')"/>
     147        <xsl:text>export LANG=</xsl:text>
     148        <xsl:value-of select="$lang"/>
     149        <xsl:value-of select="substring-after(string(),'modifiers]')"/>
     150        <xsl:text>&#xA;</xsl:text>
     151      </xsl:when>
     152      <!-- Compile the keymap into the kernel? -->
     153      <xsl:when test="contains(string(),'defkeymap') and
     154                $keymap = 'none'"/>
     155      <!-- Copying the kernel config file -->
     156      <xsl:when test="string() = 'make mrproper'">
     157        <xsl:text>make mrproper&#xA;</xsl:text>
     158        <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
     159          <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
     160        </xsl:if>
     161        <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
     162          <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
     163        </xsl:if>
     164      </xsl:when>
     165      <!-- The Coreutils and Module-Init-Tools test suites are optional -->
     166      <xsl:when test="($testsuite = '0' or $testsuite = '1') and
     167                (ancestor::sect1[@id='ch-system-coreutils'] or
     168                ancestor::sect1[@id='ch-system-module-init-tools']) and
     169                (contains(string(),'check') or
     170                contains(string(),'dummy'))"/>
     171      <!-- Fixing toolchain test suites run -->
     172      <xsl:when test="string() = 'make check' or
     173                string() = 'make -k check'">
     174        <xsl:choose>
     175          <xsl:when test="$testsuite != '0'">
     176            <xsl:text>make -k check || true&#xA;</xsl:text>
     177          </xsl:when>
     178        </xsl:choose>
     179      </xsl:when>
     180      <xsl:when test="contains(string(),'glibc-check-log')">
     181        <xsl:choose>
     182          <xsl:when test="$testsuite != '0'">
     183            <xsl:value-of select="substring-before(string(),';')"/>
     184            <xsl:text> || true&#xA;</xsl:text>
     185            <xsl:value-of select="substring-after(string(),';')"/>
     186            <xsl:text>&#xA;</xsl:text>
     187          </xsl:when>
     188        </xsl:choose>
     189      </xsl:when>
     190      <xsl:when test="contains(string(),'test_summary') or
     191                contains(string(),'expect -c')">
     192        <xsl:choose>
     193          <xsl:when test="$testsuite != '0'">
     194            <xsl:apply-templates/>
     195            <xsl:text>&#xA;</xsl:text>
     196          </xsl:when>
     197        </xsl:choose>
     198      </xsl:when>
     199      <!-- Don't stop on strip run -->
     200      <xsl:when test="contains(string(),'strip ')">
     201        <xsl:apply-templates/>
     202        <xsl:text> || true&#xA;</xsl:text>
     203      </xsl:when>
     204      <!-- The rest of commands -->
     205      <xsl:otherwise>
     206        <xsl:apply-templates/>
     207        <xsl:text>&#xA;</xsl:text>
     208      </xsl:otherwise>
     209    </xsl:choose>
    76210  </xsl:template>
    77211
    78212  <xsl:template match="replaceable">
    79     <xsl:text>**EDITME</xsl:text>
    80     <xsl:apply-templates/>
    81     <xsl:text>EDITME**</xsl:text>
     213    <xsl:choose>
     214      <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
     215        <xsl:value-of select="$timezone"/>
     216      </xsl:when>
     217      <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
     218        <xsl:value-of select="$page"/>
     219      </xsl:when>
     220      <xsl:otherwise>
     221        <xsl:text>**EDITME</xsl:text>
     222        <xsl:apply-templates/>
     223        <xsl:text>EDITME**</xsl:text>
     224      </xsl:otherwise>
     225    </xsl:choose>
    82226  </xsl:template>
    83227
  • CLFS/master.sh

    rebba33f re676ffa  
    10711071
    10721072  # Add chroot commands
    1073   i=1
    1074   for file in chroot/*chroot* ; do
    1075     chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
     1073  if [ "$METHOD" = "chroot" ] ; then
     1074    chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
    10761075                            -e '/^export/d' \
    10771076                            -e '/^logout/d' \
     
    10821081                                                                -e 's|"$$LFS"|$(MOUNT_PT)|'\
    10831082                                                                -e 's|set -e||'`
    1084     echo -e "CHROOT$i= $chroot\n" >> $MKFILE
    1085     i=`expr $i + 1`
    1086   done
     1083    echo -e "CHROOT1= $chroot\n" >> $MKFILE
     1084  fi
    10871085
    10881086  # Drop in the main target 'all:' and the chapter targets with each sub-target
  • common/common-functions

    rebba33f re676ffa  
    621621    clfs)
    622622        echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
    623         xsltproc --xinclude \
    624                  --nonet \
     623        xsltproc --nonet \
     624                 --xinclude \
     625                 --stringparam method $METHOD \
     626                 --stringparam testsuite $TEST \
     627                 --stringparam vim-lang $VIMLANG \
     628                 --stringparam timezone $TIMEZONE \
     629                 --stringparam page $PAGE \
     630                 --stringparam lang $LANG \
     631                 --stringparam keymap $KEYMAP \
    625632                 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
    626633      ;;
Note: See TracChangeset for help on using the changeset viewer.