source: BLFS/xsl/make_book.xsl@ 280cff6a

ablfs-more trunk
Last change on this file since 280cff6a was d4a6891, checked in by Pierre Labastie <pierre.labastie@…>, 13 months ago

compound packages: some subpackages are not built

some subpackage names contain digits (for example libX11), but
we test that the tarball name with digits replaced with "X"
contain $package-X. The problem is that the digits have been
replaced in the whole tarball name, and don't match $package.
So translate
$package too. Note that there is no problem if some
packages have names only differing with digits, since
we are sure that the tarball name contain "$package-".
We just want to rule out the case when what comes after
$package- is not a version string.

  • Property mode set to 100644
File size: 30.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version="1.0">
5
6 <xsl:param name="list" select="''"/>
7 <xsl:param name="MTA" select="'sendmail'"/>
8 <xsl:param name="lfsbook" select="'lfs-full.xml'"/>
9
10<!-- Check whether the book is sysv or systemd -->
11 <xsl:variable name="rev">
12 <xsl:choose>
13 <xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
14 <xsl:text>systemd</xsl:text>
15 </xsl:when>
16 <xsl:otherwise>
17 <xsl:text>sysv</xsl:text>
18 </xsl:otherwise>
19 </xsl:choose>
20 </xsl:variable>
21
22 <xsl:output
23 method="xml"
24 encoding="ISO-8859-1"
25 doctype-system="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"/>
26
27 <xsl:include href="lfs_make_book.xsl"/>
28
29 <xsl:template match="/">
30 <book>
31 <xsl:copy-of select="/book/bookinfo"/>
32 <preface>
33 <?dbhtml filename="preface.html"?>
34 <title>Preface</title>
35 <xsl:choose>
36 <xsl:when test="$rev='sysv'">
37 <xsl:copy-of select="id('bootscripts')"/>
38 </xsl:when>
39 <xsl:otherwise>
40 <xsl:copy-of select="id('systemd-units')"/>
41 </xsl:otherwise>
42 </xsl:choose>
43 </preface>
44 <chapter>
45 <?dbhtml filename="chapter.html"?>
46 <title>Installing packages in dependency build order</title>
47 <xsl:call-template name="apply-list">
48 <xsl:with-param name="list" select="normalize-space($list)"/>
49 </xsl:call-template>
50 </chapter>
51 <xsl:copy-of select="id('CC')"/>
52 <xsl:copy-of select="id('MIT')"/>
53 <index/>
54 </book>
55 </xsl:template>
56
57<!-- apply-templates for each item in the list.
58 Normally, those items are id of nodes.
59 Those nodes can be sect1 (normal case),
60 sect2 (python/perl modules/dependencies )
61 The templates after this one treat each of those cases.
62 However, some items are sub-packages of compound packages (xorg7-*,
63 kf5, plasma), and not id.
64 We need special instructions in that case.
65 The difficulty is that some of those names *are* id's,
66 because they are referenced in the index.
67 Hopefully, none of those id's are sect{1,2}...-->
68 <xsl:template name="apply-list">
69 <xsl:param name="list" select="''"/>
70 <xsl:if test="string-length($list) &gt; 0">
71 <xsl:choose>
72 <!-- iterate if there are several packages in list -->
73 <xsl:when test="contains($list,' ')">
74 <xsl:call-template name="apply-list">
75 <xsl:with-param name="list"
76 select="substring-before($list,' ')"/>
77 </xsl:call-template>
78 <xsl:call-template name="apply-list">
79 <xsl:with-param name="list"
80 select="substring-after($list,' ')"/>
81 </xsl:call-template>
82 </xsl:when>
83 <!-- From now on, $list contains only one package -->
84 <!-- If it is a group, do nothing -->
85 <xsl:when test="contains($list,'groupxx')"/>
86 <xsl:otherwise>
87 <xsl:variable name="is-lfs">
88 <xsl:call-template name="detect-lfs">
89 <xsl:with-param name="package" select="$list"/>
90 <xsl:with-param name="lfsbook" select="$lfsbook"/>
91 </xsl:call-template>
92 </xsl:variable>
93 <xsl:choose>
94 <xsl:when test="$is-lfs='true'">
95 <!-- LFS package -->
96 <xsl:message>
97 <xsl:value-of select="$list"/>
98 <xsl:text> is an lfs package</xsl:text>
99 </xsl:message>
100 <xsl:call-template name="process-lfs">
101 <xsl:with-param name="package" select="$list"/>
102 <xsl:with-param name="lfsbook" select="$lfsbook"/>
103 </xsl:call-template>
104 </xsl:when>
105 <xsl:when test="contains(concat($list,' '),'-pass1 ')">
106<!-- We need to do it for both sect1 and sect2, because of libva -->
107 <xsl:variable
108 name="real-id"
109 select="substring-before(concat($list,' '),'-pass1 ')"/>
110 <xsl:if test="id($real-id)[self::sect1]">
111 <xsl:apply-templates select="id($real-id)" mode="pass1"/>
112 </xsl:if>
113 <xsl:if test="id($real-id)[self::sect2]">
114 <xsl:apply-templates select="id($real-id)" mode="pass1-sect2"/>
115 </xsl:if>
116 </xsl:when>
117 <xsl:when test="not(id($list)[self::sect1 or self::sect2])">
118 <!-- This is a sub-package: parse the corresponding compound
119 package-->
120 <xsl:apply-templates
121 select="//sect1[(contains(@id,'xorg7') or
122 contains(@id,'frameworks') or
123 contains(@id,'plasma5'))
124 and .//userinput/literal[contains(string(),
125 concat($list,'-'))]]"
126 mode="compound">
127 <xsl:with-param name="package" select="$list"/>
128 </xsl:apply-templates>
129 </xsl:when>
130 <xsl:otherwise>
131 <xsl:apply-templates select="id($list)"/>
132 </xsl:otherwise>
133 </xsl:choose>
134 </xsl:otherwise>
135 </xsl:choose>
136 </xsl:if>
137 </xsl:template>
138
139<!-- The normal case : just copy to the book. Exceptions are if there
140 is a xref, so use a special "mode" template -->
141 <xsl:template match="sect1">
142 <xsl:apply-templates select="." mode="sect1"/>
143 </xsl:template>
144
145 <xsl:template match="*" mode="pass1">
146 <xsl:choose>
147 <xsl:when test="self::xref">
148 <xsl:choose>
149 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
150 concat(' ',@linkend,' '))">
151 <xsl:choose>
152 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
153 <xref linkend="xorg7-server"/>
154 </xsl:when>
155 <xsl:when test="@linkend='server-mail'">
156 <xref linkend="{$MTA}"/>
157 </xsl:when>
158 <xsl:otherwise>
159 <xsl:copy-of select="."/>
160 </xsl:otherwise>
161 </xsl:choose>
162 </xsl:when>
163 <xsl:otherwise>
164 <xsl:choose>
165 <xsl:when test="@linkend='bootscripts' or
166 @linkend='systemd-units'">
167 <xsl:copy-of select="."/>
168 </xsl:when>
169 <xsl:otherwise>
170 <xsl:value-of select="@linkend"/> (in full book)
171 </xsl:otherwise>
172 </xsl:choose>
173 </xsl:otherwise>
174 </xsl:choose>
175 </xsl:when>
176 <xsl:when test="@id">
177 <xsl:element name="{name()}">
178 <xsl:for-each select="attribute::*">
179 <xsl:attribute name="{name()}">
180 <xsl:value-of select="."/>
181 <xsl:if test="name() = 'id'">-pass1</xsl:if>
182 </xsl:attribute>
183 </xsl:for-each>
184 <xsl:apply-templates mode="pass1"/>
185 </xsl:element>
186 </xsl:when>
187 <xsl:when test=".//xref | .//@id">
188 <xsl:element name="{name()}">
189 <xsl:for-each select="attribute::*">
190 <xsl:attribute name="{name()}">
191 <xsl:value-of select="."/>
192 </xsl:attribute>
193 </xsl:for-each>
194 <xsl:apply-templates mode="pass1"/>
195 </xsl:element>
196 </xsl:when>
197 <xsl:otherwise>
198 <xsl:copy-of select="."/>
199 </xsl:otherwise>
200 </xsl:choose>
201 </xsl:template>
202
203 <xsl:template match="*" mode="pass1-sect2">
204 <xsl:choose>
205 <xsl:when test="self::sect2">
206 <xsl:element name="sect1">
207 <xsl:attribute name="id"><xsl:value-of select="@id"/>-pass1</xsl:attribute>
208 <xsl:attribute name="xreflabel"><xsl:value-of select="@xreflabel"/></xsl:attribute>
209 <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
210 select="@id"/>-pass1.html"</xsl:processing-instruction>
211 <xsl:apply-templates mode="pass1-sect2"/>
212 </xsl:element>
213 </xsl:when>
214 <xsl:when test="self::sect3">
215 <xsl:element name="sect2">
216 <xsl:attribute name="role">
217 <xsl:value-of select="@role"/>
218 </xsl:attribute>
219 <xsl:apply-templates mode="pass1-sect2"/>
220 </xsl:element>
221 </xsl:when>
222 <xsl:when test="self::bridgehead">
223 <xsl:element name="bridgehead">
224 <xsl:attribute name="renderas">
225 <xsl:if test="@renderas='sect4'">sect3</xsl:if>
226 <xsl:if test="@renderas='sect5'">sect4</xsl:if>
227 </xsl:attribute>
228 <xsl:value-of select='.'/>
229 </xsl:element>
230 </xsl:when>
231 <xsl:when test="self::xref">
232 <xsl:choose>
233 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
234 concat(' ',@linkend,' '))">
235 <xsl:choose>
236 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
237 <xref linkend="xorg7-server"/>
238 </xsl:when>
239 <xsl:when test="@linkend='server-mail'">
240 <xref linkend="{$MTA}"/>
241 </xsl:when>
242 <xsl:otherwise>
243 <xsl:copy-of select="."/>
244 </xsl:otherwise>
245 </xsl:choose>
246 </xsl:when>
247 <xsl:otherwise>
248 <xsl:choose>
249 <xsl:when test="@linkend='bootscripts' or
250 @linkend='systemd-units'">
251 <xsl:copy-of select="."/>
252 </xsl:when>
253 <xsl:otherwise>
254 <xsl:value-of select="@linkend"/> (in full book)
255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:otherwise>
258 </xsl:choose>
259 </xsl:when>
260 <xsl:when test="@id">
261 <xsl:element name="{name()}">
262 <xsl:for-each select="attribute::*">
263 <xsl:attribute name="{name()}">
264 <xsl:value-of select="."/>
265 <xsl:if test="name() = 'id'">-pass1</xsl:if>
266 </xsl:attribute>
267 </xsl:for-each>
268 <xsl:apply-templates mode="pass1-sect2"/>
269 </xsl:element>
270 </xsl:when>
271 <xsl:when test=".//xref | .//@id">
272 <xsl:element name="{name()}">
273 <xsl:for-each select="attribute::*">
274 <xsl:attribute name="{name()}">
275 <xsl:value-of select="."/>
276 </xsl:attribute>
277 </xsl:for-each>
278 <xsl:apply-templates mode="pass1-sect2"/>
279 </xsl:element>
280 </xsl:when>
281 <xsl:otherwise>
282 <xsl:copy-of select="."/>
283 </xsl:otherwise>
284 </xsl:choose>
285 </xsl:template>
286
287 <xsl:template match="processing-instruction()" mode="pass1">
288 <xsl:variable name="pi-full" select="string()"/>
289 <xsl:variable name="pi-value"
290 select="substring-after($pi-full,'filename=')"/>
291 <xsl:variable name="filename"
292 select="substring-before(substring($pi-value,2),'.html')"/>
293 <xsl:processing-instruction name="dbhtml">filename="<xsl:copy-of
294 select="$filename"/>-pass1.html"</xsl:processing-instruction>
295 </xsl:template>
296
297 <xsl:template match="processing-instruction()" mode="sect1">
298 <xsl:copy-of select="."/>
299 </xsl:template>
300
301<!-- Any node which has no xref descendant is copied verbatim. If there
302 is an xref descendant, output the node and recurse. -->
303 <xsl:template match="*" mode="sect1">
304 <xsl:choose>
305 <xsl:when test="self::xref">
306 <xsl:choose>
307 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
308 concat(' ',@linkend,' '))">
309 <xsl:choose>
310 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
311 <xref linkend="xorg7-server"/>
312 </xsl:when>
313 <xsl:when test="@linkend='server-mail'">
314 <xref linkend="{$MTA}"/>
315 </xsl:when>
316 <xsl:otherwise>
317 <xsl:copy-of select="."/>
318 </xsl:otherwise>
319 </xsl:choose>
320 </xsl:when>
321 <xsl:otherwise>
322 <xsl:choose>
323 <xsl:when test="@linkend='bootscripts' or
324 @linkend='systemd-units'">
325 <xsl:copy-of select="."/>
326 </xsl:when>
327 <xsl:otherwise>
328 <xsl:value-of select="@linkend"/> (in full book)
329 </xsl:otherwise>
330 </xsl:choose>
331 </xsl:otherwise>
332 </xsl:choose>
333 </xsl:when>
334 <xsl:when test=".//xref">
335 <xsl:element name="{name()}">
336 <xsl:for-each select="attribute::*">
337 <xsl:attribute name="{name()}">
338 <xsl:value-of select="."/>
339 </xsl:attribute>
340 </xsl:for-each>
341 <xsl:apply-templates mode="sect1"/>
342 </xsl:element>
343 </xsl:when>
344 <xsl:otherwise>
345 <xsl:copy-of select="."/>
346 </xsl:otherwise>
347 </xsl:choose>
348 </xsl:template>
349
350<!-- Python modules and DBus bindings -->
351 <xsl:template match="sect2">
352 <xsl:apply-templates select='.' mode="sect2"/>
353 </xsl:template>
354
355 <xsl:template match="*" mode="sect2">
356 <xsl:choose>
357 <xsl:when test="self::sect2">
358 <xsl:element name="sect1">
359 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
360 <xsl:attribute name="xreflabel"><xsl:value-of select="@xreflabel"/></xsl:attribute>
361 <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
362 select="@id"/>.html"</xsl:processing-instruction>
363 <xsl:apply-templates mode="sect2"/>
364 </xsl:element>
365 </xsl:when>
366 <xsl:when test="self::sect3">
367 <xsl:element name="sect2">
368 <xsl:attribute name="role">
369 <xsl:value-of select="@role"/>
370 </xsl:attribute>
371 <xsl:apply-templates mode="sect2"/>
372 </xsl:element>
373 </xsl:when>
374 <xsl:when test="self::bridgehead">
375 <xsl:element name="bridgehead">
376 <xsl:attribute name="renderas">
377 <xsl:if test="@renderas='sect4'">sect3</xsl:if>
378 <xsl:if test="@renderas='sect5'">sect4</xsl:if>
379 </xsl:attribute>
380 <xsl:value-of select='.'/>
381 </xsl:element>
382 </xsl:when>
383 <xsl:when test="self::xref">
384 <xsl:choose>
385 <xsl:when test="contains(concat(' ',normalize-space($list),' '),
386 concat(' ',@linkend,' '))">
387 <xsl:choose>
388 <xsl:when test="@linkend='x-window-system' or @linkend='xorg7'">
389 <xref linkend="xorg7-server"/>
390 </xsl:when>
391 <xsl:when test="@linkend='server-mail'">
392 <xref linkend="{$MTA}"/>
393 </xsl:when>
394 <xsl:otherwise>
395 <xsl:copy-of select="."/>
396 </xsl:otherwise>
397 </xsl:choose>
398 </xsl:when>
399 <xsl:otherwise>
400 <xsl:value-of select="@linkend"/> (in full book)
401 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:when>
404 <xsl:when test=".//xref">
405 <xsl:element name="{name()}">
406 <xsl:for-each select="attribute::*">
407 <xsl:attribute name="{name()}">
408 <xsl:value-of select="."/>
409 </xsl:attribute>
410 </xsl:for-each>
411 <xsl:apply-templates mode="sect2"/>
412 </xsl:element>
413 </xsl:when>
414 <xsl:otherwise>
415 <xsl:copy-of select="."/>
416 </xsl:otherwise>
417 </xsl:choose>
418 </xsl:template>
419
420<!-- Perl modules : transform them to minimal sect1. Use a template
421 for installation instructions -->
422 <xsl:template match="bridgehead">
423 <xsl:if test="ancestor::sect1[@id='perl-modules']">
424 <xsl:element name="sect1">
425 <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
426 <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
427 <xsl:processing-instruction name="dbhtml">
428 filename="<xsl:value-of select="@id"/>.html"</xsl:processing-instruction>
429 <title><xsl:value-of select="./@xreflabel"/></title>
430 <sect2 role="package">
431 <title>Introduction to <xsl:value-of select="@id"/></title>
432 <bridgehead renderas="sect3">Package Information</bridgehead>
433 <itemizedlist spacing="compact">
434 <listitem>
435 <para>Download (HTTP): <xsl:copy-of select="./following-sibling::itemizedlist[1]/listitem/para/ulink"/></para>
436 </listitem>
437 <listitem>
438 <para>Download (FTP): <ulink url=" "/></para>
439 </listitem>
440 </itemizedlist>
441 </sect2>
442 <xsl:choose>
443 <xsl:when test="following-sibling::itemizedlist[1]//xref[@linkend='perl-standard-install'] | following-sibling::itemizedlist[1]/preceding-sibling::para//xref[@linkend='perl-standard-install']">
444 <xsl:apply-templates mode="perl-install" select="id('perl-standard-install')"/>
445 </xsl:when>
446 <xsl:otherwise>
447 <sect2 role="installation">
448 <title>Installation of <xsl:value-of select="@xreflabel"/></title>
449 <para>Run the following commands:</para>
450 <for-each select="following-sibling::bridgehead/preceding-sibling::screen[not(@role)]">
451 <xsl:copy-of select="."/>
452 </for-each>
453 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
454 <for-each select="following-sibling::bridgehead/preceding-sibling::screen[@role='root']">
455 <xsl:copy-of select="."/>
456 </for-each>
457 </sect2>
458 </xsl:otherwise>
459 </xsl:choose>
460 </xsl:element>
461 </xsl:if>
462 </xsl:template>
463
464<!-- The case of depdendencies of perl modules. Same treatment
465 as for perl modules. Just easier because always perl standard -->
466 <xsl:template match="para">
467 <xsl:element name="sect1">
468 <xsl:attribute name="id"><xsl:value-of select="./@id"/></xsl:attribute>
469 <xsl:attribute name="xreflabel"><xsl:value-of select="./@xreflabel"/></xsl:attribute>
470 <xsl:processing-instruction name="dbhtml">filename="<xsl:value-of
471 select="@id"/>.html"</xsl:processing-instruction>
472 <title><xsl:value-of select="./@xreflabel"/></title>
473 <sect2 role="package">
474 <title>Introduction to <xsl:value-of select="@id"/></title>
475 <bridgehead renderas="sect3">Package Information</bridgehead>
476 <itemizedlist spacing="compact">
477 <listitem>
478 <para>Download (HTTP): <xsl:copy-of select="./ulink"/></para>
479 </listitem>
480 <listitem>
481 <para>Download (FTP): <ulink url=" "/></para>
482 </listitem>
483 </itemizedlist>
484 </sect2>
485 <xsl:apply-templates mode="perl-install" select="id('perl-standard-install')"/>
486 </xsl:element>
487 </xsl:template>
488
489<!-- copy of the perl standard installation instructions:
490 suppress id (otherwise not unique) and note (which we
491 do not want to apply -->
492 <xsl:template match="sect2" mode="perl-install">
493 <sect2 role="installation">
494 <xsl:for-each select="./*">
495 <xsl:if test="not(self::note)">
496 <xsl:copy-of select="."/>
497 </xsl:if>
498 </xsl:for-each>
499 </sect2>
500 </xsl:template>
501
502<!-- we have got an xorg package. We are at the installation page
503 but now we need to make an autonomous page from the global
504 one -->
505 <xsl:template match="sect1" mode="compound">
506 <xsl:param name="package"/>
507 <xsl:variable name="tarball">
508 <xsl:call-template name="tarball">
509 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
510 <xsl:with-param name="cat-md5"
511 select="string(.//userinput[starts-with(string(),'cat ')])"/>
512 </xsl:call-template>
513 </xsl:variable>
514 <!-- Unfortunately, there are packages in kf5 and plasma5 that
515 starts in the same way: for example kwallet in kf5
516 and kwallet-pam in plasma. So we may arrive here with
517 package=kwallet and tarball=kwallet-pam-(version).tar.xz.
518 We should not continue in this case. For checking, transform
519 digits into X, and check that package-X occurs in tarball. We
520 have to translate package too, since it may contain digits.-->
521 <xsl:if test=
522 "contains(translate($tarball,'0123456789','XXXXXXXXXX'),
523 concat(translate($package,'0123456789','XXXXXXXXXX'),'-X'))">
524 <xsl:variable name="md5sum">
525 <xsl:call-template name="md5sum">
526 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
527 <xsl:with-param name="cat-md5"
528 select=".//userinput[starts-with(string(),'cat ')]"/>
529 </xsl:call-template>
530 </xsl:variable>
531 <xsl:variable name="download-dir">
532 <xsl:call-template name="download-dir">
533 <xsl:with-param name="package" select="concat(' ',$package,'-')"/>
534 <xsl:with-param name="cat-md5"
535 select=".//userinput[starts-with(string(),'cat ')]"/>
536 </xsl:call-template>
537 </xsl:variable>
538 <xsl:variable name="install-instructions">
539 <xsl:call-template name="inst-instr">
540 <xsl:with-param name="inst-instr"
541 select=
542 "substring-after(
543 substring-after(.//userinput[starts-with(string(),'for ') or
544 starts-with(string(),'while ')],
545 'pushd'),
546 '&#xA;')"/>
547 <xsl:with-param name="package" select="$package"/>
548 </xsl:call-template>
549 </xsl:variable>
550 <xsl:element name="sect1">
551 <xsl:attribute name="id">
552 <xsl:value-of select="$package"/>
553 </xsl:attribute>
554 <xsl:processing-instruction name="dbhtml">
555 filename="<xsl:value-of select='$package'/>.html"
556 </xsl:processing-instruction>
557 <title><xsl:value-of select="$package"/></title>
558 <sect2 role="package">
559 <title>Introduction to <xsl:value-of select="$package"/></title>
560 <bridgehead renderas="sect3">Package Information</bridgehead>
561 <itemizedlist spacing="compact">
562 <listitem>
563 <para>Download (HTTP): <xsl:element name="ulink">
564 <xsl:attribute name="url">
565 <xsl:value-of
566 select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
567 <xsl:value-of select="$download-dir"/>
568 <!-- $download-dir contains the trailing / for xorg,
569 but not for KDE... -->
570 <xsl:if test="contains(@id,'frameworks') or
571 contains(@id,'plasma5')">
572 <xsl:text>/</xsl:text>
573 </xsl:if>
574 <!-- Some kf5 packages are in a subdirectory -->
575 <xsl:if test="$package='khtml' or
576 $package='kdelibs4support' or
577 $package='kdesignerplugin' or
578 $package='kdewebkit' or
579 $package='kjs' or
580 $package='kjsembed' or
581 $package='kmediaplayer' or
582 $package='kross' or
583 $package='kxmlrpcclient'">
584 <xsl:text>portingAids/</xsl:text>
585 </xsl:if>
586 <xsl:value-of select="$tarball"/>
587 </xsl:attribute>
588 </xsl:element>
589 </para>
590 </listitem>
591 <!-- don't use FTP, although they are available for xorg -->
592 <listitem>
593 <para>Download (FTP): <ulink url=" "/>
594 </para>
595 </listitem>
596 <listitem>
597 <para>
598 Download MD5 sum: <xsl:value-of select="$md5sum"/>
599 </para>
600 </listitem>
601 </itemizedlist>
602 <!-- If there is an additional download, we need to output that -->
603 <xsl:if test=".//bridgehead[contains(string(),'Additional')]">
604 <xsl:copy-of
605 select=".//bridgehead[contains(string(),'Additional')]"/>
606 <xsl:copy-of
607 select=".//bridgehead[contains(string(),'Additional')]
608 /following-sibling::itemizedlist[1]"/>
609 </xsl:if>
610 </sect2>
611 <sect2 role="installation">
612 <title>Installation of <xsl:value-of select="$package"/></title>
613
614 <para>
615 Install <application><xsl:value-of select="$package"/></application>
616 by running the following commands:
617 </para>
618 <!-- packagedir is used in xorg lib instructions -->
619 <screen><userinput>packagedir=<xsl:value-of
620 select="substring-before($tarball,'.tar.')"/>
621 <!-- name is used in kf5 instructions -->
622 <xsl:text>
623name=$(echo $packagedir | sed 's/-[[:digit:]].*//')
624</xsl:text>
625 <xsl:value-of select="substring-before($install-instructions,
626 'as_root')"/>
627 </userinput></screen>
628
629 <para>
630 Now as the <systemitem class="username">root</systemitem> user:
631 </para>
632 <screen role='root'>
633 <userinput><xsl:value-of select="substring-after(
634 $install-instructions,
635 'as_root')"/>
636 </userinput>
637 </screen>
638 </sect2>
639 </xsl:element><!-- sect1 -->
640 </xsl:if>
641
642 </xsl:template>
643
644<!-- get the tarball name from the text that comes from the .md5 file -->
645 <xsl:template name="tarball">
646 <!-- $package must start with a space, and finish with a "-", to be
647 sure to match exactly the package. Note that if we have two
648 packages named e.g. "pkg1" and "pkg1-add", the second one may be
649 matched by " pkg1-". So this only works if "pkg1" comes before
650 "pkg1-add" in the md5 file. Presently this is the case in the book...
651 -->
652 <xsl:param name="package"/>
653 <xsl:param name="cat-md5"/>
654 <xsl:choose>
655 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
656 <xsl:call-template name="tarball">
657 <xsl:with-param name="package" select="$package"/>
658 <xsl:with-param name="cat-md5"
659 select="substring-after($cat-md5,'&#xA;')"/>
660 </xsl:call-template>
661 </xsl:when>
662 <xsl:when test="contains(substring-before($cat-md5,$package),' ')">
663 <xsl:call-template name="tarball">
664 <xsl:with-param name="package" select="$package"/>
665 <xsl:with-param name="cat-md5"
666 select="substring-after($cat-md5,' ')"/>
667 </xsl:call-template>
668 </xsl:when>
669 <xsl:otherwise>
670 <xsl:copy-of select="substring-after(
671 substring-before($cat-md5,'&#xA;'),' ')"/>
672 </xsl:otherwise>
673 </xsl:choose>
674 </xsl:template>
675<!-- get the download dirname from the text that comes from the .md5 file -->
676 <xsl:template name="download-dir">
677 <xsl:param name="package"/>
678 <xsl:param name="cat-md5"/>
679 <xsl:choose>
680 <xsl:when test="not(@id='xorg7-legacy')">
681 <xsl:copy-of select="''"/>
682 </xsl:when>
683 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
684 <xsl:call-template name="download-dir">
685 <xsl:with-param name="package" select="$package"/>
686 <xsl:with-param name="cat-md5"
687 select="substring-after($cat-md5,'&#xA;')"/>
688 </xsl:call-template>
689 </xsl:when>
690 <xsl:when test="contains(substring-before($cat-md5,$package),' ')">
691 <xsl:call-template name="download-dir">
692 <xsl:with-param name="package" select="$package"/>
693 <xsl:with-param name="cat-md5"
694 select="substring-after($cat-md5,' ')"/>
695 </xsl:call-template>
696 </xsl:when>
697 <xsl:otherwise>
698 <xsl:copy-of select="substring-before($cat-md5,' ')"/>
699 </xsl:otherwise>
700 </xsl:choose>
701 </xsl:template>
702<!-- same for md5sum -->
703 <xsl:template name="md5sum">
704 <xsl:param name="package"/>
705 <xsl:param name="cat-md5"/>
706 <xsl:choose>
707 <xsl:when test="contains(substring-before($cat-md5,$package),'&#xA;')">
708 <xsl:call-template name="md5sum">
709 <xsl:with-param name="package" select="$package"/>
710 <xsl:with-param name="cat-md5"
711 select="substring-after($cat-md5,'&#xA;')"/>
712 </xsl:call-template>
713 </xsl:when>
714 <xsl:otherwise>
715 <xsl:copy-of select="substring-before($cat-md5,' ')"/>
716 </xsl:otherwise>
717 </xsl:choose>
718 </xsl:template>
719
720 <xsl:template name="inst-instr">
721 <!-- This template is necessary because of the "kapidox" case in kf5:
722 Normally, the general instructions extract the package and change
723 to the extracted dir for running the installation instructions.
724 When installing a sub-package of a compound package, the installation
725 instructions to be run are located between a pushd and a popd,
726 *except* for kf5, where a popd occurs inside a case for kapidox...
727 So we call this template with a "inst-instr" string that contains
728 everything after the pushd.-->
729 <xsl:param name="inst-instr"/>
730 <xsl:param name="package"/>
731 <xsl:choose>
732 <!-- first the case of kf5: there are two "popd"-->
733 <xsl:when test="contains(substring-after($inst-instr,'popd'),'popd')">
734 <xsl:choose>
735 <xsl:when test="$package='kapidox'">
736 <!-- only the instructions inside the "case" and before popd -->
737 <xsl:copy-of select="substring-after(substring-before($inst-instr,'popd'),'kapidox)')"/>
738 </xsl:when>
739 <xsl:otherwise>
740 <!-- all what is after the esac -->
741 <xsl:call-template name="inst-instr">
742 <xsl:with-param
743 name="inst-instr"
744 select="substring-after($inst-instr,'esac&#xA;')"/>
745 </xsl:call-template>
746 </xsl:otherwise>
747 </xsl:choose>
748 </xsl:when>
749 <xsl:otherwise>
750 <!-- normal case: everything that is before popd -->
751 <xsl:copy-of select="substring-before($inst-instr,'popd')"/>
752 </xsl:otherwise>
753 </xsl:choose>
754 </xsl:template>
755</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.