source: common/urls.xsl@ 3e82b0b

ablfs-more trunk
Last change on this file since 3e82b0b was 0fa52f2, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove legacy: Remove almost all occurrences of CLFS/clfs

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