source: BLFS/xsl/scripts.xsl@ 54380e5

new_features
Last change on this file since 54380e5 was 54380e5, checked in by Pierre Labastie <pierre@…>, 8 years ago

Allows to retrieve package from SRC_ARCHIVE, in case it is not already there

and is in archive. This should not happen in normal operation, but may happen
in func_install_blfs

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