source: common/urls.xsl@ 4c36783

ablfs-more trunk
Last change on this file since 4c36783 was 978286a, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove legacy: remove everything about HLFS

  • 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 or clfs). Needed to use the proper FTP path. -->
12 <xsl:param name="family">lfs</xsl:param>
13
14 <!-- Do we use a package manager? -->
15 <xsl:param name="pkgmngt" select="'n'"/>
16
17 <!-- The system for LFS: sysv of systemd -->
18 <xsl:param name="revision" select="'sysv'"/>
19
20 <xsl:template match="/">
21 <xsl:apply-templates select="//varlistentry[@revision=$revision
22 or not(@revision)]//ulink"/>
23 <xsl:if test="$pkgmngt='y'">
24 <xsl:apply-templates
25 select="document('packageManager.xml')//ulink"/>
26 </xsl:if>
27 </xsl:template>
28
29 <xsl:template match="ulink">
30 <!-- If some package doesn't have the predefined strings in their
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 -->
33 <xsl:if test="(contains(@url, '.bz2') or contains(@url, '.tar.gz') or
34 contains(@url, '.tgz') or contains(@url, '.patch') or
35 contains(@url, '.xz') or contains(@url, '.lzma')) and
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')"/>
53 <!-- Write the upstream URLs, fixing the redirected ones -->
54 <xsl:choose>
55 <xsl:when test="contains(@url,'?')">
56 <xsl:value-of select="substring-before(@url,'?')"/>
57 </xsl:when>
58 <xsl:otherwise>
59 <xsl:value-of select="@url"/>
60 </xsl:otherwise>
61 </xsl:choose>
62 <xsl:text> </xsl:text>
63 <!-- Write FTP mirror URLs -->
64 <xsl:value-of select="$server"/>
65 <xsl:text>/pub/</xsl:text>
66 <xsl:value-of select="$family"/>
67 <xsl:text>/conglomeration/</xsl:text>
68 <xsl:choose>
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. -->
72 <xsl:when test="contains($dirname, 'bash')">
73 <xsl:text>bash/</xsl:text>
74 </xsl:when>
75 <xsl:when test="contains($package, 'dvhtool')">
76 <xsl:text>dvhtool/</xsl:text>
77 </xsl:when>
78 <xsl:when test="contains($dirname, 'gcc')">
79 <xsl:text>gcc/</xsl:text>
80 </xsl:when>
81 <xsl:when test="contains($dirname, 'glibc')">
82 <xsl:text>glibc/</xsl:text>
83 </xsl:when>
84 <xsl:when test="contains($package, 'powerpc-utils')">
85 <xsl:text>powerpc-utils/</xsl:text>
86 </xsl:when>
87 <xsl:when test="contains($package, 'tcl')">
88 <xsl:text>tcl/</xsl:text>
89 </xsl:when>
90 <xsl:when test="contains($package, 'uClibc')">
91 <xsl:text>uClibc/</xsl:text>
92 </xsl:when>
93 <xsl:when test="contains($dirname, 'udev')">
94 <xsl:text>udev/</xsl:text>
95 </xsl:when>
96 <xsl:when test="contains($dirname, 'iputils')">
97 <xsl:text>iputils/</xsl:text>
98 </xsl:when>
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"/>
105 <!-- Write MD5SUM value -->
106 <xsl:text> </xsl:text>
107 <xsl:value-of select="../following-sibling::para/literal"/>
108 <xsl:text>&#x0a;</xsl:text>
109 </xsl:if>
110 </xsl:template>
111
112 <xsl:template name="package.name">
113 <xsl:param name="url"/>
114 <xsl:choose>
115 <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
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>
Note: See TracBrowser for help on using the repository browser.