source: stylesheets/patcheslist.xsl@ 47be4efc

11.0 qt5new trunk
Last change on this file since 47be4efc was 47be4efc, checked in by Xi Ruoyao <xry111@…>, 4 months ago

xsl: fix path in copy-blfs-patches.sh

  • Property mode set to 100644
File size: 3.7 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6
7<!--
8 This stylesheet creates a script to copy the patches referenced
9 in the BLFS book from the patches repository to the blfs
10 download area. It is very specific to the installation on
11 the home server.
12-->
13
14<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
15 version="1.0">
16
17 <xsl:output method="text"/>
18
19 <!-- Allow select the dest dir at runtime -->
20 <xsl:param name="dest.dir">
21 <xsl:value-of select="concat('/srv/www/', substring-after('&patch-root;', 'https://'))"/>
22 </xsl:param>
23
24 <xsl:template match="/">
25 <xsl:text>#! /bin/bash&#x0a;&#x0a;</xsl:text>
26 <xsl:text>function copy
27{
28 cp $1 $2 >>copyerrs 2>&amp;1
29}&#x0a;&#x0a;</xsl:text>
30 <!-- Create dest.dir if it don't exist -->
31 <xsl:text>mkdir -p </xsl:text>
32 <xsl:value-of select="$dest.dir"/>
33 <xsl:text> &amp;&amp;&#x0a;</xsl:text>
34 <xsl:text>cd </xsl:text>
35 <xsl:value-of select="$dest.dir"/>
36 <xsl:text> &amp;&amp;&#x0a;&#x0a;</xsl:text>
37 <!-- Remove old patches and possible list of missing patches-->
38 <xsl:text>rm -f *.patch copyerrs &amp;&amp;&#x0a;&#x0a;</xsl:text>
39 <xsl:apply-templates/>
40 <!-- Ensure correct ownership -->
41 <xsl:text>&#x0a;chgrp lfswww *.patch &amp;&amp;&#x0a;</xsl:text>
42 <xsl:text>if [ `wc -l copyerrs|sed 's/ *//' |cut -f1 -d' '` -gt 0 ]; then
43 mail -s "Missing BLFS patches" blfs-book@linuxfromscratch.org &lt; copyerrs
44fi</xsl:text>
45 <xsl:text>&#x0a;exit&#x0a;</xsl:text>
46 </xsl:template>
47
48 <xsl:template match="//text()"/>
49
50 <xsl:template match="//ulink">
51 <!-- Match only local patches links and skip duplicated URLs splitted for PDF output-->
52 <xsl:if test="contains(@url, '.patch') and contains(@url, '&patch-root;')
53 and not(ancestor-or-self::*/@condition = 'pdf')">
54 <xsl:variable name="patch.name" select="substring-after(@url, '&patch-root;')"/>
55 <xsl:text>copy /srv/www/www.linuxfromscratch.org/patches/downloads</xsl:text>
56 <xsl:choose>
57 <!-- cdparanoia -->
58 <xsl:when test="contains($patch.name, '-III')">
59 <xsl:text>/cdparanoia</xsl:text>
60 </xsl:when>
61 <!-- Open Office -->
62 <xsl:when test="contains($patch.name, 'OOo')">
63 <xsl:text>/OOo</xsl:text>
64 </xsl:when>
65 <!-- QT -->
66 <xsl:when test="contains($patch.name, 'qt-x')">
67 <xsl:text>/qt</xsl:text>
68 </xsl:when>
69 <!-- XOrg -->
70 <xsl:when test="contains($patch.name, 'X11R6')">
71 <xsl:text>/xorg</xsl:text>
72 </xsl:when>
73 <!-- net-tools -->
74 <xsl:when test="contains($patch.name, 'net-tools')">
75 <xsl:text>/net-tools</xsl:text>
76 </xsl:when>
77 <!-- junit -->
78 <xsl:when test="contains($patch.name, 'junit')">
79 <xsl:text>/junit</xsl:text>
80 </xsl:when>
81 <!-- x265 -->
82 <xsl:when test="contains($patch.name, 'x265')">
83 <xsl:text>/x265</xsl:text>
84 </xsl:when>
85 <!-- General rule -->
86 <xsl:otherwise>
87 <xsl:variable name="cut"
88 select="translate(substring-after($patch.name, '-'), '0123456789', '0000000000')"/>
89 <xsl:variable name="patch.name2">
90 <xsl:value-of select="substring-before($patch.name, '-')"/>
91 <xsl:text>-</xsl:text>
92 <xsl:value-of select="$cut"/>
93 </xsl:variable>
94 <xsl:value-of select="substring-before($patch.name2, '-0')"/>
95 </xsl:otherwise>
96 </xsl:choose>
97 <xsl:value-of select="$patch.name"/>
98 <xsl:text> . &#x0a;</xsl:text>
99 </xsl:if>
100 </xsl:template>
101
102</xsl:stylesheet>
103
Note: See TracBrowser for help on using the repository browser.