source: BLFS/xsl/scripts.xsl@ 9da16d9

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

Fix a bug in the blfs scripts, occuring when the pacakge is neither a
tarball nor a zip file: copy the package from $SRC_DIR to the xxx-build dir.
And in case they are needed, copy the additional files too.

  • Property mode set to 100644
File size: 20.7 KB
RevLine 
[e576789]1<?xml version="1.0"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:exsl="http://exslt.org/common"
5 extension-element-prefixes="exsl"
6 version="1.0">
7
[56178ba]8<!-- $Id$ -->
[e576789]9
10<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
11
[70d73d1]12<!-- Check whether the book is sysv or systemd -->
13 <xsl:variable name="rev">
14 <xsl:choose>
15 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
16 systemd
17 </xsl:when>
18 <xsl:otherwise>
19 sysv
20 </xsl:otherwise>
21 </xsl:choose>
22 </xsl:variable>
23
[e576789]24 <!-- Build as user (y) or as root (n)? -->
25 <xsl:param name="sudo" select="'y'"/>
26
27 <xsl:template match="/">
28 <xsl:apply-templates select="//sect1"/>
29 </xsl:template>
30
31<!--=================== Master chunks code ======================-->
32
33 <xsl:template match="sect1">
34
[70d73d1]35 <xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
[e576789]36 <!-- The file names -->
37 <xsl:variable name="filename" select="@id"/>
38
39 <!-- The build order -->
40 <xsl:variable name="position" select="position()"/>
41 <xsl:variable name="order">
42 <xsl:choose>
43 <xsl:when test="string-length($position) = 1">
44 <xsl:text>00</xsl:text>
45 <xsl:value-of select="$position"/>
46 </xsl:when>
47 <xsl:when test="string-length($position) = 2">
48 <xsl:text>0</xsl:text>
49 <xsl:value-of select="$position"/>
50 </xsl:when>
51 <xsl:otherwise>
52 <xsl:value-of select="$position"/>
53 </xsl:otherwise>
54 </xsl:choose>
55 </xsl:variable>
56
57 <!-- Depuration code -->
58 <xsl:message>
59 <xsl:text>SCRIPT is </xsl:text>
60 <xsl:value-of select="concat($order,'-z-',$filename)"/>
61 <xsl:text>&#xA; FTPDIR is </xsl:text>
62 <xsl:value-of select="$filename"/>
63 <xsl:text>&#xA;&#xA;</xsl:text>
64 </xsl:message>
65
66 <!-- Creating the scripts -->
67 <exsl:document href="{$order}-z-{$filename}" method="text">
68 <xsl:text>#!/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
69 <xsl:choose>
70 <!-- Package page -->
[642722f]71 <xsl:when test="sect2[@role='package']">
72 <!-- We build in a subdirectory -->
73 <xsl:text>PKG_DIR=</xsl:text>
[e576789]74 <xsl:value-of select="$filename"/>
[39dc04a]75 <xsl:text>
76SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
77BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
78mkdir -p $SRC_DIR
79mkdir -p $BUILD_DIR
80
81</xsl:text>
[e576789]82 <!-- Download code and build commands -->
83 <xsl:apply-templates select="sect2"/>
84 <!-- Clean-up -->
[39dc04a]85 <xsl:text>cd $BUILD_DIR
86[[ -n "$KEEP_FILES" ]] || </xsl:text>
[e576789]87 <!-- In some case, some files in the build tree are owned
88 by root -->
[642722f]89 <xsl:if test="$sudo='y'">
90 <xsl:text>sudo </xsl:text>
[e576789]91 </xsl:if>
[642722f]92 <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
[e576789]93 </xsl:when>
94 <!-- Non-package page -->
95 <xsl:otherwise>
96 <xsl:apply-templates select=".//screen"/>
97 </xsl:otherwise>
98 </xsl:choose>
99 <xsl:text>exit</xsl:text>
100 </exsl:document>
101 </xsl:if>
102 </xsl:template>
103
104<!--======================= Sub-sections code =======================-->
105
106 <xsl:template match="sect2">
107 <xsl:choose>
108 <xsl:when test="@role = 'package'">
[39dc04a]109 <xsl:text>cd $SRC_DIR
110</xsl:text>
[642722f]111 <!-- Download information is in bridgehead tags -->
[e576789]112 <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
113 <xsl:text>&#xA;</xsl:text>
114 </xsl:when>
[967b819]115 <xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
116 <xsl:apply-templates select=".//screen"/>
117 </xsl:when>
[e576789]118 <xsl:when test="@role = 'installation'">
119 <xsl:text>
[39dc04a]120cd $BUILD_DIR
[07f7eff]121find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
122 <xsl:if test="$sudo='y'">
123 <xsl:text>sudo </xsl:text>
124 </xsl:if>
125 <xsl:text>rm -rf
[67992a0]126case $PACKAGE in
[e6967a1]127 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
[39dc04a]128 tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
[6eaae5e]129 UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
130 ;;
131 *.tar.lz)
[39dc04a]132 bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
[6eaae5e]133 UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
[67992a0]134 ;;
135 *.zip)
[39dc04a]136 zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
[67992a0]137 UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
138 if test $(wc -w &lt;&lt;&lt; $UNPACKDIR) -eq 1; then
[39dc04a]139 unzip $SRC_DIR/$PACKAGE
[67992a0]140 else
141 UNPACKDIR=${PACKAGE%.zip}
[39dc04a]142 unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
[67992a0]143 fi
144 ;;
145 *)
146 UNPACKDIR=$PKG_DIR-build
147 mkdir $UNPACKDIR
[9da16d9]148 cp $SRC_DIR/$PACKAGE $UNPACKDIR
149 cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
[67992a0]150 ;;
151esac
152cd $UNPACKDIR&#xA;
153</xsl:text>
[e576789]154 <xsl:apply-templates select=".//screen | .//para/command"/>
155 <xsl:if test="$sudo = 'y'">
156 <xsl:text>sudo /sbin/</xsl:text>
157 </xsl:if>
158 <xsl:text>ldconfig&#xA;&#xA;</xsl:text>
159 </xsl:when>
160 <xsl:when test="@role = 'configuration'">
161 <xsl:apply-templates select=".//screen" mode="config"/>
162 </xsl:when>
163 </xsl:choose>
164 </xsl:template>
165
166<!--==================== Download code =======================-->
167
[642722f]168 <!-- template for extracting the filename from an url in the form:
169 proto://internet.name/dir1/.../dirn/filename?condition.
170 Needed, because substring-after(...,'/') returns only the
171 substring after the first '/'. -->
[e576789]172 <xsl:template name="package_name">
173 <xsl:param name="url" select="foo"/>
174 <xsl:param name="sub-url" select="substring-after($url,'/')"/>
175 <xsl:choose>
176 <xsl:when test="contains($sub-url,'/')">
177 <xsl:call-template name="package_name">
178 <xsl:with-param name="url" select="$sub-url"/>
179 </xsl:call-template>
180 </xsl:when>
181 <xsl:otherwise>
182 <xsl:choose>
183 <xsl:when test="contains($sub-url,'?')">
184 <xsl:value-of select="substring-before($sub-url,'?')"/>
185 </xsl:when>
186 <xsl:otherwise>
187 <xsl:value-of select="$sub-url"/>
188 </xsl:otherwise>
189 </xsl:choose>
190 </xsl:otherwise>
191 </xsl:choose>
192 </xsl:template>
193
[642722f]194 <!-- Generates the code to download a package, an additional package or
195 a patch. -->
196 <xsl:template name="download-file">
197 <xsl:param name="httpurl" select="''"/>
198 <xsl:param name="ftpurl" select="''"/>
199 <xsl:param name="md5" select="''"/>
200 <xsl:param name="varname" select="''"/>
201 <xsl:variable name="package">
202 <xsl:call-template name="package_name">
203 <xsl:with-param name="url">
[e576789]204 <xsl:choose>
[642722f]205 <xsl:when test="string-length($httpurl) &gt; 10">
206 <xsl:value-of select="$httpurl"/>
[e576789]207 </xsl:when>
208 <xsl:otherwise>
[642722f]209 <xsl:value-of select="$ftpurl"/>
[e576789]210 </xsl:otherwise>
211 </xsl:choose>
[642722f]212 </xsl:with-param>
213 </xsl:call-template>
214 </xsl:variable>
215 <xsl:variable name="first_letter"
216 select="translate(substring($package,1,1),
217 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
218 'abcdefghijklmnopqrstuvwxyz')"/>
219 <xsl:text>&#xA;</xsl:text>
220 <xsl:value-of select="$varname"/>
221 <xsl:text>=</xsl:text>
222 <xsl:value-of select="$package"/>
223 <xsl:text>&#xA;if [[ ! -f $</xsl:text>
224 <xsl:value-of select="$varname"/>
[8dc4646]225 <xsl:text> ]] ; then
226 if [[ -f $SRC_ARCHIVE/$</xsl:text>
[642722f]227 <xsl:value-of select="$varname"/>
228 <xsl:text> ]] ; then&#xA;</xsl:text>
229 <xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
230 <xsl:value-of select="$varname"/>
231 <xsl:text> $</xsl:text>
232 <xsl:value-of select="$varname"/>
[8dc4646]233 <xsl:text>
234 else&#xA;</xsl:text>
[342c862]235 <!-- Download from upstream http -->
[642722f]236 <xsl:if test="string-length($httpurl) &gt; 10">
[8dc4646]237 <xsl:text> wget -T 30 -t 5 </xsl:text>
[642722f]238 <xsl:value-of select="$httpurl"/>
[342c862]239 <xsl:text> ||&#xA;</xsl:text>
[642722f]240 </xsl:if>
[342c862]241 <!-- Download from upstream ftp -->
[642722f]242 <xsl:if test="string-length($ftpurl) &gt; 10">
[8dc4646]243 <xsl:text> wget -T 30 -t 5 </xsl:text>
[642722f]244 <xsl:value-of select="$ftpurl"/>
[342c862]245 <xsl:text> ||&#xA;</xsl:text>
[642722f]246 </xsl:if>
[342c862]247 <!-- The FTP_SERVER mirror as a last resort -->
[8dc4646]248 <xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
[342c862]249 <xsl:value-of select="$first_letter"/>
250 <xsl:text>/$</xsl:text>
251 <xsl:value-of select="$varname"/>
[8dc4646]252 <xsl:text><!--
253 cp $</xsl:text>
[642722f]254 <xsl:value-of select="$varname"/>
[8dc4646]255 <xsl:text> $SRC_ARCHIVE-->
256 fi
[e576789]257fi
258</xsl:text>
[642722f]259 <xsl:if test="string-length($md5) &gt; 10">
260 <xsl:text>echo "</xsl:text>
261 <xsl:value-of select="$md5"/>
262 <xsl:text>&#x20;&#x20;$</xsl:text>
263 <xsl:value-of select="$varname"/>
264 <xsl:text>" | md5sum -c -
[39dc04a]265</xsl:text>
266 </xsl:if>
267<!-- link additional packages into $BUILD_DIR, because they are supposed to
268 be there-->
269 <xsl:if test="string($varname) != 'PACKAGE'">
[8dc4646]270 <xsl:text>[[ "$SRC_DIR" != "$BUILD_DIR" ]] &amp;&amp; ln -sf $SRC_DIR/$</xsl:text>
[39dc04a]271 <xsl:value-of select="$varname"/>
272 <xsl:text> $BUILD_DIR
[e576789]273</xsl:text>
[642722f]274 </xsl:if>
275 </xsl:template>
276
277 <!-- Extract the MD5 sum information -->
278 <xsl:template match="para" mode="md5">
279 <xsl:choose>
280 <xsl:when test="contains(substring-after(string(),'sum: '),'&#xA;')">
281 <xsl:value-of select="substring-before(substring-after(string(),'sum: '),'&#xA;')"/>
[e576789]282 </xsl:when>
[642722f]283 <xsl:otherwise>
284 <xsl:value-of select="substring-after(string(),'sum: ')"/>
285 </xsl:otherwise>
[e576789]286 </xsl:choose>
287 </xsl:template>
288
[642722f]289 <!-- We have several templates itemizedlist, depending on whether we
290 expect the package information, or additional package(s) or patch(es)
291 information. Select the appropriate mode here. -->
292 <xsl:template match="bridgehead">
[e576789]293 <xsl:choose>
[642722f]294 <!-- Special case for Openjdk -->
295 <xsl:when test="contains(string(),'Source Package Information')">
296 <xsl:apply-templates
297 select="following-sibling::itemizedlist[1]//simplelist">
298 <xsl:with-param name="varname" select="'PACKAGE'"/>
299 </xsl:apply-templates>
300 <xsl:apply-templates select="following-sibling::itemizedlist
301 [preceding-sibling::bridgehead[1]=current()
302 and position() &gt;1]//simplelist">
303 <xsl:with-param name="varname" select="'PACKAGE1'"/>
304 </xsl:apply-templates>
[e576789]305 </xsl:when>
[642722f]306 <!-- Package information -->
307 <xsl:when test="contains(string(),'Package Information')">
308 <xsl:apply-templates select="following-sibling::itemizedlist
309 [preceding-sibling::bridgehead[1]=current()]"
310 mode="package"/>
[e576789]311 </xsl:when>
[642722f]312 <!-- Additional package information -->
[ba57e61]313 <!-- special case for llvm -->
314 <xsl:when test="contains(string(),'Optional Download')">
315 <xsl:apply-templates select="following-sibling::itemizedlist"
316 mode="additional"/>
317 </xsl:when>
318 <!-- All other additional packages have "Additional" -->
[642722f]319 <xsl:when test="contains(string(),'Additional')">
320 <xsl:apply-templates select="following-sibling::itemizedlist"
321 mode="additional"/>
[e576789]322 </xsl:when>
[642722f]323 <!-- Do not do anything if the dev has created another type of
324 bridgehead. -->
325 <xsl:otherwise/>
[e576789]326 </xsl:choose>
327 </xsl:template>
328
[642722f]329 <!-- Call the download code template with appropriate parameters -->
330 <xsl:template match="itemizedlist" mode="package">
331 <xsl:call-template name="download-file">
332 <xsl:with-param name="httpurl">
333 <xsl:value-of select="./listitem[1]/para/ulink/@url"/>
334 </xsl:with-param>
335 <xsl:with-param name="ftpurl">
336 <xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
337 </xsl:with-param>
338 <xsl:with-param name="md5">
339 <xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
340 mode="md5"/>
341 </xsl:with-param>
342 <xsl:with-param name="varname" select="'PACKAGE'"/>
343 </xsl:call-template>
[e576789]344 </xsl:template>
345
[642722f]346 <xsl:template match="itemizedlist" mode="additional">
347 <!-- The normal layout is "one listitem"<->"one url", but some devs
348 find amusing to have FTP and/or MD5sum listitems, or to
349 enclose the download information inside a simplelist tag... -->
350 <xsl:for-each select="listitem[.//ulink]">
351 <xsl:choose>
352 <!-- hopefully, there was a HTTP line before -->
353 <xsl:when test="contains(string(./para),'FTP')"/>
354 <xsl:when test=".//simplelist">
355 <xsl:apply-templates select=".//simplelist">
356 <xsl:with-param name="varname" select="'PACKAGE1'"/>
357 </xsl:apply-templates>
358 </xsl:when>
359 <xsl:otherwise>
360 <xsl:call-template name="download-file">
361 <xsl:with-param name="httpurl">
362 <xsl:value-of select="./para/ulink/@url"/>
363 </xsl:with-param>
364 <xsl:with-param name="ftpurl">
365 <xsl:value-of
366 select="following-sibling::listitem[1]/
367 para[contains(string(),'FTP')]/ulink/@url"/>
368 </xsl:with-param>
369 <xsl:with-param name="md5">
370 <xsl:apply-templates
371 select="following-sibling::listitem[position()&lt;3]/
372 para[contains(string(),'MD5')]"
373 mode="md5"/>
374 </xsl:with-param>
375 <xsl:with-param name="varname">
376 <xsl:choose>
377 <xsl:when test="contains(./para/ulink/@url,'.patch')">
378 <xsl:text>PATCH</xsl:text>
379 </xsl:when>
380 <xsl:otherwise>
381 <xsl:text>PACKAGE1</xsl:text>
382 </xsl:otherwise>
383 </xsl:choose>
384 </xsl:with-param>
385 </xsl:call-template>
386 </xsl:otherwise>
387 </xsl:choose>
388 </xsl:for-each>
[e576789]389 </xsl:template>
390
[642722f]391 <!-- the simplelist case. Hopefully, the layout is one member for
392 url, one for md5 and others for various information, that we do not
393 use -->
394 <xsl:template match="simplelist">
395 <xsl:param name="varname" select="'PACKAGE1'"/>
396 <xsl:call-template name="download-file">
397 <xsl:with-param name="httpurl" select=".//ulink/@url"/>
398 <xsl:with-param name="md5">
399 <xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
400 </xsl:with-param>
401 <xsl:with-param name="varname" select="$varname"/>
402 </xsl:call-template>
403 </xsl:template>
[e576789]404<!--======================== Commands code ==========================-->
405
406 <xsl:template match="screen">
407 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
408 <xsl:choose>
409 <xsl:when test="@role = 'root'">
410 <xsl:if test="$sudo = 'y'">
411 <xsl:text>sudo -E sh &lt;&lt; ROOT_EOF&#xA;</xsl:text>
412 </xsl:if>
413 <xsl:apply-templates mode="root"/>
414 <xsl:if test="$sudo = 'y'">
415 <xsl:text>&#xA;ROOT_EOF</xsl:text>
416 </xsl:if>
417 </xsl:when>
418 <xsl:otherwise>
419 <xsl:apply-templates select="userinput"/>
420 </xsl:otherwise>
421 </xsl:choose>
422 <xsl:text>&#xA;</xsl:text>
423 </xsl:if>
424 </xsl:template>
425
[70d73d1]426 <xsl:template name="set-bootpkg-dir">
427 <xsl:param name="bootpkg" select="'bootscripts'"/>
428 <xsl:param name="url" select="''"/>
429 <xsl:text>[[ ! -d $SRC_DIR/blfs-</xsl:text>
430 <xsl:copy-of select="$bootpkg"/>
431 <xsl:text> ]] &amp;&amp; mkdir $SRC_DIR/blfs-</xsl:text>
432 <xsl:copy-of select="$bootpkg"/>
433 <xsl:text>
434pushd $SRC_DIR/blfs-</xsl:text>
435 <xsl:copy-of select="$bootpkg"/>
436 <xsl:text>
[e576789]437URL=</xsl:text>
[70d73d1]438 <xsl:value-of select="$url"/>
439 <xsl:text>
[e576789]440BOOTPACKG=$(basename $URL)
[bbcdeab]441if [[ ! -f $BOOTPACKG ]] ; then
442 if [[ -f $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG ]] ; then
443 cp $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG $BOOTPACKG
444 elif [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
445 cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
446 else
447 wget -T 30 -t 5 $URL
448 cp $BOOTPACKG $SRC_ARCHIVE
449 fi
450 rm -f unpacked
451fi
452
[e576789]453if [[ -e unpacked ]] ; then
[f079f8f]454 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
455 if ! [[ -d $BOOTUNPACKDIR ]]; then
[e576789]456 rm unpacked
457 tar -xvf $BOOTPACKG > unpacked
[f079f8f]458 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]459 fi
460else
461 tar -xvf $BOOTPACKG > unpacked
[f079f8f]462 BOOTUNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
[e576789]463fi
[f079f8f]464cd $BOOTUNPACKDIR
[e576789]465</xsl:text>
[70d73d1]466 </xsl:template>
467
468 <xsl:template match="screen" mode="config">
469 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
470 <xsl:call-template name="set-bootpkg-dir">
471 <xsl:with-param name="bootpkg" select="'bootscripts'"/>
472 <xsl:with-param name="url"
473 select="id('bootscripts')//itemizedlist//ulink/@url"/>
474 </xsl:call-template>
475 </xsl:if>
476 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='systemd-units']">
477 <xsl:call-template name="set-bootpkg-dir">
478 <xsl:with-param name="bootpkg" select="'systemd-units'"/>
479 <xsl:with-param name="url"
480 select="id('systemd-units')//itemizedlist//ulink/@url"/>
481 </xsl:call-template>
[e576789]482 </xsl:if>
483 <xsl:apply-templates select='.'/>
[70d73d1]484 <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts' or
485 @linkend='systemd-units']">
[e576789]486 <xsl:text>
487popd</xsl:text>
488 </xsl:if>
489 <xsl:text>&#xA;</xsl:text>
490 </xsl:template>
491
492 <xsl:template match="para/command">
[a743e57]493 <xsl:variable name="ns" select="normalize-space(string())"/>
494 <xsl:if test="(contains($ns,'test') or
495 contains($ns,'check'))">
[e576789]496 <xsl:text>#</xsl:text>
[a743e57]497 <xsl:value-of select="substring-before($ns,'make ')"/>
[9c5ea2f]498 <xsl:text>make </xsl:text>
[a743e57]499 <xsl:if test="not(contains($ns,'-k'))">
[9c5ea2f]500 <xsl:text>-k </xsl:text>
501 </xsl:if>
[a743e57]502 <xsl:value-of select="substring-after($ns,'make ')"/>
[e576789]503 <xsl:text> || true&#xA;</xsl:text>
504 </xsl:if>
505 </xsl:template>
506
507 <xsl:template match="userinput">
508 <xsl:apply-templates/>
509 </xsl:template>
510
511 <xsl:template match="text()" mode="root">
512 <xsl:call-template name="output-root">
513 <xsl:with-param name="out-string" select="string()"/>
514 </xsl:call-template>
515 </xsl:template>
516
517 <xsl:template name="output-root">
518 <xsl:param name="out-string" select="''"/>
519 <xsl:choose>
[9c5ea2f]520 <xsl:when test="contains($out-string,'make ')">
[e576789]521 <xsl:call-template name="output-root">
522 <xsl:with-param name="out-string"
[9c5ea2f]523 select="substring-before($out-string,'make ')"/>
[e576789]524 </xsl:call-template>
[9c5ea2f]525 <xsl:text>make -j1 </xsl:text>
[e576789]526 <xsl:call-template name="output-root">
527 <xsl:with-param name="out-string"
[9c5ea2f]528 select="substring-after($out-string,'make ')"/>
[e576789]529 </xsl:call-template>
530 </xsl:when>
531 <xsl:when test="contains($out-string,'$') and $sudo = 'y'">
532 <xsl:call-template name="output-root">
533 <xsl:with-param name="out-string"
534 select="substring-before($out-string,'$')"/>
535 </xsl:call-template>
536 <xsl:text>\$</xsl:text>
537 <xsl:call-template name="output-root">
538 <xsl:with-param name="out-string"
539 select="substring-after($out-string,'$')"/>
540 </xsl:call-template>
541 </xsl:when>
542 <xsl:when test="contains($out-string,'`') and $sudo = 'y'">
543 <xsl:call-template name="output-root">
544 <xsl:with-param name="out-string"
545 select="substring-before($out-string,'`')"/>
546 </xsl:call-template>
547 <xsl:text>\`</xsl:text>
548 <xsl:call-template name="output-root">
549 <xsl:with-param name="out-string"
550 select="substring-after($out-string,'`')"/>
551 </xsl:call-template>
552 </xsl:when>
553 <xsl:when test="contains($out-string,'\') and $sudo = 'y'">
554 <xsl:call-template name="output-root">
555 <xsl:with-param name="out-string"
556 select="substring-before($out-string,'\')"/>
557 </xsl:call-template>
558 <xsl:text>\\</xsl:text>
559 <xsl:call-template name="output-root">
560 <xsl:with-param name="out-string"
561 select="substring-after($out-string,'\')"/>
562 </xsl:call-template>
563 </xsl:when>
564 <xsl:otherwise>
565 <xsl:value-of select="$out-string"/>
566 </xsl:otherwise>
567 </xsl:choose>
568 </xsl:template>
569
570 <xsl:template match="replaceable">
571 <xsl:text>**EDITME</xsl:text>
572 <xsl:apply-templates/>
573 <xsl:text>EDITME**</xsl:text>
574 </xsl:template>
575
576 <xsl:template match="replaceable" mode="root">
577 <xsl:text>**EDITME</xsl:text>
578 <xsl:apply-templates/>
579 <xsl:text>EDITME**</xsl:text>
580 </xsl:template>
581
582</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.