diff options
author | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2005-11-07 02:19:36 +0000 |
---|---|---|
committer | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2005-11-07 02:19:36 +0000 |
commit | 967e95113b50814649c6b53d2931e02c0294056c (patch) | |
tree | b54500a1edab9f881d99035812073bc4b357fb4f /stylesheets/patcheslist.xsl | |
parent | 71372a2260280893b02360af56e9a4641d23dce7 (diff) |
Updating patcheslist script to properly extract patches from the xml source
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@5262 af4574ff-66df-0310-9fd7-8a98e5e911e0
Diffstat (limited to 'stylesheets/patcheslist.xsl')
-rw-r--r-- | stylesheets/patcheslist.xsl | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/stylesheets/patcheslist.xsl b/stylesheets/patcheslist.xsl index f449c5833c..4a14d461e7 100644 --- a/stylesheets/patcheslist.xsl +++ b/stylesheets/patcheslist.xsl @@ -1,25 +1,76 @@ <?xml version='1.0' encoding='ISO-8859-1'?> - -<!-- Get list of patch files from the BLFS Book --> -<!-- $LastChangedBy$ --> -<!-- $Date$ --> +<!DOCTYPE xsl:stylesheet [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> - <!-- No text needed --> - <xsl:template match="//text()"> - <xsl:text/> + <!-- Allow select the dest dir at runtime --> + <xsl:param name="dest.dir"> + <xsl:value-of select="concat('/home/httpd/', substring-after('&patch-root;', 'http://'))"/> + </xsl:param> + + <xsl:template match="/"> + <xsl:text>#! /bin/bash

</xsl:text> + <!-- Create dest.dir if it don't exist --> + <xsl:text> mkdir -p </xsl:text> + <xsl:value-of select="$dest.dir"/> + <xsl:text> &&
</xsl:text> + <xsl:text> cd </xsl:text> + <xsl:value-of select="$dest.dir"/> + <xsl:text> &&

</xsl:text> + <!-- Touch a dummy patch to prevent fails if dest dir is empty, then remove old patches --> + <xsl:text> touch dummy.patch &&
 rm -f *.patch &&

</xsl:text> + <xsl:apply-templates/> + <!-- Ensure correct owneship --> + <xsl:text>
 chgrp lfswww *.patch &&
</xsl:text> + <xsl:text>
 exit
</xsl:text> </xsl:template> - <!-- Just grab the url from the ulink tags that have .patch in the name --> + <xsl:template match="//text()"/> + <xsl:template match="//ulink"> - <xsl:if test="contains(@url, '.patch') and contains(@url, 'linuxfromscratch')"> - <xsl:value-of select="@url"/> - <xsl:text>
</xsl:text> + <!-- Match only local patches links and skip duplicated URLs splitted for PDF output--> + <xsl:if test="contains(@url, '.patch') and contains(@url, '&patch-root;') + and not(ancestor-or-self::*/@condition = 'pdf')"> + <xsl:variable name="patch.name" select="substring-after(@url, '&patch-root;')"/> + <xsl:text> cp /home/httpd/www.linuxfromscratch.org/patches/downloads</xsl:text> + <xsl:choose> + <!-- cdparanoia --> + <xsl:when test="contains($patch.name, '-III')"> + <xsl:text>/cdparanoia</xsl:text> + </xsl:when> + <!-- Open Office --> + <xsl:when test="contains($patch.name, 'OOo')"> + <xsl:text>/OOo</xsl:text> + </xsl:when> + <!-- QT --> + <xsl:when test="contains($patch.name, 'qt-x')"> + <xsl:text>/qt</xsl:text> + </xsl:when> + <!-- XOrg --> + <xsl:when test="contains($patch.name, 'X11R6')"> + <xsl:text>/xorg</xsl:text> + </xsl:when> + <!-- General rule --> + <xsl:otherwise> + <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:value-of select="substring-before($patch.name2, '-0')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="$patch.name"/> + <xsl:text> . 
</xsl:text> </xsl:if> </xsl:template> -</xsl:stylesheet> +</xsl:stylesheet>
\ No newline at end of file |