source: common/urls.xsl@ 837362b

ablfs-more legacy trunk
Last change on this file since 837362b was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

  • Property mode set to 100644
File size: 5.3 KB
Line 
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
11 <!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
12 <xsl:param name="family">lfs</xsl:param>
13
14 <!-- The libc model used for HLFS -->
15 <xsl:param name="model" select="'glibc'"/>
16
17 <!-- The kernel series used for HLFS -->
18 <xsl:param name="kernel" select="'2.6'"/>
19
20 <!-- Do we use a package manager? -->
21 <xsl:param name="pkgmngt" select="'n'"/>
22
23 <!-- The system for LFS: sysv of systemd -->
24 <xsl:param name="revision" select="'sysv'"/>
25
26 <xsl:template match="/">
27 <xsl:apply-templates select="//varlistentry[@revision=$revision
28 or not(@revision)]//ulink"/>
29 <xsl:if test="$pkgmngt='y'">
30 <xsl:apply-templates
31 select="document('packageManager.xml')//ulink"/>
32 </xsl:if>
33 </xsl:template>
34
35 <xsl:template match="ulink">
36 <!-- If some package doesn't have the predefined strings in their
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
41 (ancestor::varlistentry[@vendor=$kernel]
42 or not(ancestor::varlistentry[@vendor])) and
43 (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
44 contains(@url, '.tgz') or contains(@url, '.patch') or
45 contains(@url, '.xz') or contains(@url, '.lzma')) and
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')"/>
63 <!-- Write the upstream URLs, fixing the redirected ones -->
64 <xsl:choose>
65 <xsl:when test="contains(@url,'?')">
66 <xsl:value-of select="substring-before(@url,'?')"/>
67 </xsl:when>
68 <xsl:otherwise>
69 <xsl:value-of select="@url"/>
70 </xsl:otherwise>
71 </xsl:choose>
72 <xsl:text> </xsl:text>
73 <!-- Write FTP mirror URLs -->
74 <xsl:value-of select="$server"/>
75 <xsl:text>/pub/</xsl:text>
76 <xsl:value-of select="$family"/>
77 <xsl:text>/conglomeration/</xsl:text>
78 <xsl:choose>
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. -->
82 <xsl:when test="contains($dirname, 'bash')">
83 <xsl:text>bash/</xsl:text>
84 </xsl:when>
85 <xsl:when test="contains($package, 'dvhtool')">
86 <xsl:text>dvhtool/</xsl:text>
87 </xsl:when>
88 <xsl:when test="contains($dirname, 'gcc')">
89 <xsl:text>gcc/</xsl:text>
90 </xsl:when>
91 <xsl:when test="contains($dirname, 'glibc')">
92 <xsl:text>glibc/</xsl:text>
93 </xsl:when>
94 <xsl:when test="contains($package, 'powerpc-utils')">
95 <xsl:text>powerpc-utils/</xsl:text>
96 </xsl:when>
97 <xsl:when test="contains($package, 'tcl')">
98 <xsl:text>tcl/</xsl:text>
99 </xsl:when>
100 <xsl:when test="contains($package, 'uClibc')">
101 <xsl:text>uClibc/</xsl:text>
102 </xsl:when>
103 <xsl:when test="contains($dirname, 'udev')">
104 <xsl:text>udev/</xsl:text>
105 </xsl:when>
106 <xsl:when test="contains($dirname, 'iputils')">
107 <xsl:text>iputils/</xsl:text>
108 </xsl:when>
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"/>
115 <!-- Write MD5SUM value -->
116 <xsl:text> </xsl:text>
117 <xsl:value-of select="../following-sibling::para/literal"/>
118 <xsl:text>&#x0a;</xsl:text>
119 </xsl:if>
120 </xsl:template>
121
122 <xsl:template name="package.name">
123 <xsl:param name="url"/>
124 <xsl:choose>
125 <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
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>
Note: See TracBrowser for help on using the repository browser.