source: common/urls.xsl@ aa283c0

ablfs-more legacy trunk
Last change on this file since aa283c0 was de57ef4, checked in by Pierre Labastie <pierre@…>, 8 years ago

Fix issue with clfs, when using
a tag in git, and not checking "Rebuild files": git pull fails because
the local repo is in "detached head" state.

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