Subversion Repositories svn LFS-FR


Rev 7156 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY % general-entities SYSTEM "../general.ent">

$LastChangedBy: randy $
$Date: 2007-01-30 21:25:59 +0100 (mar, 30 jan 2007) $

 This stylesheet creates a script to copy the patches referenced
 in the BLFS book from the patches repository to the blfs
 download area.  It is very specific to the installation on
 the home server.

<xsl:stylesheet xmlns:xsl=""

  <xsl:output method="text"/>

    <!-- Allow select the dest dir at runtime -->
  <xsl:param name="dest.dir">
    <xsl:value-of select="concat('/srv/www/', substring-after('&patch-root;', 'http://'))"/>

  <xsl:template match="/">
    <xsl:text>#! /bin/bash&#x0a;&#x0a;</xsl:text>
    <xsl:text>function copy
   cp $1 $2 >>copyerrs 2>&amp;1
      <!-- 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>
      <!-- Remove old patches and possible list of missing patches-->
    <xsl:text>rm -f *.patch copyerrs &amp;&amp;&#x0a;&#x0a;</xsl:text>
      <!-- Ensure correct ownership -->
    <xsl:text>&#x0a;chgrp lfswww *.patch &amp;&amp;&#x0a;</xsl:text>
    <xsl:text>if [ `wc -l copyerrs|sed 's/ *//' |cut -f1 -d' '` -gt 0 ]; then
  mail -s "Missing BLFS patches" &lt; copyerrs

  <xsl:template match="//text()"/>

  <xsl:template match="//ulink">
      <!-- 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="" select="substring-after(@url, '&patch-root;')"/>
      <xsl:text>copy /srv/www/</xsl:text>
          <!-- cdparanoia -->
        <xsl:when test="contains($, '-III')">
          <!-- Open Office -->
        <xsl:when test="contains($, 'OOo')">
          <!-- QT -->
        <xsl:when test="contains($, 'qt-x')">
          <!-- XOrg -->
        <xsl:when test="contains($, 'X11R6')">
          <!-- net-tools -->
        <xsl:when test="contains($, 'net-tools')">
          <!-- x265 -->
        <xsl:when test="contains($, 'x265')">
          <!-- General rule -->
          <xsl:variable name="cut"
                 select="translate(substring-after($, '-'), '0123456789', '0000000000')"/>
          <xsl:variable name="patch.name2">
            <xsl:value-of select="substring-before($, '-')"/>
            <xsl:value-of select="$cut"/>
          <xsl:value-of select="substring-before($patch.name2, '-0')"/>
      <xsl:value-of select="$"/>
      <xsl:text> . &#x0a;</xsl:text>