Author: bdubbs Date: 2005-11-06 19:19:36 -0700 (Sun, 06 Nov 2005) New Revision: 5262
Modified: trunk/BOOK/stylesheets/patcheslist.xsl Log: Updating patcheslist script to properly extract patches from the xml source Modified: trunk/BOOK/stylesheets/patcheslist.xsl =================================================================== --- trunk/BOOK/stylesheets/patcheslist.xsl 2005-11-05 18:17:43 UTC (rev 5261) +++ trunk/BOOK/stylesheets/patcheslist.xsl 2005-11-07 02:19:36 UTC (rev 5262) @@ -1,25 +1,76 @@ <?xml version='1.0' encoding='ISO-8859-1'?> +<!DOCTYPE xsl:stylesheet [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> -<!-- Get list of patch files from the BLFS Book --> -<!-- $LastChangedBy$ --> -<!-- $Date$ --> - <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 -- http://linuxfromscratch.org/mailman/listinfo/blfs-book FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
