source: common/urls.xsl@ 615ba88

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 615ba88 was 139c34e, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

HLFS: Select the proper kernel package for packages list and download.

  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[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 -->
17 <xsl:param name="model" select="glibc"/>
18
[139c34e]19 <!-- The kernel series used for HLFS -->
20 <xsl:param name="kernel" select="2.6"/>
21
[ebf8265]22 <xsl:template match="/">
23 <xsl:apply-templates select="//ulink"/>
24 </xsl:template>
25
26 <xsl:template match="ulink">
27 <!-- If some package don't have the predefined strings in their
28 name, the next test must be fixed to match it also. Skip possible
29 duplicated URLs due that may be splitted for PDF output -->
30 <xsl:if test="(ancestor::varlistentry[@condition=$model]
31 or not(ancestor::varlistentry[@condition])) and
[139c34e]32 (ancestor::varlistentry[@vendor=$kernel]
33 or not(ancestor::varlistentry[@vendor])) and
[37002ae]34 (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
35 contains(@url, '.tgz') or contains(@url, '.patch')) 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>
[ebf8265]96 <xsl:otherwise>
97 <xsl:value-of select="$dirname"/>
98 <xsl:text>/</xsl:text>
99 </xsl:otherwise>
100 </xsl:choose>
101 <xsl:value-of select="$package"/>
[26053c4]102 <!-- Write MD5SUM value -->
103 <xsl:text> </xsl:text>
[a3a1394]104 <xsl:value-of select="../..//para/literal"/>
[ebf8265]105 <xsl:text>&#x0a;</xsl:text>
106 </xsl:if>
107 </xsl:template>
108
109 <xsl:template name="package.name">
110 <xsl:param name="url"/>
111 <xsl:choose>
112 <xsl:when test="contains($url, '/')">
113 <xsl:call-template name="package.name">
114 <xsl:with-param name="url" select="substring-after($url, '/')"/>
115 </xsl:call-template>
116 </xsl:when>
117 <xsl:otherwise>
118 <xsl:choose>
119 <xsl:when test="contains($url, '?')">
120 <xsl:value-of select="substring-before($url, '?')"/>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:value-of select="$url"/>
124 </xsl:otherwise>
125 </xsl:choose>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:template>
129
130</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.