Changeset e213e4c for LFS/lfs.xsl


Ignore:
Timestamp:
09/21/2007 09:47:06 PM (17 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
fa1b640
Parents:
be22162
Message:

Splitted userinput template.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LFS/lfs.xsl

    rbe22162 re213e4c  
    118118    </xsl:if>
    119119    <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
    120       <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
     120      <xsl:text>tar -xvf ../$TARBALL_1 --strip-components=1&#xA;</xsl:text>
    121121    </xsl:if>
    122122  </xsl:template>
     
    208208      <!-- Inherited dir name -->
    209209    <xsl:param name="dirname" select="foo"/>
     210      <!-- Process only files with actual build commands -->
    210211    <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
    211212                  count(descendant::screen/userinput) &gt;
     
    313314  <xsl:template match="userinput">
    314315    <xsl:choose>
    315       <!-- Estandarized package formats -->
    316       <xsl:when test="contains(string(),'tar.gz')">
    317         <xsl:value-of select="substring-before(string(),'tar.gz')"/>
    318         <xsl:text>tar.*</xsl:text>
    319         <xsl:value-of select="substring-after(string(),'tar.gz')"/>
    320         <xsl:text>&#xA;</xsl:text>
    321       </xsl:when>
    322       <!-- Avoiding a race condition in a patch -->
    323       <xsl:when test="contains(string(),'debian_fixes')">
    324         <xsl:value-of select="substring-before(string(),'patch')"/>
    325         <xsl:text>patch -Z</xsl:text>
    326         <xsl:value-of select="substring-after(string(),'patch')"/>
    327         <xsl:text>&#xA;</xsl:text>
    328       </xsl:when>
    329       <!-- Fix Udev reinstallation after a build failure -->
    330       <xsl:when test="contains(string(),'firmware,udev')">
    331         <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
    332         <xsl:apply-templates/>
    333         <xsl:text>&#xA;fi&#xA;</xsl:text>
    334       </xsl:when>
    335       <!-- Setting $LANG for /etc/profile -->
    336       <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
    337                 contains(string(),'export LANG=')">
    338         <xsl:value-of select="substring-before(string(),'export LANG=')"/>
    339         <xsl:text>export LANG=</xsl:text>
    340         <xsl:value-of select="$lang"/>
    341         <xsl:value-of select="substring-after(string(),'modifiers>')"/>
    342         <xsl:text>&#xA;</xsl:text>
    343       </xsl:when>
    344       <!-- Copying the kernel config file -->
    345       <xsl:when test="string() = 'make mrproper'">
    346         <xsl:text>make mrproper&#xA;</xsl:text>
    347         <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
    348       </xsl:when>
    349       <!-- The Bash, Coreutils, and Module-Init-Tools test suites are optional -->
    350       <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
    351                        ancestor::sect1[@id='ch-system-bash'] or
    352                        ancestor::sect1[@id='ch-system-module-init-tools'])
    353                       and @remap = 'test'">
    354         <xsl:choose>
    355           <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
    356           <xsl:otherwise>
    357             <xsl:if test="not(contains(string(),'check')) and
    358                           not(contains(string(),'make tests'))">
    359               <xsl:apply-templates/>
    360               <xsl:text>&#xA;</xsl:text>
    361             </xsl:if>
    362             <!-- Coreutils and Module-Init-Tools -->
    363             <xsl:if test="contains(string(),'check')">
    364               <xsl:choose>
    365                 <xsl:when test="$bomb-testsuite = 'n'">
    366                   <xsl:value-of select="substring-before(string(),'check')"/>
    367                   <xsl:text>-k check</xsl:text>
    368                   <xsl:value-of select="substring-after(string(),'check')"/>
    369                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    370                 </xsl:when>
    371                 <xsl:otherwise>
    372                   <xsl:apply-templates/>
    373                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    374                   <xsl:if test="contains(string(),' -k ')">
    375                     <xsl:text> || true</xsl:text>
    376                   </xsl:if>
    377                   <xsl:text>&#xA;</xsl:text>
    378                 </xsl:otherwise>
    379               </xsl:choose>
    380             </xsl:if>
    381             <!-- Bash -->
    382             <xsl:if test="contains(string(),'make tests')">
    383               <xsl:choose>
    384                 <xsl:when test="$bomb-testsuite = 'n'">
    385                   <xsl:value-of select="substring-before(string(),'tests')"/>
    386                   <xsl:text>-k tests</xsl:text>
    387                   <xsl:value-of select="substring-after(string(),'tests')"/>
    388                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    389                 </xsl:when>
    390                 <xsl:otherwise>
    391                   <xsl:apply-templates/>
    392                   <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    393                   <xsl:if test="contains(string(),' -k ')">
    394                     <xsl:text> || true</xsl:text>
    395                   </xsl:if>
    396                   <xsl:text>&#xA;</xsl:text>
    397                 </xsl:otherwise>
    398               </xsl:choose>
    399             </xsl:if>
    400           </xsl:otherwise>
    401         </xsl:choose>
    402       </xsl:when>
    403       <!-- Fixing toolchain test suites run -->
    404       <xsl:when test="(string() = 'make check' or
    405                        string() = 'make -k check') and
    406                       (ancestor::sect1[@id='ch-system-gcc'] or
    407                        ancestor::sect1[@id='ch-system-glibc'] or
    408                        ancestor::sect1[@id='ch-system-binutils'] or
    409                        ancestor::sect1[@id='ch-tools-gcc-pass2'])">
    410         <xsl:choose>
    411           <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
    412                     ancestor::chapter[@id='chapter-building-system']) or
    413                     $testsuite = '3'">
    414             <xsl:choose>
    415               <xsl:when test="$bomb-testsuite = 'n'">
    416                 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    417               </xsl:when>
    418               <xsl:otherwise>
    419                 <xsl:apply-templates/>
    420                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    421                 <xsl:if test="contains(string(),' -k ')">
    422                   <xsl:text> || true</xsl:text>
    423                 </xsl:if>
    424                 <xsl:text>&#xA;</xsl:text>
    425               </xsl:otherwise>
    426             </xsl:choose>
    427           </xsl:when>
    428         </xsl:choose>
    429       </xsl:when>
    430       <xsl:when test="contains(string(),'glibc-check-log')">
    431         <xsl:choose>
    432           <xsl:when test="$testsuite != '0'">
    433             <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
    434             <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    435           </xsl:when>
    436         </xsl:choose>
    437       </xsl:when>
    438       <xsl:when test="contains(string(),'test_summary') or
    439                 contains(string(),'expect -c')">
    440         <xsl:choose>
    441           <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
    442                     ancestor::chapter[@id='chapter-building-system']) or
    443                     $testsuite = '3'">
    444             <xsl:apply-templates/>
    445             <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
    446           </xsl:when>
    447         </xsl:choose>
    448       </xsl:when>
    449       <!-- The rest of testsuites -->
     316      <xsl:when test="@remap = 'pre'">
     317        <xsl:apply-templates select="." mode="pre"/>
     318      </xsl:when>
     319      <xsl:when test="@remap = 'configure'">
     320        <xsl:apply-templates select="." mode="configure"/>
     321      </xsl:when>
     322      <xsl:when test="@remap = 'make'">
     323        <xsl:apply-templates select="." mode="make"/>
     324      </xsl:when>
    450325      <xsl:when test="@remap = 'test'">
    451         <xsl:choose>
    452           <xsl:when test="$testsuite = '0'"/>
    453           <xsl:when test="$testsuite = '1' and
    454                           not(ancestor::sect1[@id='ch-system-gcc']) and
    455                           not(ancestor::sect1[@id='ch-system-glibc']) and
    456                           not(ancestor::sect1[@id='ch-system-binutils'])"/>
    457           <xsl:when test="$testsuite = '2' and
    458                           ancestor::chapter[@id='chapter-temporary-tools']"/>
    459           <xsl:otherwise>
    460             <xsl:choose>
    461               <xsl:when test="$bomb-testsuite = 'n'">
    462                 <xsl:value-of select="substring-before(string(),'make')"/>
    463                 <xsl:text>make -k</xsl:text>
    464                 <xsl:value-of select="substring-after(string(),'make')"/>
    465                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
    466               </xsl:when>
    467               <xsl:otherwise>
    468                 <xsl:apply-templates/>
    469                 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
    470                 <xsl:if test="contains(string(),' -k ')">
    471                   <xsl:text> || true</xsl:text>
    472                 </xsl:if>
    473                 <xsl:text>&#xA;</xsl:text>
    474               </xsl:otherwise>
    475             </xsl:choose>
    476           </xsl:otherwise>
    477         </xsl:choose>
    478       </xsl:when>
    479       <!-- Don't stop on strip run -->
    480       <xsl:when test="contains(string(),'strip ')">
    481         <xsl:apply-templates/>
    482         <xsl:text> || true&#xA;</xsl:text>
    483       </xsl:when>
    484       <!-- The rest of commands -->
     326        <xsl:apply-templates select="." mode="test"/>
     327      </xsl:when>
     328      <xsl:when test="@remap = 'install'">
     329        <xsl:apply-templates select="." mode="install"/>
     330      </xsl:when>
     331      <xsl:when test="@remap = 'adjust'">
     332        <xsl:apply-templates select="." mode="adjust"/>
     333      </xsl:when>
     334      <xsl:when test="@remap = 'locale-test'">
     335        <xsl:apply-templates select="." mode="locale-test"/>
     336      </xsl:when>
     337      <xsl:when test="@remap = 'locale-full'">
     338        <xsl:apply-templates select="." mode="locale-full"/>
     339      </xsl:when>
    485340      <xsl:otherwise>
    486         <xsl:apply-templates/>
    487         <xsl:text>&#xA;</xsl:text>
     341        <xsl:apply-templates select="." mode="default"/>
    488342      </xsl:otherwise>
    489343    </xsl:choose>
    490   </xsl:template>
    491 
     344    <xsl:text>&#xA;</xsl:text>
     345  </xsl:template>
     346
     347
     348    <!-- replaceable -->
    492349  <xsl:template match="replaceable">
    493350    <xsl:choose>
    494       <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
     351        <!-- Configuring the Time Zone -->
     352      <xsl:when test="ancestor::sect2[@id='conf-glibc'] and string()='&lt;xxx&gt;'">
    495353        <xsl:value-of select="$timezone"/>
    496354      </xsl:when>
    497       <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
     355        <!-- Set paper size for Groff build -->
     356      <xsl:when test="string()='&lt;paper_size&gt;'">
    498357        <xsl:value-of select="$page"/>
     358      </xsl:when>
     359        <!-- LANG setting in /etc/profile -->
     360      <xsl:when test="contains(string(),'&lt;ll&gt;_&lt;CC&gt;')">
     361        <xsl:value-of select="$lang"/>
    499362      </xsl:when>
    500363      <xsl:otherwise>
     
    506369  </xsl:template>
    507370
     371
     372<!-- ######################################################################## -->
     373
     374<!-- ############################# MODE TEMPLATES ########################### -->
     375
     376    <!-- mode default  -->
     377  <xsl:template match="userinput" mode="default">
     378      <!-- All ugly hacks required to fix automatization build issues,
     379           except the ones related to testsuites, should go here,
     380           no matter what @remap value have assigned -->
     381    <xsl:choose>
     382        <!-- Fix Udev reinstallation after a build failure -->
     383      <xsl:when test="contains(string(),'firmware,udev')">
     384        <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
     385        <xsl:apply-templates/>
     386        <xsl:text>&#xA;fi</xsl:text>
     387      </xsl:when>
     388        <!-- Copying the kernel config file -->
     389      <xsl:when test="string() = 'make mrproper'">
     390        <xsl:text>make mrproper&#xA;</xsl:text>
     391        <xsl:text>cp -v ../kernel-config .config</xsl:text>
     392      </xsl:when>
     393        <!-- Don't stop on strip run -->
     394      <xsl:when test="contains(string(),'strip --strip')">
     395        <xsl:apply-templates/>
     396        <xsl:text> || true</xsl:text>
     397      </xsl:when>
     398        <!-- The rest of commands -->
     399      <xsl:otherwise>
     400        <xsl:apply-templates/>
     401      </xsl:otherwise>
     402    </xsl:choose>
     403  </xsl:template>
     404
     405
     406    <!-- mode test  -->
     407  <xsl:template match="userinput" mode="test">
     408    <xsl:choose>
     409        <!-- No testsuites run on level 0 -->
     410      <xsl:when test="$testsuite = '0'"/>
     411        <!-- On level 1, only final system toolchain testsuites are run -->
     412      <xsl:when test="$testsuite = '1' and
     413                      not(ancestor::sect1[@id='ch-system-gcc']) and
     414                      not(ancestor::sect1[@id='ch-system-glibc']) and
     415                      not(ancestor::sect1[@id='ch-system-binutils'])"/>
     416        <!-- On level 2, temp tools testsuites are not run -->
     417      <xsl:when test="$testsuite = '2' and
     418                      ancestor::chapter[@id='chapter-temporary-tools']"/>
     419        <!-- Start testsuites command fixes -->
     420      <xsl:otherwise>
     421        <xsl:choose>
     422            <!-- Final system Glibc -->
     423          <xsl:when test="contains(string(),'glibc-check-log')">
     424            <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
     425            <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
     426          </xsl:when>
     427            <!-- Module-Init-Tools -->
     428          <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
     429                          and contains(string(),'make check')">
     430            <xsl:value-of select="substring-before(string(),' check')"/>
     431            <xsl:if test="$bomb-testsuite = 'n'">
     432              <xsl:text> -k</xsl:text>
     433            </xsl:if>
     434            <xsl:text> check &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
     435            <xsl:if test="$bomb-testsuite = 'n'">
     436              <xsl:text> || true</xsl:text>
     437            </xsl:if>
     438            <xsl:value-of select="substring-after(string(),' check')"/>
     439          </xsl:when>
     440            <!-- If the book uses -k, the testsuite should never bomb -->
     441          <xsl:when test="contains(string(),'make -k ')">
     442            <xsl:apply-templates select="." mode="default"/>
     443            <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
     444          </xsl:when>
     445            <!-- Extra commands in Binutils and GCC -->
     446          <xsl:when test="contains(string(),'test_summary') or
     447                          contains(string(),'expect -c')">
     448            <xsl:apply-templates select="." mode="default"/>
     449            <xsl:text> &gt;&gt; $TEST_LOG</xsl:text>
     450          </xsl:when>
     451            <!-- Remaining extra testsuite commads that don't need be hacked -->
     452          <xsl:when test="not(contains(string(),'make '))">
     453            <xsl:apply-templates select="." mode="default"/>
     454          </xsl:when>
     455            <!-- Normal testsites run -->
     456          <xsl:otherwise>
     457            <xsl:choose>
     458                <!-- No bomb on failures -->
     459              <xsl:when test="$bomb-testsuite = 'n'">
     460                <xsl:value-of select="substring-before(string(),'make ')"/>
     461                <xsl:text>make -k </xsl:text>
     462                <xsl:value-of select="substring-after(string(),'make ')"/>
     463                <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true</xsl:text>
     464              </xsl:when>
     465                <!-- Bomb at the first failure -->
     466              <xsl:otherwise>
     467                <xsl:apply-templates select="." mode="default"/>
     468                <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
     469              </xsl:otherwise>
     470            </xsl:choose>
     471          </xsl:otherwise>
     472        </xsl:choose>
     473      </xsl:otherwise>
     474    </xsl:choose>
     475  </xsl:template>
     476
     477
     478    <!-- mode pre  -->
     479  <xsl:template match="userinput" mode="pre">
     480    <xsl:apply-templates select="." mode="default"/>
     481  </xsl:template>
     482
     483
     484    <!-- mode configure  -->
     485  <xsl:template match="userinput" mode="configure">
     486    <xsl:apply-templates select="." mode="default"/>
     487  </xsl:template>
     488
     489
     490    <!-- mode make  -->
     491  <xsl:template match="userinput" mode="make">
     492    <xsl:apply-templates select="." mode="default"/>
     493  </xsl:template>
     494
     495
     496    <!-- mode install  -->
     497  <xsl:template match="userinput" mode="install">
     498    <xsl:apply-templates select="." mode="default"/>
     499  </xsl:template>
     500
     501
     502    <!-- mode adjust  -->
     503  <xsl:template match="userinput" mode="adjust">
     504    <xsl:apply-templates select="." mode="default"/>
     505  </xsl:template>
     506
     507
     508    <!-- mode locale-test  -->
     509  <xsl:template match="userinput" mode="locale-test">
     510    <xsl:apply-templates select="." mode="default"/>
     511  </xsl:template>
     512
     513
     514    <!-- mode locale-full  -->
     515  <xsl:template match="userinput" mode="locale-full">
     516    <xsl:apply-templates select="." mode="default"/>
     517  </xsl:template>
     518
    508519</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.