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