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