aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Canales Esparcia <manuel@linuxfromscratch.org>2005-01-26 21:33:47 +0000
committerManuel Canales Esparcia <manuel@linuxfromscratch.org>2005-01-26 21:33:47 +0000
commit935c600f39d439fb29aade451846d809e7fdd3e7 (patch)
tree0d074bb771eea1cb077d6800e0b2b98f88e5003e
parent0fb69dd5ab56857635dbcc6aa9925f31dc1182b7 (diff)
Updated patcheslist.xsl.
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multi-arch/BOOK@4562 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r--stylesheets/patcheslist.xsl73
1 files changed, 30 insertions, 43 deletions
diff --git a/stylesheets/patcheslist.xsl b/stylesheets/patcheslist.xsl
index a8496b6c0..9662b04ac 100644
--- a/stylesheets/patcheslist.xsl
+++ b/stylesheets/patcheslist.xsl
@@ -4,65 +4,52 @@
%general-entities;
]>
-<!-- To work against BLFS some changes are needed -->
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
- <xsl:param name="links.directory">
- <xsl:value-of select="substring-after('&patches-root;', 'patches/')"/>
+ <!-- Allow select the dest dir at runtime -->
+ <xsl:param name="dest.dir">
+ <xsl:value-of select="concat('/home/httpd/', substring-after('&patches-root;', 'http://'))"/>
</xsl:param>
<xsl:template match="/">
- <xsl:text>#! /bin/bash&#x0a;</xsl:text>
- <xsl:text>&#x0a; cd /home/httpd/</xsl:text>
- <xsl:value-of select="substring-after('&patches-root;', 'http://')"/>
+ <xsl:text>#! /bin/bash&#x0a;&#x0a;</xsl:text>
+ <!-- Create dest.dir if it don't exist -->
+ <xsl:text> mkdir -p </xsl:text>
+ <xsl:value-of select="$dest.dir"/>
+ <xsl:text> &amp;&amp;&#x0a;</xsl:text>
+ <xsl:text> cd </xsl:text>
+ <xsl:value-of select="$dest.dir"/>
<xsl:text> &amp;&amp;&#x0a;&#x0a;</xsl:text>
- <xsl:text> rm -f *.patch &amp;&amp;&#x0a;&#x0a;</xsl:text>
+ <!-- Touch a dummy patch to prevent fails if dest dir is empty, then remove old patches -->
+ <xsl:text> touch dummy.patch &amp;&amp;&#x0a; rm -f *.patch &amp;&amp;&#x0a;&#x0a;</xsl:text>
<xsl:apply-templates/>
+ <!-- Ensure correct owneship -->
<xsl:text>&#x0a; chgrp lfswww *.patch &amp;&amp;&#x0a;</xsl:text>
<xsl:text>&#x0a; exit&#x0a;</xsl:text>
</xsl:template>
- <xsl:template match="//text()">
- <xsl:text/>
- </xsl:template>
+ <xsl:template match="//text()"/>
<xsl:template match="//ulink">
- <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::*/@condition = 'pdf'"/>
- <xsl:otherwise>
- <xsl:text> cp </xsl:text>
- <xsl:text>/home/httpd/</xsl:text>
- <xsl:value-of select="substring-before (substring-after ('&patches-root;', 'http://'), $links.directory)"/>
- <xsl:text>downloads/</xsl:text>
- <xsl:if test="contains (@url, '-')">
- <xsl:variable name="cut" select="translate (@url, '0123456789', '2222222222')"/>
- <xsl:variable name="links.directory2" select="translate ($links.directory, '0123456789', '2222222222')"/>
- <xsl:choose>
- <xsl:when test="contains ($cut, ',')">
- <xsl:value-of select="substring-before (substring-after($cut, $links.directory2), ',2')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="contains ($cut, '-src-2')">
- <xsl:value-of select="substring-before (substring-after($cut, $links.directory2), '-src-2')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="substring-before (substring-after($cut, $links.directory2), '-2')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:text>/</xsl:text>
- <xsl:value-of select="substring-after(@url, $links.directory)"/>
- <xsl:text> . &#x0a;</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
+ <!-- Match only local patches links and skip duplicated URLs splitted for PDF output-->
+ <xsl:if test="contains(@url, '.patch') and contains(@url, '&patches-root;')
+ and not(ancestor-or-self::*/@condition = 'pdf')">
+ <xsl:variable name="patch.name" select="substring-after(@url, '&patches-root;')"/>
+ <xsl:variable name="cut"
+ select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
+ <xsl:variable name="patch.name2">
+ <xsl:value-of select="substring-before($patch.name, '-')"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="$cut"/>
+ </xsl:variable>
+ <xsl:text> cp /home/httpd/www.linuxfromscratch.org/patches/downloads/</xsl:text>
+ <xsl:value-of select="substring-before($patch.name2, '-0')"/>
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="$patch.name"/>
+ <xsl:text> . &#x0a;</xsl:text>
</xsl:if>
</xsl:template>