Changeset 7072e1f for LFS/lfs.xsl


Ignore:
Timestamp:
02/01/2012 11:29:37 PM (13 years ago)
Author:
Thomas Pegg <thomasp@…>
Branches:
2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
2c9a16b
Parents:
f5dc6d7
Message:

Commit Pierre Labastie's patch for including package management support in jhalfs. NOTE: Package management is by default disabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    rf5dc6d7 r7072e1f  
    1 <?xml version="1.0"?>
    2 <!DOCTYPE xsl:stylesheet [
    3  <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
    4   %general-entities;
    5 ]>
     1<?xml version="1.0" encoding="ISO-8859-1"?>
    62
    73<!-- $Id$ -->
    84
    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 LFS books. -->
    15 
     5<xsl:stylesheet
     6      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     7      xmlns:exsl="http://exslt.org/common"
     8      extension-element-prefixes="exsl"
     9      version="1.0">
     10
     11  <!-- use package management ?
     12       n = no, original behavior
     13       y = yes, add PKG_DEST to scripts in install commands of chapter06-08
     14  -->
     15  <xsl:param name="pkgmngt" select="n"/>
     16 
    1617  <!-- Run test suites?
    1718       0 = none
     
    2829  <xsl:param name="bomb-testsuite" select="n"/>
    2930
    30   <!-- Install vim-lang package? -->
    31   <xsl:param name="vim-lang" select="y"/>
    32 
     31  <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
     32  <xsl:param name="vim-lang" select="n"/>
     33 
    3334  <!-- Time zone -->
    3435  <xsl:param name="timezone" select="GMT"/>
    35 
     36 
    3637  <!-- Page size -->
    3738  <xsl:param name="page" select="letter"/>
    38 
     39 
    3940  <!-- Locale settings -->
    4041  <xsl:param name="lang" select="C"/>
    41 
     42 
    4243  <xsl:template match="/">
    4344    <xsl:apply-templates select="//sect1"/>
    4445  </xsl:template>
    45 
     46 
    4647  <xsl:template match="sect1">
    47     <xsl:if test="(../@id='chapter-temporary-tools' or
     48        <xsl:if test="(../@id='chapter-temporary-tools' or
    4849                  ../@id='chapter-building-system' or
    4950                  ../@id='chapter-bootscripts' or
     
    5152                  count(descendant::screen/userinput) &gt; 0 and
    5253                  count(descendant::screen/userinput) &gt;
    53                   count(descendant::screen[@role='nodump'])">
     54                      count(descendant::screen[@role='nodump'])">
    5455        <!-- The dirs names -->
    5556      <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
     
    5758      <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
    5859      <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">
    82         <xsl:choose>
    83           <xsl:when test="@id='ch-system-creatingdirs' or
    84                     @id='ch-system-createfiles' or
    85                     @id='ch-system-strippingagain'">
    86             <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
    87           </xsl:when>
    88           <xsl:otherwise>
    89             <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
    90           </xsl:otherwise>
    91         </xsl:choose>
    92         <xsl:if test="not(@id='ch-tools-stripping') and
    93                       not(@id='ch-system-strippingagain')">
    94           <xsl:text>set -e&#xA;</xsl:text>
     60   <!-- The file names -->
     61    <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
     62    <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
     63    <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
     64    <!-- The build order -->
     65    <xsl:variable name="position" select="position()"/>
     66    <xsl:variable name="order">
     67      <xsl:choose>
     68        <xsl:when test="string-length($position) = 1">
     69          <xsl:text>00</xsl:text>
     70          <xsl:value-of select="$position"/>
     71        </xsl:when>
     72        <xsl:when test="string-length($position) = 2">
     73          <xsl:text>0</xsl:text>
     74          <xsl:value-of select="$position"/>
     75        </xsl:when>
     76        <xsl:otherwise>
     77          <xsl:value-of select="$position"/>
     78        </xsl:otherwise>
     79      </xsl:choose>
     80    </xsl:variable>
     81    <!-- Inclusion of package manager scriptlets -->
     82    <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
     83      <xsl:apply-templates
     84              select="document('packageManager.xml')//sect1[@id='ch-tools-pkgmngt']"
     85              mode="pkgmngt">
     86        <xsl:with-param name="order" select="concat($order,'-1')"/>
     87        <xsl:with-param name="dirname" select="$dirname"/>
     88      </xsl:apply-templates>
     89    </xsl:if>
     90    <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
     91      <xsl:apply-templates
     92              select="document('packageManager.xml')//sect1[@id='ch-system-pkgmngt']"
     93              mode="pkgmngt">
     94        <xsl:with-param name="order" select="concat($order,'-1')"/>
     95        <xsl:with-param name="dirname" select="$dirname"/>
     96      </xsl:apply-templates>
     97    </xsl:if>
     98    <!-- Creating dirs and files -->
     99    <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
     100      <xsl:choose>
     101        <xsl:when test="@id='ch-system-creatingdirs' or
     102                        @id='ch-system-createfiles' or
     103                        @id='ch-system-strippingagain'">
     104          <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
     105        </xsl:when>
     106        <xsl:otherwise>
     107          <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
     108        </xsl:otherwise>
     109      </xsl:choose>
     110      <xsl:if test="not(@id='ch-tools-stripping') and
     111                    not(@id='ch-system-strippingagain')">
     112        <xsl:text>set -e&#xA;</xsl:text>
     113      </xsl:if>
     114      <xsl:text>&#xA;</xsl:text>
     115      <xsl:if test="sect2[@role='installation']">
     116        <xsl:text>cd $PKGDIR&#xA;</xsl:text>
     117      </xsl:if>
     118      <xsl:apply-templates
     119        select=".//screen[not(@role) or
     120                          @role != 'nodump']/userinput[
     121                               @remap = 'pre' or
     122                               @remap = 'configure' or
     123                               @remap = 'make' or
     124                               @remap = 'test' and
     125                                not(current()/@id='ch-tools-dejagnu')]"/>
     126      <xsl:if
     127           test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
     128                 $pkgmngt = 'y' and
     129                 descendant::screen[not(@role) or
     130                                    @role != 'nodump']/userinput[
     131                                                      @remap='install']">
     132        <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
     133mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
     134mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
     135mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
     136ln -sv share/{man,doc,info} $PKG_DEST/usr
     137case $(uname -m) in
     138 x86_64) ln -sv lib $PKG_DEST/lib64 &amp;&amp; ln -sv lib $PKG_DEST/usr/lib64 ;;
     139esac
     140</xsl:text>
     141      </xsl:if>
     142      <xsl:if test="@id = 'ch-system-glibc' and
     143                            $pkgmngt = 'y'">
     144        <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
     145</xsl:text>
     146      </xsl:if>
     147      <xsl:apply-templates
     148           select=".//screen[not(@role) or
     149                             @role != 'nodump']/userinput[@remap = 'install']"/>
     150      <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
     151                    $pkgmngt = 'y' and
     152                    descendant::screen[not(@role) or
     153                                       @role != 'nodump']/userinput[
     154                                                         @remap='install']">
     155        <xsl:if test="@id = 'ch-system-man-pages'">
     156<!-- those files are provided by the shadow package -->
     157  <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
     158</xsl:text>
    95159        </xsl:if>
     160        <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
     161rm -fv $PKG_DEST/usr/{man,doc,info}
     162for dir in $PKG_DEST/usr/share/man/man{1..8}; do
     163  [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
     164done
     165for dir in $PKG_DEST/usr/share/{doc,info,man}; do
     166  [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
     167done
     168for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
     169  [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
     170done
     171for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
     172  [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
     173done
     174packInstall
     175rm -rf $PKG_DEST
     176</xsl:text>
     177      </xsl:if>
     178      <xsl:if test="$testsuite='3' and @id='ch-tools-glibc' or @id='ch-system-glibc'">
     179        <xsl:copy-of select="//userinput[@remap='locale-test']"/>
    96180        <xsl:text>&#xA;</xsl:text>
    97         <xsl:if test="sect2[@role='installation']">
    98           <xsl:text>cd $PKGDIR&#xA;</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&#xA;</xsl:text>
    101           </xsl:if>
    102         </xsl:if>
    103         <xsl:apply-templates select=".//screen"/>
    104         <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
    105           <xsl:copy-of select="//userinput[@remap='locale-test']"/>
    106           <xsl:text>&#xA;</xsl:text>
    107         </xsl:if>
    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"&#xA;</xsl:text>
    111         </xsl:if>
    112         <xsl:text>exit&#xA;</xsl:text>
    113       </exsl:document>
     181      </xsl:if>
     182      <xsl:apply-templates
     183         select=".//screen[
     184                   not(@role) or
     185                   @role != 'nodump'
     186                          ]/userinput[
     187                            not(@remap) or
     188                            @remap='adjust' or
     189                            @remap='test' and current()/@id='ch-tools-dejagnu'
     190                                     ]"/>
     191      <xsl:if test="@id='ch-system-creatingdirs'">
     192        <xsl:apply-templates
     193           select="document('packageManager.xml')//sect1[
     194                                       @id='ch-system-pkgmngt-creatingdirs'
     195                                                        ]//userinput"/>
     196      </xsl:if>
     197      <xsl:if test="@id='ch-system-createfiles'">
     198        <xsl:apply-templates
     199           select="document('packageManager.xml')//sect1[
     200                                       @id='ch-system-pkgmngt-createfiles'
     201                                                        ]//userinput"/>
     202      </xsl:if>
     203      <xsl:if test="not(@id='ch-system-chroot') and
     204                    not(@id='ch-system-revisedchroot')">
     205        <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
     206      </xsl:if>
     207      <xsl:text>exit&#xA;</xsl:text>
     208    </exsl:document>
    114209    </xsl:if>
    115210  </xsl:template>
    116211
    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="userinput" mode="screen">
     212<xsl:template match="sect1" mode="pkgmngt">
     213    <xsl:param name="dirname" select="chapter05"/>
     214    <!-- The build order -->
     215    <xsl:param name="order" select="062-1"/>
     216<!-- The file names -->
     217    <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
     218    <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
     219    <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
     220     <!-- Creating dirs and files -->
     221    <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
     222      <xsl:text>#!/bin/bash
     223set +h
     224set -e
     225
     226cd $PKGDIR
     227</xsl:text>
     228      <xsl:apply-templates
     229           select=".//screen[not(@role) or @role != 'nodump']/userinput[@remap != 'adjust']"
     230           mode="pkgmngt"/>
     231      <xsl:if test="@id = 'ch-system-pkgmngt'">
     232        <xsl:text>packInstall
     233rm -rf $PKG_DEST
     234</xsl:text>
     235      </xsl:if>
     236      <xsl:apply-templates
     237           select=".//screen[
     238              not(@role) or
     239              @role != 'nodump'
     240                            ]/userinput[
     241                                not(@remap) or
     242                                @remap='adjust'
     243                                       ]"
     244           mode="pkgmngt"/>
     245      <xsl:text>
     246echo -e "\n\nTotalseconds: $SECONDS\n"
     247exit
     248</xsl:text>
     249    </exsl:document>
     250  </xsl:template>
     251
     252  <xsl:template match="userinput" mode="pkgmngt">
     253    <xsl:apply-templates/>
     254    <xsl:text>&#xA;</xsl:text>
     255  </xsl:template>
     256 
     257  <xsl:template match="userinput">
    124258    <xsl:choose>
    125       <!-- Estandarized package formats -->
    126       <xsl:when test="contains(string(),'tar.gz')">
    127         <xsl:value-of select="substring-before(string(),'tar.gz')"/>
    128         <xsl:text>tar.*</xsl:text>
    129         <xsl:value-of select="substring-after(string(),'tar.gz')"/>
    130         <xsl:text>&#xA;</xsl:text>
    131       </xsl:when>
    132       <!-- Avoiding a race condition in a patch -->
    133       <xsl:when test="contains(string(),'debian_fixes')">
    134         <xsl:value-of select="substring-before(string(),'patch')"/>
    135         <xsl:text>patch -Z</xsl:text>
    136         <xsl:value-of select="substring-after(string(),'patch')"/>
    137         <xsl:text>&#xA;</xsl:text>
    138       </xsl:when>
    139       <!-- Fix Udev reinstallation after a build failure -->
    140       <xsl:when test="contains(string(),'firmware,udev')">
    141         <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
    142         <xsl:apply-templates/>
    143         <xsl:text>&#xA;fi&#xA;</xsl:text>
    144       </xsl:when>
    145259      <!-- Copying the kernel config file -->
    146260      <xsl:when test="string() = 'make mrproper'">
    147261        <xsl:text>make mrproper&#xA;</xsl:text>
    148                 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
     262        <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
    149263          <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
    150264        </xsl:if>
    151265      </xsl:when>
    152       <!-- The Bash, Coreutils, and Module-Init-Tools test suites are optional -->
    153       <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
    154                        ancestor::sect1[@id='ch-system-bash'] or
    155                        ancestor::sect1[@id='ch-system-module-init-tools'])
    156                       and @remap = 'test'">
    157         <xsl:choose>
    158           <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
    159           <xsl:otherwise>
    160             <xsl:if test="not(contains(string(),'check')) and
    161                           not(contains(string(),'make tests'))">
    162               <xsl:apply-templates/>
    163               <xsl:text>&#xA;</xsl:text>
    164             </xsl:if>
    165             <!-- Coreutils and Module-Init-Tools -->
    166             <xsl:if test="contains(string(),'check')">
    167               <xsl:choose>
    168                 <xsl:when test="$bomb-testsuite = 'n'">
    169                   <xsl:value-of select="substring-before(string(),'check')"/>
    170                   <xsl:text>-k check</xsl:text>
    171                   <xsl:value-of select="substring-after(string(),'check')"/>
    172                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    173                 </xsl:when>
    174                 <xsl:otherwise>
    175                   <xsl:apply-templates/>
    176                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    177                   <xsl:if test="contains(string(),' -k ')">
    178                     <xsl:text> || true</xsl:text>
    179                   </xsl:if>
    180                   <xsl:text>&#xA;</xsl:text>
    181                 </xsl:otherwise>
    182               </xsl:choose>
    183             </xsl:if>
    184             <!-- Bash -->
    185             <xsl:if test="contains(string(),'make tests')">
    186               <xsl:choose>
    187                 <xsl:when test="$bomb-testsuite = 'n'">
    188                   <xsl:value-of select="substring-before(string(),'tests')"/>
    189                   <xsl:text>-k tests</xsl:text>
    190                   <xsl:value-of select="substring-after(string(),'tests')"/>
    191                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    192                 </xsl:when>
    193                 <xsl:otherwise>
    194                   <xsl:apply-templates/>
    195                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    196                   <xsl:if test="contains(string(),' -k ')">
    197                     <xsl:text> || true</xsl:text>
    198                   </xsl:if>
    199                   <xsl:text>&#xA;</xsl:text>
    200                 </xsl:otherwise>
    201               </xsl:choose>
    202             </xsl:if>
    203           </xsl:otherwise>
    204         </xsl:choose>
    205       </xsl:when>
    206       <!-- Fixing toolchain test suites run -->
    207       <xsl:when test="(string() = 'make check' or
    208                        string() = 'make -k check') and
    209                       (ancestor::sect1[@id='ch-system-gcc'] or
    210                        ancestor::sect1[@id='ch-system-glibc'] or
    211                        ancestor::sect1[@id='ch-system-binutils'] or
    212                        ancestor::sect1[@id='ch-tools-gcc-pass2'])">
    213         <xsl:choose>
    214           <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
    215                     ancestor::chapter[@id='chapter-building-system']) or
    216                     $testsuite = '3'">
    217             <xsl:choose>
    218               <xsl:when test="$bomb-testsuite = 'n'">
    219                 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    220               </xsl:when>
    221               <xsl:otherwise>
    222                 <xsl:apply-templates/>
    223                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    224                 <xsl:if test="contains(string(),' -k ')">
    225                   <xsl:text> || true</xsl:text>
    226                 </xsl:if>
    227                 <xsl:text>&#xA;</xsl:text>
    228               </xsl:otherwise>
    229             </xsl:choose>
    230           </xsl:when>
    231         </xsl:choose>
    232       </xsl:when>
    233       <xsl:when test="contains(string(),'glibc-check-log')">
    234         <xsl:choose>
    235           <xsl:when test="$testsuite != '0'">
    236             <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
    237             <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    238           </xsl:when>
    239         </xsl:choose>
    240       </xsl:when>
    241       <xsl:when test="contains(string(),'test_summary') or
    242                 contains(string(),'expect -c')">
    243         <xsl:choose>
    244           <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
    245                     ancestor::chapter[@id='chapter-building-system']) or
    246                     $testsuite = '3'">
    247             <xsl:apply-templates/>
    248             <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
    249           </xsl:when>
    250         </xsl:choose>
    251       </xsl:when>
    252       <!-- The rest of testsuites -->
    253       <xsl:when test="@remap = 'test'">
     266<!-- test instructions -->
     267       <xsl:when test="@remap = 'test'">
    254268        <xsl:choose>
    255269          <xsl:when test="$testsuite = '0'"/>
     
    257271                          not(ancestor::sect1[@id='ch-system-gcc']) and
    258272                          not(ancestor::sect1[@id='ch-system-glibc']) and
     273                          not(ancestor::sect1[@id='ch-system-gmp']) and
     274                          not(ancestor::sect1[@id='ch-system-mpfr']) and
    259275                          not(ancestor::sect1[@id='ch-system-binutils'])"/>
    260276          <xsl:when test="$testsuite = '2' and
     
    263279            <xsl:choose>
    264280              <xsl:when test="$bomb-testsuite = 'n'">
    265                 <xsl:value-of select="substring-before(string(),'make')"/>
    266                 <xsl:text>make -k</xsl:text>
    267                 <xsl:value-of select="substring-after(string(),'make')"/>
    268                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
     281                <xsl:choose>
     282                  <!-- special case for glibc -->
     283                  <xsl:when test="contains(string(), 'glibc-check-log')">
     284                    <xsl:value-of
     285                       select="substring-before(string(),'2&gt;&amp;1')"/>
     286                    <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
     287                  </xsl:when>
     288                  <xsl:when test="contains(string(), 'make -k')">
     289                    <xsl:apply-templates/>
     290                    <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
     291                  </xsl:when>
     292                  <xsl:when test="contains(string(), 'make')">
     293                    <xsl:value-of select="substring-before(string(),'make')"/>
     294                    <xsl:text>make -k</xsl:text>
     295                    <xsl:value-of select="substring-after(string(),'make')"/>
     296                    <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
     297                  </xsl:when>
     298                  <xsl:otherwise>
     299                    <xsl:apply-templates/>
     300                    <xsl:if test="not(contains(string(), '&gt;&gt;'))">
     301                      <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
     302                    </xsl:if>
     303                    <xsl:text>&#xA;</xsl:text>
     304                  </xsl:otherwise>
     305                </xsl:choose>
    269306              </xsl:when>
    270307              <xsl:otherwise>
    271                 <xsl:apply-templates/>
    272                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    273                 <xsl:if test="contains(string(),' -k ')">
    274                   <xsl:text> || true</xsl:text>
    275                 </xsl:if>
    276                 <xsl:text>&#xA;</xsl:text>
     308                <!-- bomb-testsuite != 'n'-->
     309                <xsl:choose>
     310                  <!-- special case for glibc -->
     311                  <xsl:when test="contains(string(), 'glibc-check-log')">
     312                    <xsl:value-of
     313                       select="substring-before(string(),'2&gt;&amp;1')"/>
     314                    <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &#xA;</xsl:text>
     315                  </xsl:when>
     316                  <xsl:otherwise>
     317                    <xsl:apply-templates/>
     318                    <xsl:if test="not(contains(string(), '&gt;&gt;'))">
     319                      <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
     320                    </xsl:if>
     321                    <xsl:text>&#xA;</xsl:text>
     322                  </xsl:otherwise>
     323                </xsl:choose>
    277324              </xsl:otherwise>
    278325            </xsl:choose>
     
    280327        </xsl:choose>
    281328      </xsl:when>
     329<!-- End of test instructions -->
    282330      <!-- Don't stop on strip run -->
    283331      <xsl:when test="contains(string(),'strip ')">
     
    285333        <xsl:text> || true&#xA;</xsl:text>
    286334      </xsl:when>
     335<!-- Package management -->
     336<!-- Add $PKG_DEST to installation commands -->
     337      <xsl:when test="@remap='install' and
     338                      not(ancestor::chapter[
     339                              @id='chapter-temporary-tools'
     340                                           ])">
     341        <xsl:choose>
     342          <xsl:when test="$pkgmngt='n'">
     343            <xsl:choose>
     344              <xsl:when test="contains(string(),'firmware,udev')">
     345                <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
     346                <xsl:apply-templates/>
     347                <xsl:text>&#xA;fi&#xA;</xsl:text>
     348              </xsl:when>
     349              <xsl:otherwise>
     350                <xsl:apply-templates/>
     351                <xsl:text>&#xA;</xsl:text>
     352              </xsl:otherwise>
     353            </xsl:choose>
     354          </xsl:when>
     355          <xsl:otherwise><!--pkgmngt = 'y'-->
     356            <xsl:choose>
     357              <xsl:when test="./literal">
     358                <xsl:call-template name="outputpkgdest">
     359                  <xsl:with-param name="outputstring"
     360                                select="text()[1]"/>
     361                </xsl:call-template>
     362                <xsl:apply-templates select="literal"/>
     363                <xsl:call-template name="outputpkgdest">
     364                  <xsl:with-param name="outputstring"
     365                                select="text()[2]"/>
     366                </xsl:call-template>
     367              </xsl:when>
     368              <xsl:otherwise>
     369                <xsl:call-template name="outputpkgdest">
     370                  <xsl:with-param name="outputstring" select="string()"/>
     371                </xsl:call-template>
     372              </xsl:otherwise>
     373            </xsl:choose>
     374          </xsl:otherwise>
     375        </xsl:choose>
     376      </xsl:when>
     377      <!-- End addition for package management -->
    287378      <!-- The rest of commands -->
    288379      <xsl:otherwise>
     
    292383    </xsl:choose>
    293384  </xsl:template>
    294 
     385 
    295386  <xsl:template match="replaceable">
    296387    <xsl:choose>
     
    311402    </xsl:choose>
    312403  </xsl:template>
    313 
     404 
     405  <xsl:template name="outputpkgdest">
     406    <xsl:param name="outputstring" select="foo"/>
     407    <xsl:choose>
     408      <xsl:when test="contains($outputstring,'make ')">
     409        <xsl:choose>
     410          <xsl:when test="not(starts-with($outputstring,'make'))">
     411            <xsl:call-template name="outputpkgdest">
     412              <xsl:with-param name="outputstring"
     413                              select="substring-before($outputstring,'make')"/>
     414            </xsl:call-template>
     415            <xsl:call-template name="outputpkgdest">
     416              <xsl:with-param
     417                 name="outputstring"
     418                 select="substring-after($outputstring,
     419                                      substring-before($outputstring,'make'))"/>
     420            </xsl:call-template>
     421          </xsl:when>
     422          <xsl:otherwise>
     423           <xsl:choose>
     424<!-- special cases (no DESTDIR) here -->
     425            <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
     426             <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
     427             <xsl:value-of
     428               select="substring-before(substring-after(string(),'make'),
     429                                        'install')"/>
     430             <xsl:text>install&#xA;</xsl:text>
     431            </xsl:when>
     432            <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
     433             <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
     434            </xsl:when>
     435            <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
     436  <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
     437            </xsl:when>
     438            <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
     439             <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
     440             <xsl:value-of
     441               select="substring-before(substring-after(string(),'DESTDIR='),
     442                                        'install')"/>
     443             <xsl:text>install&#xA;</xsl:text>
     444            </xsl:when>
     445            <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
     446             <xsl:text>make ROOT=$PKG_DEST</xsl:text>
     447             <xsl:value-of
     448               select="substring-before(substring-after(string(),'make'),
     449                                        'install')"/>
     450             <xsl:text>install&#xA;</xsl:text>
     451            </xsl:when>
     452            <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
     453             <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
     454             <xsl:value-of
     455               select="substring-before(substring-after(string(),'make'),
     456                                        'install')"/>
     457             <xsl:text>install&#xA;</xsl:text>
     458            </xsl:when>
     459            <xsl:otherwise>
     460             <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
     461             <xsl:call-template name="outputpkgdest">
     462               <xsl:with-param
     463                    name="outputstring"
     464                    select="substring-after($outputstring,'make')"/>
     465             </xsl:call-template>
     466            </xsl:otherwise>
     467           </xsl:choose>
     468          </xsl:otherwise>
     469        </xsl:choose>
     470      </xsl:when>
     471      <xsl:otherwise> <!-- no make in this string -->
     472        <xsl:choose>
     473          <xsl:when test="contains($outputstring,'&gt;/') and
     474                                 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
     475            <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
     476            <xsl:text>&gt;$PKG_DEST/</xsl:text>
     477            <xsl:call-template name="outputpkgdest">
     478              <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
     479            </xsl:call-template>
     480          </xsl:when>
     481          <xsl:when test="contains($outputstring,' /')">
     482            <xsl:value-of select="substring-before($outputstring,' /')"/>
     483            <xsl:text> $PKG_DEST/</xsl:text>
     484            <xsl:call-template name="outputpkgdest">
     485              <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
     486            </xsl:call-template>
     487          </xsl:when>
     488          <xsl:otherwise>
     489            <xsl:value-of select="$outputstring"/>
     490            <xsl:text>&#xA;</xsl:text>
     491          </xsl:otherwise>
     492        </xsl:choose>
     493      </xsl:otherwise>
     494    </xsl:choose>
     495  </xsl:template>
    314496</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.