Changeset 78f22b7c


Ignore:
Timestamp:
01/26/2005 09:30:53 PM (19 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Children:
4aeea55
Parents:
c6b99aea
Message:

Updated patcheslist.xsl.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/testing/BOOK@4560 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stylesheets/patcheslist.xsl

    rc6b99aea r78f22b7c  
    55]>
    66
    7 <!-- To work against BLFS some changes are needed -->
    8 
    97<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    108                version="1.0">
     
    1210  <xsl:output method="text"/>
    1311
    14   <xsl:param name="links.directory">
    15     <xsl:value-of select="substring-after('&patches-root;', 'patches/')"/>
     12    <!-- Allow select the dest dir at runtime -->
     13  <xsl:param name="dest.dir">
     14    <xsl:value-of select="concat('/home/httpd/', substring-after('&patches-root;', 'http://'))"/>
    1615  </xsl:param>
    1716
    1817  <xsl:template match="/">
    19     <xsl:text>#! /bin/bash&#x0a;</xsl:text>
    20     <xsl:text>&#x0a;  cd /home/httpd/</xsl:text>
    21     <xsl:value-of select="substring-after('&patches-root;', 'http://')"/>
     18    <xsl:text>#! /bin/bash&#x0a;&#x0a;</xsl:text>
     19      <!-- Create dest.dir if it don't exist -->
     20    <xsl:text>  mkdir -p </xsl:text>
     21    <xsl:value-of select="$dest.dir"/>
     22    <xsl:text> &amp;&amp;&#x0a;</xsl:text>
     23    <xsl:text>  cd </xsl:text>
     24    <xsl:value-of select="$dest.dir"/>
    2225    <xsl:text> &amp;&amp;&#x0a;&#x0a;</xsl:text>
    23     <xsl:text>  rm -f *.patch &amp;&amp;&#x0a;&#x0a;</xsl:text>
     26      <!-- Touch a dummy patch to prevent fails if dest dir is empty, then remove old patches -->
     27    <xsl:text>  touch dummy.patch &amp;&amp;&#x0a;  rm -f *.patch &amp;&amp;&#x0a;&#x0a;</xsl:text>
    2428    <xsl:apply-templates/>
     29      <!-- Ensure correct owneship -->
    2530    <xsl:text>&#x0a;  chgrp lfswww *.patch &amp;&amp;&#x0a;</xsl:text>
    2631    <xsl:text>&#x0a;  exit&#x0a;</xsl:text>
    2732  </xsl:template>
    2833
    29   <xsl:template match="//text()">
    30     <xsl:text/>
    31   </xsl:template>
     34  <xsl:template match="//text()"/>
    3235
    3336  <xsl:template match="//ulink">
    34     <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')">
    35       <xsl:choose>
    36         <xsl:when test="ancestor-or-self::*/@condition = 'pdf'"/>
    37         <xsl:otherwise>
    38           <xsl:text>  cp </xsl:text>
    39           <xsl:text>/home/httpd/</xsl:text>
    40           <xsl:value-of select="substring-before (substring-after ('&patches-root;', 'http://'), $links.directory)"/>
    41           <xsl:text>downloads/</xsl:text>
    42           <xsl:if test="contains (@url, '-')">
    43             <xsl:variable name="cut" select="translate (@url, '0123456789', '2222222222')"/>
    44             <xsl:variable name="links.directory2" select="translate ($links.directory, '0123456789', '2222222222')"/>
    45             <xsl:choose>
    46               <xsl:when test="contains ($cut, ',')">
    47                 <xsl:value-of select="substring-before (substring-after($cut, $links.directory2), ',2')"/>
    48               </xsl:when>
    49               <xsl:otherwise>
    50                 <xsl:choose>
    51                   <xsl:when test="contains ($cut, '-src-2')">
    52                     <xsl:value-of select="substring-before (substring-after($cut, $links.directory2), '-src-2')"/>
    53                   </xsl:when>
    54                   <xsl:otherwise>
    55                     <xsl:value-of select="substring-before (substring-after($cut, $links.directory2), '-2')"/>
    56                   </xsl:otherwise>
    57                 </xsl:choose>
    58               </xsl:otherwise>
    59             </xsl:choose>
    60           </xsl:if>
    61           <xsl:text>/</xsl:text>
    62           <xsl:value-of select="substring-after(@url, $links.directory)"/>
    63           <xsl:text> . &#x0a;</xsl:text>
    64         </xsl:otherwise>
    65       </xsl:choose>
     37      <!-- Match only local patches links and skip duplicated URLs splitted for PDF output-->
     38    <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')
     39            and not(ancestor-or-self::*/@condition = 'pdf')">
     40      <xsl:variable name="patch.name" select="substring-after(@url, '&patches-root;')"/>
     41      <xsl:variable name="cut"
     42              select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
     43      <xsl:variable name="patch.name2">
     44        <xsl:value-of select="substring-before($patch.name, '-')"/>
     45        <xsl:text>-</xsl:text>
     46        <xsl:value-of select="$cut"/>
     47      </xsl:variable>
     48      <xsl:text>  cp /home/httpd/www.linuxfromscratch.org/patches/downloads/</xsl:text>
     49          <xsl:value-of select="substring-before($patch.name2, '-0')"/>
     50      <xsl:text>/</xsl:text>
     51      <xsl:value-of select="$patch.name"/>
     52      <xsl:text> . &#x0a;</xsl:text>
    6653    </xsl:if>
    6754  </xsl:template>
Note: See TracChangeset for help on using the changeset viewer.