source: common/urls.xsl@ 1cb4c76

ablfs-more legacy trunk
Last change on this file since 1cb4c76 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
RevLine 
[ebf8265]1<?xml version='1.0' encoding='ISO-8859-1'?>
2
[ca4c634]3<!-- $Id$ -->
4
[ebf8265]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
[a9ca77f]13 <!-- The book family (lfs or clfs). Needed to use the proper FTP path. -->
14 <xsl:param name="family">lfs</xsl:param>
15
[ebf8265]16 <!-- The libc model used for HLFS -->
[c9598f2]17 <xsl:param name="model" select="'glibc'"/>
[ebf8265]18
[139c34e]19 <!-- The kernel series used for HLFS -->
[c9598f2]20 <xsl:param name="kernel" select="'2.6'"/>
[139c34e]21
[7072e1f]22 <!-- Do we use a package manager? -->
[c9598f2]23 <xsl:param name="pkgmngt" select="'n'"/>
24
25 <!-- The system for LFS: sysv of systemd -->
26 <xsl:param name="revision" select="'sysv'"/>
[7072e1f]27
[ebf8265]28 <xsl:template match="/">
[c9598f2]29 <xsl:apply-templates select="//varlistentry[@revision=$revision
30 or not(@revision)]//ulink"/>
[7072e1f]31 <xsl:if test="$pkgmngt='y'">
32 <xsl:apply-templates
33 select="document('packageManager.xml')//ulink"/>
34 </xsl:if>
[ebf8265]35 </xsl:template>
36
37 <xsl:template match="ulink">
[7072e1f]38 <!-- If some package doesn't have the predefined strings in their
[ebf8265]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
[139c34e]43 (ancestor::varlistentry[@vendor=$kernel]
44 or not(ancestor::varlistentry[@vendor])) and
[37002ae]45 (contains(@url, '.bz2') or contains(@url, '.tar.gz') or
[a7e1348]46 contains(@url, '.tgz') or contains(@url, '.patch') or
[038678f]47 contains(@url, '.xz') or contains(@url, '.lzma')) and
[ebf8265]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')"/>
[f221c2c]65 <!-- Write the upstream URLs, fixing the redirected ones -->
[26053c4]66 <xsl:choose>
67 <xsl:when test="contains(@url,'?')">
[f221c2c]68 <xsl:value-of select="substring-before(@url,'?')"/>
[26053c4]69 </xsl:when>
70 <xsl:otherwise>
71 <xsl:value-of select="@url"/>
72 </xsl:otherwise>
73 </xsl:choose>
[15cad16]74 <xsl:text> </xsl:text>
[26053c4]75 <!-- Write FTP mirror URLs -->
[ebf8265]76 <xsl:value-of select="$server"/>
[a9ca77f]77 <xsl:text>/pub/</xsl:text>
78 <xsl:value-of select="$family"/>
79 <xsl:text>/conglomeration/</xsl:text>
[ebf8265]80 <xsl:choose>
[046d5c3]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. -->
[e071571]84 <xsl:when test="contains($dirname, 'bash')">
[ebf8265]85 <xsl:text>bash/</xsl:text>
86 </xsl:when>
[9be4494]87 <xsl:when test="contains($package, 'dvhtool')">
88 <xsl:text>dvhtool/</xsl:text>
89 </xsl:when>
[e071571]90 <xsl:when test="contains($dirname, 'gcc')">
[c03b616]91 <xsl:text>gcc/</xsl:text>
92 </xsl:when>
[e071571]93 <xsl:when test="contains($dirname, 'glibc')">
[7453f74]94 <xsl:text>glibc/</xsl:text>
95 </xsl:when>
[046d5c3]96 <xsl:when test="contains($package, 'powerpc-utils')">
97 <xsl:text>powerpc-utils/</xsl:text>
98 </xsl:when>
[4887f67]99 <xsl:when test="contains($package, 'tcl')">
[7453f74]100 <xsl:text>tcl/</xsl:text>
101 </xsl:when>
[a9ca77f]102 <xsl:when test="contains($package, 'uClibc')">
[c03b616]103 <xsl:text>uClibc/</xsl:text>
104 </xsl:when>
[e071571]105 <xsl:when test="contains($dirname, 'udev')">
[ee5e8f0]106 <xsl:text>udev/</xsl:text>
107 </xsl:when>
[de57ef4]108 <xsl:when test="contains($dirname, 'iputils')">
109 <xsl:text>iputils/</xsl:text>
110 </xsl:when>
[ebf8265]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"/>
[26053c4]117 <!-- Write MD5SUM value -->
118 <xsl:text> </xsl:text>
[56d8426]119 <xsl:value-of select="../following-sibling::para/literal"/>
[ebf8265]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>
[719d0fc]127 <xsl:when test="contains($url, '/') and not (substring-after($url,'/')='')">
[ebf8265]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.