source: common/urls.xsl@ 9b99ada

ablfs-more trunk
Last change on this file since 9b99ada 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
RevLine 
[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
[0fa52f2]11 <!-- The book family (lfs only now). Needed to use the proper FTP path. -->
12 <!-- TODO not needed, remove -->
[a9ca77f]13 <xsl:param name="family">lfs</xsl:param>
14
[7072e1f]15 <!-- Do we use a package manager? -->
[c9598f2]16 <xsl:param name="pkgmngt" select="'n'"/>
17
18 <!-- The system for LFS: sysv of systemd -->
19 <xsl:param name="revision" select="'sysv'"/>
[7072e1f]20
[ebf8265]21 <xsl:template match="/">
[c9598f2]22 <xsl:apply-templates select="//varlistentry[@revision=$revision
23 or not(@revision)]//ulink"/>
[7072e1f]24 <xsl:if test="$pkgmngt='y'">
25 <xsl:apply-templates
26 select="document('packageManager.xml')//ulink"/>
27 </xsl:if>
[ebf8265]28 </xsl:template>
29
30 <xsl:template match="ulink">
[7072e1f]31 <!-- If some package doesn't have the predefined strings in their
[ebf8265]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 -->
[978286a]34 <xsl:if test="(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
[a7e1348]35 contains(@url, '.tgz') or contains(@url, '.patch') or
[038678f]36 contains(@url, '.xz') or contains(@url, '.lzma')) and
[ebf8265]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')"/>
[f221c2c]54 <!-- Write the upstream URLs, fixing the redirected ones -->
[26053c4]55 <xsl:choose>
56 <xsl:when test="contains(@url,'?')">
[f221c2c]57 <xsl:value-of select="substring-before(@url,'?')"/>
[26053c4]58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:value-of select="@url"/>
61 </xsl:otherwise>
62 </xsl:choose>
[15cad16]63 <xsl:text> </xsl:text>
[26053c4]64 <!-- Write FTP mirror URLs -->
[ebf8265]65 <xsl:value-of select="$server"/>
[a9ca77f]66 <xsl:text>/pub/</xsl:text>
67 <xsl:value-of select="$family"/>
68 <xsl:text>/conglomeration/</xsl:text>
[ebf8265]69 <xsl:choose>
[046d5c3]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. -->
[e071571]73 <xsl:when test="contains($dirname, 'bash')">
[ebf8265]74 <xsl:text>bash/</xsl:text>
75 </xsl:when>
[9be4494]76 <xsl:when test="contains($package, 'dvhtool')">
77 <xsl:text>dvhtool/</xsl:text>
78 </xsl:when>
[e071571]79 <xsl:when test="contains($dirname, 'gcc')">
[c03b616]80 <xsl:text>gcc/</xsl:text>
81 </xsl:when>
[e071571]82 <xsl:when test="contains($dirname, 'glibc')">
[7453f74]83 <xsl:text>glibc/</xsl:text>
84 </xsl:when>
[046d5c3]85 <xsl:when test="contains($package, 'powerpc-utils')">
86 <xsl:text>powerpc-utils/</xsl:text>
87 </xsl:when>
[4887f67]88 <xsl:when test="contains($package, 'tcl')">
[7453f74]89 <xsl:text>tcl/</xsl:text>
90 </xsl:when>
[a9ca77f]91 <xsl:when test="contains($package, 'uClibc')">
[c03b616]92 <xsl:text>uClibc/</xsl:text>
93 </xsl:when>
[e071571]94 <xsl:when test="contains($dirname, 'udev')">
[ee5e8f0]95 <xsl:text>udev/</xsl:text>
96 </xsl:when>
[de57ef4]97 <xsl:when test="contains($dirname, 'iputils')">
98 <xsl:text>iputils/</xsl:text>
99 </xsl:when>
[ebf8265]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"/>
[26053c4]106 <!-- Write MD5SUM value -->
107 <xsl:text> </xsl:text>
[56d8426]108 <xsl:value-of select="../following-sibling::para/literal"/>
[ebf8265]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>
[719d0fc]116 <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
[ebf8265]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.