source: BLFS/xsl/process-install.xsl@ 4dfe8f9

ablfs-more trunk
Last change on this file since 4dfe8f9 was 82ddba9, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Add gnome-control-center to the list of install overrides

  • Property mode set to 100644
File size: 23.2 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE stylesheet [
3<!ENTITY detect-config
4 "contains(string($current-instr),'useradd') or
5 contains(string($current-instr),'groupadd') or
6 contains(string($current-instr),'usermod') or
7 contains(string($current-instr),'icon-cache') or
8 contains(string($current-instr),'desktop-database') or
9 contains(string($current-instr),'compile-schemas') or
10 contains(string($current-instr),'query-loaders') or
11 contains(string($current-instr),'pam.d') or
12 contains(string($current-instr),'/opt/rustc') or
13 contains(string($current-instr),'libQt5WebEngine') or
14 contains(string($current-instr),'desktop-file-edit') or
15 contains(string($current-instr),'.old') or
16 contains(string($current-instr),'tracker-miner') or
17 contains(string($current-instr),'gtweak') or
18 contains(string($current-instr),'query-immodules') or
19 contains(string($current-instr),'gnome-control-center')">
20]>
21
22<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
23 version="1.0">
24
25 <xsl:template name="process-install">
26 <xsl:param name="instruction-tree"/>
27 <xsl:param name="want-stats"/>
28 <xsl:param name="root-seen"/>
29 <xsl:param name="install-seen"/>
30 <xsl:param name="test-seen"/>
31 <xsl:param name="doc-seen"/>
32
33<!-- Isolate the current instruction -->
34 <xsl:variable name="current-instr" select="$instruction-tree[1]"/>
35
36 <xsl:choose>
37<!--============================================================-->
38<!-- First, if we have an empty tree, close everything and exit -->
39 <xsl:when test="not($current-instr)">
40 <xsl:if test="$install-seen">
41 <xsl:call-template name="end-install"/>
42 </xsl:if>
43 <xsl:if test="$root-seen">
44 <xsl:call-template name="end-root"/>
45 </xsl:if>
46 <xsl:if test="$doc-seen and not($root-seen)">
47 <xsl:call-template name="end-doc">
48 <xsl:with-param name="want-stats" select="$want-stats"/>
49 </xsl:call-template>
50 </xsl:if>
51 <xsl:if test="$test-seen">
52 <xsl:call-template name="end-test">
53 <xsl:with-param name="want-stats" select="$want-stats"/>
54 </xsl:call-template>
55 </xsl:if>
56 </xsl:when><!-- end empty tree -->
57<!--============================================================-->
58 <xsl:when test="$current-instr[@role='root' and @remap='test']">
59 <xsl:if test="$install-seen">
60 <xsl:call-template name="end-install"/>
61 </xsl:if>
62 <xsl:if test="$root-seen">
63 <xsl:call-template name="end-root"/>
64 </xsl:if>
65 <xsl:if test="$doc-seen and not($root-seen)">
66 <xsl:call-template name="end-doc">
67 <xsl:with-param name="want-stats" select="$want-stats"/>
68 </xsl:call-template>
69 </xsl:if>
70 <xsl:if test="not($test-seen)">
71 <xsl:call-template name="begin-test">
72 <xsl:with-param name="want-stats" select="$want-stats"/>
73 </xsl:call-template>
74 </xsl:if>
75 <xsl:call-template name="begin-root"/>
76<!-- We first apply mode="root" templates, and save the result in a variable -->
77 <xsl:variable name="processed-instr">
78 <xsl:apply-templates select="$current-instr" mode="root"/>
79 </xsl:variable>
80<!-- We then process as a test instruction -->
81 <xsl:call-template name="process-test">
82 <xsl:with-param name="test-instr" select="$processed-instr"/>
83 <xsl:with-param name="want-stats" select="$want-stats"/>
84 </xsl:call-template>
85 <xsl:call-template name="process-install">
86 <xsl:with-param
87 name="instruction-tree"
88 select="$instruction-tree[position()>1]"/>
89 <xsl:with-param name="want-stats" select="$want-stats"/>
90 <xsl:with-param name="root-seen" select="boolean(1)"/>
91 <xsl:with-param name="install-seen" select="boolean(0)"/>
92 <xsl:with-param name="test-seen" select="boolean(1)"/>
93 <xsl:with-param name="doc-seen" select="boolean(0)"/>
94 </xsl:call-template>
95 </xsl:when><!-- end role="root" and remap="test" -->
96<!--============================================================-->
97 <xsl:when test="$current-instr[@role='root' and @remap='doc']">
98 <xsl:if test="$test-seen">
99 <xsl:call-template name="end-test">
100 <xsl:with-param name="want-stats" select="$want-stats"/>
101 </xsl:call-template>
102 </xsl:if>
103 <xsl:if test="$doc-seen and not($root-seen)">
104 <xsl:call-template name="end-doc">
105 <xsl:with-param name="want-stats" select="$want-stats"/>
106 </xsl:call-template>
107 </xsl:if>
108 <xsl:if test="not($root-seen)">
109 <xsl:call-template name="begin-root"/>
110 </xsl:if>
111 <xsl:if test="not($install-seen)">
112 <xsl:call-template name="begin-install"/>
113 </xsl:if>
114<!-- We first apply mode="install" templates, and save the result in a
115 variable -->
116 <xsl:variable name="processed-instr">
117 <xsl:apply-templates select="$current-instr" mode="install"/>
118 </xsl:variable>
119<!-- Then comment it out -->
120 <xsl:call-template name="output-comment-out">
121 <xsl:with-param name="out-string" select="$processed-instr"/>
122 </xsl:call-template>
123<!-- The above template ends with a commented line, so that if end-install
124 adds a closing single quote, it will not be seen. Add a CR to prevent
125 that -->
126 <xsl:text>
127</xsl:text>
128 <xsl:call-template name="process-install">
129 <xsl:with-param
130 name="instruction-tree"
131 select="$instruction-tree[position()>1]"/>
132 <xsl:with-param name="want-stats" select="$want-stats"/>
133 <xsl:with-param name="root-seen" select="boolean(1)"/>
134 <xsl:with-param name="install-seen" select="boolean(1)"/>
135 <xsl:with-param name="test-seen" select="boolean(0)"/>
136 <xsl:with-param name="doc-seen" select="boolean(1)"/>
137 </xsl:call-template>
138 </xsl:when><!-- end role="root" and remap="doc" -->
139<!--============================================================-->
140 <xsl:when test="$current-instr[@role='root']">
141<!-- We have two cases, depending on the content: either a config instruction,
142 that we do not record with porg (first case below), or a true install
143 instruction (otherwise below) -->
144 <xsl:choose>
145<!--____________________________________________________________ -->
146 <xsl:when test="&detect-config;">
147 <xsl:if test="$install-seen">
148 <xsl:call-template name="end-install"/>
149 </xsl:if>
150 <xsl:if test="$test-seen">
151 <xsl:call-template name="end-test">
152 <xsl:with-param name="want-stats" select="$want-stats"/>
153 </xsl:call-template>
154 </xsl:if>
155 <xsl:if test="$doc-seen and not($root-seen)">
156 <xsl:call-template name="end-doc">
157 <xsl:with-param name="want-stats" select="$want-stats"/>
158 </xsl:call-template>
159 </xsl:if>
160 <xsl:if test="not($root-seen)">
161 <xsl:call-template name="begin-root"/>
162 </xsl:if>
163 <xsl:apply-templates select="$current-instr" mode="root"/>
164 <xsl:call-template name="process-install">
165 <xsl:with-param
166 name="instruction-tree"
167 select="$instruction-tree[position()>1]"/>
168 <xsl:with-param name="want-stats" select="$want-stats"/>
169 <xsl:with-param name="root-seen" select="boolean(1)"/>
170 <xsl:with-param name="install-seen" select="boolean(0)"/>
171 <xsl:with-param name="test-seen" select="boolean(0)"/>
172 <xsl:with-param name="doc-seen" select="boolean(0)"/>
173 </xsl:call-template>
174 </xsl:when><!-- end config as root -->
175<!--____________________________________________________________ -->
176 <xsl:otherwise><!-- we have a true install instruction -->
177 <xsl:if test="$test-seen">
178 <xsl:call-template name="end-test">
179 <xsl:with-param name="want-stats" select="$want-stats"/>
180 </xsl:call-template>
181 </xsl:if>
182 <xsl:if test="$doc-seen and not($root-seen)">
183 <xsl:call-template name="end-doc">
184 <xsl:with-param name="want-stats" select="$want-stats"/>
185 </xsl:call-template>
186 </xsl:if>
187 <xsl:if test="$want-stats and not($install-seen)">
188 <xsl:if test="$root-seen">
189 <xsl:call-template name="end-root"/>
190 </xsl:if>
191 <xsl:text>
192echo Time before install: ${SECONDS} >> $INFOLOG</xsl:text>
193 <xsl:apply-templates
194 select="$instruction-tree[@role='root']/userinput"
195 mode="destdir"/>
196 <xsl:text>
197
198echo Time after install: ${SECONDS} >> $INFOLOG
199echo Size after install: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG
200</xsl:text>
201 <xsl:if test="$root-seen">
202 <xsl:call-template name="begin-root"/>
203 </xsl:if>
204 </xsl:if>
205 <xsl:if test="not($root-seen)">
206 <xsl:call-template name="begin-root"/>
207 </xsl:if>
208 <xsl:if test="not($install-seen)">
209 <xsl:call-template name="begin-install"/>
210 </xsl:if>
211 <xsl:apply-templates select="$current-instr" mode="install"/>
212 <xsl:call-template name="process-install">
213 <xsl:with-param
214 name="instruction-tree"
215 select="$instruction-tree[position()>1]"/>
216 <xsl:with-param name="want-stats" select="$want-stats"/>
217 <xsl:with-param name="root-seen" select="boolean(1)"/>
218 <xsl:with-param name="install-seen" select="boolean(1)"/>
219 <xsl:with-param name="test-seen" select="boolean(0)"/>
220 <xsl:with-param name="doc-seen" select="boolean(0)"/>
221 </xsl:call-template>
222 </xsl:otherwise><!-- end true install instruction -->
223<!--____________________________________________________________ -->
224 </xsl:choose>
225 </xsl:when><!-- role="root" and no remap -->
226<!--============================================================-->
227 <xsl:when test="$current-instr[@remap='test'] or
228 $current-instr/self::command">
229 <xsl:if test="$install-seen">
230 <xsl:call-template name="end-install"/>
231 </xsl:if>
232 <xsl:if test="$root-seen">
233 <xsl:call-template name="end-root"/>
234 </xsl:if>
235 <xsl:if test="$doc-seen and not($root-seen)">
236 <xsl:call-template name="end-doc">
237 <xsl:with-param name="want-stats" select="$want-stats"/>
238 </xsl:call-template>
239 </xsl:if>
240 <xsl:if test="not($test-seen)">
241 <xsl:if test="not($doc-seen)">
242 <xsl:call-template name="end-make">
243 <xsl:with-param name="want-stats" select="$want-stats"/>
244 </xsl:call-template>
245 </xsl:if>
246 <xsl:call-template name="begin-test">
247 <xsl:with-param name="want-stats" select="$want-stats"/>
248 </xsl:call-template>
249 </xsl:if>
250<!-- We first apply normal templates, and save the result in a variable -->
251 <xsl:variable name="processed-instr">
252 <xsl:apply-templates select="$current-instr"/>
253 </xsl:variable>
254<!-- We then process as a test instruction -->
255 <xsl:call-template name="process-test">
256 <xsl:with-param name="test-instr" select="$processed-instr"/>
257 <xsl:with-param name="want-stats" select="$want-stats"/>
258 </xsl:call-template>
259 <xsl:call-template name="process-install">
260 <xsl:with-param
261 name="instruction-tree"
262 select="$instruction-tree[position()>1]"/>
263 <xsl:with-param name="want-stats" select="$want-stats"/>
264 <xsl:with-param name="root-seen" select="boolean(0)"/>
265 <xsl:with-param name="install-seen" select="boolean(0)"/>
266 <xsl:with-param name="test-seen" select="boolean(1)"/>
267 <xsl:with-param name="doc-seen" select="boolean(0)"/>
268 </xsl:call-template>
269 </xsl:when><!-- end no role, remap=test -->
270<!--============================================================-->
271 <xsl:when test="$current-instr[@remap='doc']">
272 <xsl:if test="$install-seen">
273 <xsl:call-template name="end-install"/>
274 </xsl:if>
275 <xsl:if test="$root-seen">
276 <xsl:call-template name="end-root"/>
277 </xsl:if>
278 <xsl:if test="$test-seen">
279 <xsl:call-template name="end-test">
280 <xsl:with-param name="want-stats" select="$want-stats"/>
281 </xsl:call-template>
282 </xsl:if>
283 <xsl:if test="not($doc-seen) or $root-seen">
284 <xsl:if test="not($test-seen) and not($root-seen)">
285 <xsl:call-template name="end-make">
286 <xsl:with-param name="want-stats" select="$want-stats"/>
287 </xsl:call-template>
288 </xsl:if>
289 <xsl:call-template name="begin-doc">
290 <xsl:with-param name="want-stats" select="$want-stats"/>
291 </xsl:call-template>
292 </xsl:if>
293<!-- We first apply normal templates, and save the result in a variable -->
294 <xsl:variable name="processed-instr">
295 <xsl:apply-templates select="$current-instr"/>
296 </xsl:variable>
297<!-- We then process as a doc instruction -->
298 <xsl:call-template name="process-doc">
299 <xsl:with-param name="doc-instr" select="$processed-instr"/>
300 <xsl:with-param name="want-stats" select="$want-stats"/>
301 </xsl:call-template>
302 <xsl:call-template name="process-install">
303 <xsl:with-param
304 name="instruction-tree"
305 select="$instruction-tree[position()>1]"/>
306 <xsl:with-param name="want-stats" select="$want-stats"/>
307 <xsl:with-param name="root-seen" select="boolean(0)"/>
308 <xsl:with-param name="install-seen" select="boolean(0)"/>
309 <xsl:with-param name="test-seen" select="boolean(0)"/>
310 <xsl:with-param name="doc-seen" select="boolean(1)"/>
311 </xsl:call-template>
312 </xsl:when><!-- no role, remap="doc" -->
313<!--============================================================-->
314 <xsl:otherwise><!-- no role no remap -->
315 <xsl:if test="$install-seen">
316 <xsl:call-template name="end-install"/>
317 </xsl:if>
318 <xsl:if test="$root-seen">
319 <xsl:call-template name="end-root"/>
320 </xsl:if>
321 <xsl:if test="$doc-seen and not($root-seen)">
322 <xsl:call-template name="end-doc">
323 <xsl:with-param name="want-stats" select="$want-stats"/>
324 </xsl:call-template>
325 </xsl:if>
326 <xsl:if test="$test-seen">
327 <xsl:call-template name="end-test">
328 <xsl:with-param name="want-stats" select="$want-stats"/>
329 </xsl:call-template>
330 </xsl:if>
331 <xsl:apply-templates select="$current-instr"/>
332 <xsl:call-template name="process-install">
333 <xsl:with-param
334 name="instruction-tree"
335 select="$instruction-tree[position()>1]"/>
336 <xsl:with-param name="want-stats" select="$want-stats"/>
337 <xsl:with-param name="root-seen" select="boolean(0)"/>
338 <xsl:with-param name="install-seen" select="boolean(0)"/>
339 <xsl:with-param name="test-seen" select="boolean(0)"/>
340 <xsl:with-param name="doc-seen" select="boolean(0)"/>
341 </xsl:call-template>
342 </xsl:otherwise><!-- no role, no remap -->
343<!--============================================================-->
344 </xsl:choose>
345 </xsl:template>
346
347 <xsl:template match="userinput" mode="install">
348 <xsl:text>
349</xsl:text>
350 <xsl:call-template name="output-install">
351 <xsl:with-param name="out-string" select="string()"/>
352 </xsl:call-template>
353 </xsl:template>
354
355<!-- userinput templates for mode="root" and normal are in scripts.xsl -->
356
357 <xsl:template name="process-test">
358 <xsl:param name="test-instr"/>
359 <xsl:param name="want-stats"/>
360 <xsl:choose>
361 <!-- the string may begin with a linefeed -->
362 <xsl:when test="substring($test-instr,1,1)='&#xA;'">
363 <xsl:text>
364</xsl:text>
365 <xsl:call-template name="process-test">
366 <xsl:with-param name="test-instr"
367 select="substring-after($test-instr,'&#xA;')"/>
368 <xsl:with-param name="want-stats" select="$want-stats"/>
369 </xsl:call-template>
370 </xsl:when>
371 <xsl:when test="contains($test-instr,'&#xA;')">
372 <xsl:call-template name="process-test">
373 <xsl:with-param name="test-instr"
374 select="substring-before($test-instr,'&#xA;')"/>
375 <xsl:with-param name="want-stats" select="$want-stats"/>
376 </xsl:call-template>
377 <xsl:text>
378</xsl:text>
379 <xsl:call-template name="process-test">
380 <xsl:with-param name="test-instr"
381 select="substring-after($test-instr,'&#xA;')"/>
382 <xsl:with-param name="want-stats" select="$want-stats"/>
383 </xsl:call-template>
384 </xsl:when>
385 <xsl:otherwise>
386 <xsl:if test="not($want-stats)">
387 <xsl:text>#</xsl:text>
388 </xsl:if>
389 <xsl:choose>
390 <xsl:when test="contains($test-instr,'make')
391 and not(contains($test-instr,'make -k'))">
392 <xsl:copy-of select="substring-before($test-instr,'make')"/>
393 <xsl:text>make -k</xsl:text>
394 <xsl:copy-of select="substring-after($test-instr,'make')"/>
395 </xsl:when>
396 <xsl:otherwise>
397 <xsl:copy-of select="$test-instr"/>
398 </xsl:otherwise>
399 </xsl:choose>
400 <xsl:if test="substring($test-instr,
401 string-length($test-instr),
402 1)!='\'">
403 <xsl:if test="$want-stats">
404 <xsl:text> &gt;&gt; $TESTLOG 2>&amp;1</xsl:text>
405 </xsl:if>
406 <xsl:text> || true</xsl:text>
407 </xsl:if>
408 </xsl:otherwise>
409 </xsl:choose>
410 </xsl:template>
411
412 <xsl:template name="process-doc">
413 <xsl:param name="doc-instr"/>
414 <xsl:param name="want-stats"/>
415 <xsl:choose>
416 <xsl:when test="$want-stats">
417 <xsl:copy-of select="$doc-instr"/>
418 </xsl:when>
419 <xsl:otherwise>
420 <xsl:call-template name="output-comment-out">
421 <xsl:with-param name="out-string" select="$doc-instr"/>
422 </xsl:call-template>
423 </xsl:otherwise>
424 </xsl:choose>
425 </xsl:template>
426
427 <xsl:template name="output-comment-out">
428<!-- Output instructions with each line commented out. -->
429 <xsl:param name="out-string"/>
430 <xsl:choose>
431 <!-- the string may begin with a linefeed -->
432 <xsl:when test="substring($out-string,1,1)='&#xA;'">
433 <xsl:text>
434</xsl:text>
435 <xsl:call-template name="output-comment-out">
436 <xsl:with-param name="out-string"
437 select="substring-after($out-string,'&#xA;')"/>
438 </xsl:call-template>
439 </xsl:when>
440 <xsl:when test="contains($out-string,'&#xA;')">
441 <xsl:text>#</xsl:text>
442 <xsl:copy-of select="substring-before($out-string,'&#xA;')"/>
443 <xsl:text>
444</xsl:text>
445 <xsl:call-template name="output-comment-out">
446 <xsl:with-param name="out-string"
447 select="substring-after($out-string,'&#xA;')"/>
448 </xsl:call-template>
449 </xsl:when>
450 <xsl:otherwise>
451 <xsl:text>#</xsl:text>
452 <xsl:copy-of select="$out-string"/>
453 </xsl:otherwise>
454 </xsl:choose>
455 </xsl:template>
456
457 <xsl:template name="end-make">
458 <xsl:param name="want-stats"/>
459 <xsl:if test="$want-stats">
460 <xsl:text>
461
462echo Time after make: ${SECONDS} >> $INFOLOG
463echo Size after make: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG</xsl:text>
464 </xsl:if>
465 </xsl:template>
466
467 <xsl:template name="begin-doc">
468 <xsl:param name="want-stats"/>
469 <xsl:if test="$want-stats">
470 <xsl:text>
471echo Time before doc: ${SECONDS} >> $INFOLOG
472</xsl:text>
473 </xsl:if>
474 </xsl:template>
475
476 <xsl:template name="begin-test">
477 <xsl:param name="want-stats"/>
478 <xsl:if test="$want-stats">
479 <xsl:text>
480echo Time before test: ${SECONDS} >> $INFOLOG
481</xsl:text>
482 </xsl:if>
483 </xsl:template>
484
485 <xsl:template name="begin-root">
486 <xsl:if test="$sudo='y'">
487 <xsl:text>
488sudo -E sh -e &lt;&lt; ROOT_EOF
489PATH=$PATH:/usr/sbin</xsl:text>
490 </xsl:if>
491 </xsl:template>
492
493 <xsl:template name="begin-install">
494 <xsl:if test="$wrap-install = 'y'">
495 <xsl:text>
496if [ -r "$JH_PACK_INSTALL" ]; then
497 source $JH_PACK_INSTALL
498 export -f wrapInstall
499 export -f packInstall
500fi
501wrapInstall '</xsl:text>
502 </xsl:if>
503 </xsl:template>
504
505 <xsl:template name="end-doc">
506 <xsl:param name="want-stats"/>
507 <xsl:if test="$want-stats">
508 <xsl:text>
509
510echo Time after doc: ${SECONDS} >> $INFOLOG
511echo Size after doc: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG</xsl:text>
512 </xsl:if>
513 </xsl:template>
514
515 <xsl:template name="end-test">
516 <xsl:param name="want-stats"/>
517 <xsl:if test="$want-stats">
518 <xsl:text>
519
520echo Time after test: ${SECONDS} >> $INFOLOG
521echo Size after test: $(sudo du -skx --exclude home $BUILD_DIR) >> $INFOLOG</xsl:text>
522 </xsl:if>
523 </xsl:template>
524
525 <xsl:template name="end-root">
526 <xsl:if test="$sudo='y'">
527 <xsl:text>
528ROOT_EOF</xsl:text>
529 </xsl:if>
530 </xsl:template>
531
532 <xsl:template name="end-install">
533 <xsl:if test="$del-la-files = 'y'">
534 <xsl:call-template name="output-root">
535 <xsl:with-param name="out-string" select="$la-files-instr"/>
536 </xsl:call-template>
537 </xsl:if>
538 <xsl:if test="$wrap-install = 'y'">
539 <xsl:text>'&#xA;packInstall</xsl:text>
540 </xsl:if>
541 </xsl:template>
542
543 <xsl:template name="output-install">
544 <xsl:param name="out-string" select="''"/>
545 <xsl:choose>
546 <xsl:when test="starts-with($out-string, 'make ') or
547 contains($out-string,' make ') or
548 contains($out-string,'&#xA;make')">
549 <xsl:call-template name="output-install">
550 <xsl:with-param
551 name="out-string"
552 select="substring-before($out-string,'make ')"/>
553 </xsl:call-template>
554 <xsl:text>make -j1 </xsl:text>
555 <xsl:call-template name="output-install">
556 <xsl:with-param
557 name="out-string"
558 select="substring-after($out-string,'make ')"/>
559 </xsl:call-template>
560 </xsl:when>
561 <xsl:when test="contains($out-string,string($APOS))
562 and $wrap-install = 'y'">
563 <xsl:call-template name="output-root">
564 <xsl:with-param
565 name="out-string"
566 select="substring-before($out-string,string($APOS))"/>
567 </xsl:call-template>
568 <xsl:text>'\''</xsl:text>
569 <xsl:call-template name="output-install">
570 <xsl:with-param name="out-string"
571 select="substring-after($out-string,string($APOS))"/>
572 </xsl:call-template>
573 </xsl:when>
574 <xsl:otherwise>
575 <xsl:call-template name="output-root">
576 <xsl:with-param name="out-string" select="$out-string"/>
577 </xsl:call-template>
578 </xsl:otherwise>
579 </xsl:choose>
580 </xsl:template>
581
582</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.