[ebf8265] | 1 | <?xml version='1.0' encoding='ISO-8859-1'?>
|
---|
| 2 |
|
---|
[ca4c634] | 3 | <!-- $Id$ -->
|
---|
| 4 |
|
---|
[ebf8265] | 5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 6 | version="1.0">
|
---|
| 7 |
|
---|
| 8 | <xsl:output method="text"/>
|
---|
| 9 |
|
---|
| 10 | <!-- The FTP server used as fallback -->
|
---|
| 11 | <xsl:param name="server">ftp://ftp.osuosl.org</xsl:param>
|
---|
| 12 |
|
---|
[a9ca77f] | 13 | <!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
|
---|
| 14 | <xsl:param name="family">lfs</xsl:param>
|
---|
| 15 |
|
---|
[ebf8265] | 16 | <!-- The libc model used for HLFS -->
|
---|
[7bd0866] | 17 | <xsl:param name="model" select="'glibc'"/>
|
---|
[ebf8265] | 18 |
|
---|
[139c34e] | 19 | <!-- The kernel series used for HLFS -->
|
---|
[7bd0866] | 20 | <xsl:param name="kernel" select="'2.6'"/>
|
---|
[139c34e] | 21 |
|
---|
[7072e1f] | 22 | <!-- Do we use a package manager? -->
|
---|
[7bd0866] | 23 | <xsl:param name="pkgmngt" select="'n'"/>
|
---|
| 24 |
|
---|
| 25 | <!-- The system for LFS: sysv of systemd -->
|
---|
| 26 | <xsl:param name="revision" select="'sysv'"/>
|
---|
[7072e1f] | 27 |
|
---|
[ebf8265] | 28 | <xsl:template match="/">
|
---|
[7bd0866] | 29 | <xsl:apply-templates select="//varlistentry[@revision=$revision
|
---|
| 30 | or not(@revision)]//ulink"/>
|
---|
[7072e1f] | 31 | <xsl:if test="$pkgmngt='y'">
|
---|
| 32 | <xsl:apply-templates
|
---|
| 33 | select="document('packageManager.xml')//ulink"/>
|
---|
| 34 | </xsl:if>
|
---|
[ebf8265] | 35 | </xsl:template>
|
---|
| 36 |
|
---|
| 37 | <xsl:template match="ulink">
|
---|
[7072e1f] | 38 | <!-- If some package doesn't have the predefined strings in their
|
---|
[ebf8265] | 39 | name, the next test must be fixed to match it also. Skip possible
|
---|
| 40 | duplicated URLs due that may be splitted for PDF output -->
|
---|
| 41 | <xsl:if test="(ancestor::varlistentry[@condition=$model]
|
---|
| 42 | or not(ancestor::varlistentry[@condition])) and
|
---|
[139c34e] | 43 | (ancestor::varlistentry[@vendor=$kernel]
|
---|
| 44 | or not(ancestor::varlistentry[@vendor])) and
|
---|
[37002ae] | 45 | (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
|
---|
[a7e1348] | 46 | contains(@url, '.tgz') or contains(@url, '.patch') or
|
---|
[038678f] | 47 | contains(@url, '.xz') or contains(@url, '.lzma')) and
|
---|
[ebf8265] | 48 | not(ancestor-or-self::*/@condition = 'pdf')">
|
---|
| 49 | <!-- Extract the package name -->
|
---|
| 50 | <xsl:variable name="package">
|
---|
| 51 | <xsl:call-template name="package.name">
|
---|
| 52 | <xsl:with-param name="url" select="@url"/>
|
---|
| 53 | </xsl:call-template>
|
---|
| 54 | </xsl:variable>
|
---|
| 55 | <!-- Extract the directory for that package -->
|
---|
| 56 | <xsl:variable name="cut"
|
---|
| 57 | select="translate(substring-after($package, '-'),
|
---|
| 58 | '0123456789', '0000000000')"/>
|
---|
| 59 | <xsl:variable name="package2">
|
---|
| 60 | <xsl:value-of select="substring-before($package, '-')"/>
|
---|
| 61 | <xsl:text>-</xsl:text>
|
---|
| 62 | <xsl:value-of select="$cut"/>
|
---|
| 63 | </xsl:variable>
|
---|
| 64 | <xsl:variable name="dirname" select="substring-before($package2, '-0')"/>
|
---|
[f221c2c] | 65 | <!-- Write the upstream URLs, fixing the redirected ones -->
|
---|
[26053c4] | 66 | <xsl:choose>
|
---|
| 67 | <xsl:when test="contains(@url,'?')">
|
---|
[f221c2c] | 68 | <xsl:value-of select="substring-before(@url,'?')"/>
|
---|
[26053c4] | 69 | </xsl:when>
|
---|
| 70 | <xsl:otherwise>
|
---|
| 71 | <xsl:value-of select="@url"/>
|
---|
| 72 | </xsl:otherwise>
|
---|
| 73 | </xsl:choose>
|
---|
[15cad16] | 74 | <xsl:text> </xsl:text>
|
---|
[26053c4] | 75 | <!-- Write FTP mirror URLs -->
|
---|
[ebf8265] | 76 | <xsl:value-of select="$server"/>
|
---|
[a9ca77f] | 77 | <xsl:text>/pub/</xsl:text>
|
---|
| 78 | <xsl:value-of select="$family"/>
|
---|
| 79 | <xsl:text>/conglomeration/</xsl:text>
|
---|
[ebf8265] | 80 | <xsl:choose>
|
---|
[046d5c3] | 81 | <!-- Fix some directories. Test against $dirname to be sure that we
|
---|
| 82 | are matching the start of a package name, not a string in a patch name
|
---|
| 83 | But some packages requires test against $package. -->
|
---|
[e071571] | 84 | <xsl:when test="contains($dirname, 'bash')">
|
---|
[ebf8265] | 85 | <xsl:text>bash/</xsl:text>
|
---|
| 86 | </xsl:when>
|
---|
[9be4494] | 87 | <xsl:when test="contains($package, 'dvhtool')">
|
---|
| 88 | <xsl:text>dvhtool/</xsl:text>
|
---|
| 89 | </xsl:when>
|
---|
[e071571] | 90 | <xsl:when test="contains($dirname, 'gcc')">
|
---|
[c03b616] | 91 | <xsl:text>gcc/</xsl:text>
|
---|
| 92 | </xsl:when>
|
---|
[e071571] | 93 | <xsl:when test="contains($dirname, 'glibc')">
|
---|
[7453f74] | 94 | <xsl:text>glibc/</xsl:text>
|
---|
| 95 | </xsl:when>
|
---|
[046d5c3] | 96 | <xsl:when test="contains($package, 'powerpc-utils')">
|
---|
| 97 | <xsl:text>powerpc-utils/</xsl:text>
|
---|
| 98 | </xsl:when>
|
---|
[4887f67] | 99 | <xsl:when test="contains($package, 'tcl')">
|
---|
[7453f74] | 100 | <xsl:text>tcl/</xsl:text>
|
---|
| 101 | </xsl:when>
|
---|
[a9ca77f] | 102 | <xsl:when test="contains($package, 'uClibc')">
|
---|
[c03b616] | 103 | <xsl:text>uClibc/</xsl:text>
|
---|
| 104 | </xsl:when>
|
---|
[e071571] | 105 | <xsl:when test="contains($dirname, 'udev')">
|
---|
[ee5e8f0] | 106 | <xsl:text>udev/</xsl:text>
|
---|
| 107 | </xsl:when>
|
---|
[ebf8265] | 108 | <xsl:otherwise>
|
---|
| 109 | <xsl:value-of select="$dirname"/>
|
---|
| 110 | <xsl:text>/</xsl:text>
|
---|
| 111 | </xsl:otherwise>
|
---|
| 112 | </xsl:choose>
|
---|
| 113 | <xsl:value-of select="$package"/>
|
---|
[26053c4] | 114 | <!-- Write MD5SUM value -->
|
---|
| 115 | <xsl:text> </xsl:text>
|
---|
[56d8426] | 116 | <xsl:value-of select="../following-sibling::para/literal"/>
|
---|
[ebf8265] | 117 | <xsl:text>
</xsl:text>
|
---|
| 118 | </xsl:if>
|
---|
| 119 | </xsl:template>
|
---|
| 120 |
|
---|
| 121 | <xsl:template name="package.name">
|
---|
| 122 | <xsl:param name="url"/>
|
---|
| 123 | <xsl:choose>
|
---|
[719d0fc] | 124 | <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
|
---|
[ebf8265] | 125 | <xsl:call-template name="package.name">
|
---|
| 126 | <xsl:with-param name="url" select="substring-after($url, '/')"/>
|
---|
| 127 | </xsl:call-template>
|
---|
| 128 | </xsl:when>
|
---|
| 129 | <xsl:otherwise>
|
---|
| 130 | <xsl:choose>
|
---|
| 131 | <xsl:when test="contains($url, '?')">
|
---|
| 132 | <xsl:value-of select="substring-before($url, '?')"/>
|
---|
| 133 | </xsl:when>
|
---|
| 134 | <xsl:otherwise>
|
---|
| 135 | <xsl:value-of select="$url"/>
|
---|
| 136 | </xsl:otherwise>
|
---|
| 137 | </xsl:choose>
|
---|
| 138 | </xsl:otherwise>
|
---|
| 139 | </xsl:choose>
|
---|
| 140 | </xsl:template>
|
---|
| 141 |
|
---|
| 142 | </xsl:stylesheet>
|
---|