aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Huntwork <jhuntwork@linuxfromscratch.org>2006-12-04 04:48:25 +0000
committerJeremy Huntwork <jhuntwork@linuxfromscratch.org>2006-12-04 04:48:25 +0000
commit3a4594b22c7ad36dac6687b920decabed2c287ae (patch)
treef89d2922270ea4636d1d44fd5939389ff3dc163f
parent3d8a36219be2f6e535817ec37da9f16f19ea4da5 (diff)
Added a stylesheet and Makefile target that will allow the dynamic creation of a wget-list.
Stylesheet is modified from jhalfs-2.0. This will be useful to our current FTP maintainer in dynamically collecting packages. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7878 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r--Makefile6
-rw-r--r--stylesheets/wget-list.xsl74
2 files changed, 80 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e61f05d5e..88c7d9a9d 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@ PDF_OUTPUT=LFS-BOOK.pdf
NOCHUNKS_OUTPUT=LFS-BOOK.html
XSLROOTDIR=/usr/share/xml/docbook/xsl-stylesheets-1.69.1
+
lfs:
xsltproc --xinclude --nonet -stringparam profile.condition html \
-stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/ \
@@ -31,6 +32,11 @@ lfs:
sh obfuscate.sh $$filename; \
sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
done;
+
+ $(MAKE) wget-list
+
+wget-list:
+ xsltproc --xinclude --nonet stylesheets/wget-list.xsl index.xml > $(BASEDIR)/wget-list
# Uncomment this for testing and stable versions
#pdf:
diff --git a/stylesheets/wget-list.xsl b/stylesheets/wget-list.xsl
new file mode 100644
index 000000000..d0da2bd3b
--- /dev/null
+++ b/stylesheets/wget-list.xsl
@@ -0,0 +1,74 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!-- $Id$ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <xsl:output method="text"/>
+
+ <!-- The FTP server used as fallback -->
+ <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
+
+ <!-- The libc model used for HLFS -->
+ <xsl:param name="model" select="glibc"/>
+
+ <xsl:template match="/">
+ <xsl:apply-templates select="//ulink"/>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <!-- If some package don't have the predefined strings in their
+ name, the next test must be fixed to match it also. Skip possible
+ duplicated URLs due that may be splitted for PDF output -->
+ <xsl:if test="(ancestor::varlistentry[@condition=$model]
+ or not(ancestor::varlistentry[@condition])) and
+ (contains(@url, '.tar.') or contains(@url, '.tgz')
+ or contains(@url, '.patch')) and
+ not(ancestor-or-self::*/@condition = 'pdf')">
+ <!-- Extract the package name -->
+ <xsl:variable name="package">
+ <xsl:call-template name="package.name">
+ <xsl:with-param name="url" select="@url"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!-- Extract the directory for that package -->
+ <xsl:variable name="cut"
+ select="translate(substring-after($package, '-'),
+ '0123456789', '0000000000')"/>
+ <xsl:variable name="package2">
+ <xsl:value-of select="substring-before($package, '-')"/>
+ <xsl:text>-</xsl:text>
+ <xsl:value-of select="$cut"/>
+ </xsl:variable>
+ <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
+ <!-- Write the upstream URLs, except the redirected ones -->
+ <xsl:value-of select="@url"/>
+ <xsl:text> </xsl:text>
+ <xsl:text>&#x0a;</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="package.name">
+ <xsl:param name="url"/>
+ <xsl:choose>
+ <xsl:when test="contains($url, '/')">
+ <xsl:call-template name="package.name">
+ <xsl:with-param name="url" select="substring-after($url, '/')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="contains($url, '?')">
+ <xsl:value-of select="substring-before($url, '?')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$url"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+