source: common/urls.xsl@ 061d54f

2.4 ablfs-more legacy trunk
Last change on this file since 061d54f was 56d8426, checked in by Pierre Labastie <pierre@…>, 10 years ago

Fix 2 minor bugs:

  • the tzdata DESTDIR should not be tzdata, because some package managers use

$PACKAGE as their working directory, and this may conflicts with this one.
tzdata DESTDIR is now 001-tzdata

  • when reading md5sums, the current code assumes that there is only one

<para><literal> node reachable from ../.. (relative to <ulink>). This is true
for the "official" book, but not necessarily for the snippets written for
package management. The following change only assumes that the md5sum
<para><literal> for a given <ulink> is the first one after <para><ulink>,
which does not change anything for the book, and is better for user
written snippets.

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