BLFS: fix generation of install and test instructions (ticket #1721):
- add a gen-install.xsl stylesheet for grouping all cases - add a mode="installation" attribute for templates - rewrite sect2 template so that the right templates are applied - adapt other templates so that they are compatible - rewording of some comments (no direct relation with the ticket)
This commit is contained in:
parent
bc2f5913e6
commit
c048987a2c
2 changed files with 412 additions and 187 deletions
257
BLFS/xsl/gen-install.xsl
Normal file
257
BLFS/xsl/gen-install.xsl
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="screen" mode="installation">
|
||||||
|
<!-- "nature" variables:
|
||||||
|
- 'non-root': executable as user
|
||||||
|
- 'config': execute as root, with no special formatting
|
||||||
|
- 'install': execute as root, with PKG_DEST or escape instructions
|
||||||
|
- 'none': does not exist (for preceding of following uniquely)
|
||||||
|
-->
|
||||||
|
<xsl:variable name="my-nature">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="not(@role)">
|
||||||
|
<xsl:text>non-root</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'useradd') or
|
||||||
|
contains(string(),'groupadd') or
|
||||||
|
contains(string(),'usermod') or
|
||||||
|
contains(string(),'icon-cache') or
|
||||||
|
contains(string(),'desktop-database') or
|
||||||
|
contains(string(),'compile-schemas') or
|
||||||
|
contains(string(),'query-loaders') or
|
||||||
|
contains(string(),'pam.d') or
|
||||||
|
contains(string(),'query-immodules')">
|
||||||
|
<xsl:text>config</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>install</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:variable
|
||||||
|
name="prec-string"
|
||||||
|
select="string(preceding-sibling::screen[not(@role='nodump') and
|
||||||
|
./userinput][1])"/>
|
||||||
|
<!--
|
||||||
|
<xsl:message>
|
||||||
|
<xsl:text>
|
||||||
|
==============================
|
||||||
|
List of preceding siblings for "</xsl:text>
|
||||||
|
<xsl:value-of select="./userinput"/>
|
||||||
|
<xsl:text>":
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:for-each select="preceding-sibling::screen[not(@role='nodump') and
|
||||||
|
./userinput] |
|
||||||
|
preceding-sibling::para/command">
|
||||||
|
<xsl:copy-of select=".//text()"/>
|
||||||
|
<xsl:text>
|
||||||
|
===
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:message>
|
||||||
|
-->
|
||||||
|
<xsl:variable name="prec-nature">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when
|
||||||
|
test="$prec-string='' or
|
||||||
|
(preceding-sibling::screen[not(@role='nodump') and
|
||||||
|
./userinput] |
|
||||||
|
preceding-sibling::para/command[contains(text(),'check') or
|
||||||
|
contains(text(),'test')]
|
||||||
|
)[last()][self::command]">
|
||||||
|
<xsl:text>none</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when
|
||||||
|
test="preceding-sibling::screen
|
||||||
|
[not(@role='nodump') and ./userinput][1][not(@role)]">
|
||||||
|
<xsl:text>non-root</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains($prec-string,'useradd') or
|
||||||
|
contains($prec-string,'groupadd') or
|
||||||
|
contains($prec-string,'usermod') or
|
||||||
|
contains($prec-string,'icon-cache') or
|
||||||
|
contains($prec-string,'desktop-database') or
|
||||||
|
contains($prec-string,'compile-schemas') or
|
||||||
|
contains($prec-string,'query-loaders') or
|
||||||
|
contains($prec-string,'pam.d') or
|
||||||
|
contains($prec-string,'query-immodules')">
|
||||||
|
<xsl:text>config</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>install</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:variable
|
||||||
|
name="follow-string"
|
||||||
|
select="string(following-sibling::screen[not(@role='nodump') and
|
||||||
|
./userinput][1])"/>
|
||||||
|
|
||||||
|
<xsl:variable name="follow-nature">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when
|
||||||
|
test="$follow-string='' or
|
||||||
|
(following-sibling::screen[not(@role='nodump') and
|
||||||
|
./userinput] |
|
||||||
|
following-sibling::para/command[contains(text(),'check') or
|
||||||
|
contains(text(),'test')]
|
||||||
|
)[1][self::command]">
|
||||||
|
<xsl:text>none</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when
|
||||||
|
test="following-sibling::screen
|
||||||
|
[not(@role='nodump') and ./userinput][1][not(@role)]">
|
||||||
|
<xsl:text>non-root</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains($follow-string,'useradd') or
|
||||||
|
contains($follow-string,'groupadd') or
|
||||||
|
contains($follow-string,'usermod') or
|
||||||
|
contains($follow-string,'icon-cache') or
|
||||||
|
contains($follow-string,'desktop-database') or
|
||||||
|
contains($follow-string,'compile-schemas') or
|
||||||
|
contains($follow-string,'query-loaders') or
|
||||||
|
contains($follow-string,'pam.d') or
|
||||||
|
contains($follow-string,'query-immodules')">
|
||||||
|
<xsl:text>config</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>install</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$my-nature='non-root'">
|
||||||
|
<xsl:if test="$prec-nature='install'">
|
||||||
|
<xsl:call-template name="end-install"/>
|
||||||
|
<xsl:call-template name="end-root"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$prec-nature='config'">
|
||||||
|
<xsl:call-template name="end-root"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
|
||||||
|
<xsl:when test="$my-nature='config'">
|
||||||
|
<xsl:if test="$prec-nature='none' or $prec-nature='non-root'">
|
||||||
|
<xsl:call-template name="begin-root"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$prec-nature='install'">
|
||||||
|
<xsl:call-template name="end-install"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-templates mode="root"/>
|
||||||
|
<xsl:text>
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:if test="$follow-nature='none'">
|
||||||
|
<xsl:call-template name="end-root"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:when>
|
||||||
|
|
||||||
|
<xsl:when test="$my-nature='install'">
|
||||||
|
<xsl:if test="$prec-nature='none' or $prec-nature='non-root'">
|
||||||
|
<xsl:if test="contains($list-stat-norm,
|
||||||
|
concat(' ',ancestor::sect1/@id,' '))">
|
||||||
|
<xsl:call-template name="output-destdir"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:call-template name="begin-root"/>
|
||||||
|
<xsl:call-template name="begin-install"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$prec-nature='config'">
|
||||||
|
<xsl:if test="contains($list-stat-norm,
|
||||||
|
concat(' ',ancestor::sect1/@id,' '))">
|
||||||
|
<xsl:call-template name="end-root"/>
|
||||||
|
<xsl:call-template name="output-destdir"/>
|
||||||
|
<xsl:call-template name="begin-root"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:call-template name="begin-install"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-templates mode="install"/>
|
||||||
|
<xsl:text>
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:if test="$follow-nature='none'">
|
||||||
|
<xsl:call-template name="end-install"/>
|
||||||
|
<xsl:call-template name="end-root"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:when>
|
||||||
|
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="begin-root">
|
||||||
|
<xsl:if test="$sudo='y'">
|
||||||
|
<xsl:text>sudo -E sh << ROOT_EOF
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="begin-install">
|
||||||
|
<xsl:if test="$wrap-install = 'y'">
|
||||||
|
<xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
|
||||||
|
source $JH_PACK_INSTALL
|
||||||
|
export -f wrapInstall
|
||||||
|
export -f packInstall
|
||||||
|
fi
|
||||||
|
wrapInstall '
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="end-root">
|
||||||
|
<xsl:if test="$sudo='y'">
|
||||||
|
<xsl:text>ROOT_EOF
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="end-install">
|
||||||
|
<xsl:if test="$del-la-files = 'y'">
|
||||||
|
<xsl:call-template name="output-root">
|
||||||
|
<xsl:with-param name="out-string" select="$la-files-instr"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$wrap-install = 'y'">
|
||||||
|
<xsl:text>'
packInstall
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="text()" mode="install">
|
||||||
|
<xsl:call-template name="output-install">
|
||||||
|
<xsl:with-param name="out-string" select="."/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="output-install">
|
||||||
|
<xsl:param name="out-string" select="''"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($out-string,string($APOS))
|
||||||
|
and $wrap-install = 'y'">
|
||||||
|
<xsl:call-template name="output-root">
|
||||||
|
<xsl:with-param
|
||||||
|
name="out-string"
|
||||||
|
select="substring-before($out-string,string($APOS))"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:text>'\''</xsl:text>
|
||||||
|
<xsl:call-template name="output-install">
|
||||||
|
<xsl:with-param name="out-string"
|
||||||
|
select="substring-after($out-string,string($APOS))"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="output-root">
|
||||||
|
<xsl:with-param name="out-string" select="."/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
|
||||||
|
|
||||||
<!-- Check whether the book is sysv or systemd -->
|
<!-- parameters and global variables -->
|
||||||
|
<!-- Check whether the book is sysv or systemd -->
|
||||||
<xsl:variable name="rev">
|
<xsl:variable name="rev">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
<xsl:when test="//bookinfo/title/phrase[@revision='systemd']">
|
||||||
|
@ -80,64 +81,74 @@ done
|
||||||
|
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:variable name="list-stat-norm"
|
<xsl:variable name="list-stat-norm"
|
||||||
select="concat(' ', normalize-space($list-stat),' ')"/>
|
select="concat(' ', normalize-space($list-stat),' ')"/>
|
||||||
|
|
||||||
|
<!-- To be able to use the single quote in tests -->
|
||||||
|
<xsl:variable name="APOS">'</xsl:variable>
|
||||||
|
|
||||||
|
<!-- end parameters and global variables -->
|
||||||
|
|
||||||
|
<!-- include the templates for the screen children of role="install" sect2 -->
|
||||||
|
<xsl:include href="gen-install.xsl"/>
|
||||||
|
|
||||||
|
<!--=================== Begin processing ========================-->
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<xsl:apply-templates select="//sect1"/>
|
<xsl:apply-templates select="//sect1[@id != 'bootscripts' and
|
||||||
|
@id != 'systemd-units']"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!--=================== Master chunks code ======================-->
|
<!--=================== Master chunks code ======================-->
|
||||||
|
|
||||||
<xsl:template match="sect1">
|
<xsl:template match="sect1">
|
||||||
|
|
||||||
<xsl:if test="@id != 'bootscripts' and @id != 'systemd-units'">
|
<!-- The file names -->
|
||||||
<!-- The file names -->
|
<xsl:variable name="filename" select="@id"/>
|
||||||
<xsl:variable name="filename" select="@id"/>
|
|
||||||
|
|
||||||
<!-- The build order -->
|
<!-- The build order -->
|
||||||
<xsl:variable name="position" select="position()"/>
|
<xsl:variable name="position" select="position()"/>
|
||||||
<xsl:variable name="order">
|
<xsl:variable name="order">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="string-length($position) = 1">
|
<xsl:when test="string-length($position) = 1">
|
||||||
<xsl:text>00</xsl:text>
|
<xsl:text>00</xsl:text>
|
||||||
<xsl:value-of select="$position"/>
|
<xsl:value-of select="$position"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="string-length($position) = 2">
|
<xsl:when test="string-length($position) = 2">
|
||||||
<xsl:text>0</xsl:text>
|
<xsl:text>0</xsl:text>
|
||||||
<xsl:value-of select="$position"/>
|
<xsl:value-of select="$position"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$position"/>
|
<xsl:value-of select="$position"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<!-- Depuration code -->
|
<!-- Depuration code -->
|
||||||
<xsl:message>
|
<xsl:message>
|
||||||
<xsl:text>SCRIPT is </xsl:text>
|
<xsl:text>SCRIPT is </xsl:text>
|
||||||
<xsl:value-of select="concat($order,'-z-',$filename)"/>
|
<xsl:value-of select="concat($order,'-z-',$filename)"/>
|
||||||
<xsl:text>
 FTPDIR is </xsl:text>
|
<xsl:text>
 FTPDIR is </xsl:text>
|
||||||
<xsl:value-of select="$filename"/>
|
<xsl:value-of select="$filename"/>
|
||||||
<xsl:text>

</xsl:text>
|
<xsl:text>

</xsl:text>
|
||||||
</xsl:message>
|
</xsl:message>
|
||||||
|
|
||||||
<!-- Creating the scripts -->
|
<!-- Creating the scripts -->
|
||||||
<exsl:document href="{$order}-z-{$filename}" method="text">
|
<exsl:document href="{$order}-z-{$filename}" method="text">
|
||||||
<xsl:text>#!/bin/bash
|
<xsl:text>#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
unset MAKELEVEL
|
unset MAKELEVEL
|
||||||
|
<!-- the above is needed for some packages -->
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<!-- Package page -->
|
<!-- Package page -->
|
||||||
<xsl:when test="sect2[@role='package']">
|
<xsl:when test="sect2[@role='package']">
|
||||||
<!-- We build in a subdirectory, whose name may be needed
|
<!-- We build in a subdirectory, whose name may be needed
|
||||||
if using package management (see envars.conf), so
|
if using package management (see envars.conf), so
|
||||||
"export" it -->
|
"export" it -->
|
||||||
<xsl:text>export JH_PKG_DIR=</xsl:text>
|
<xsl:text>export JH_PKG_DIR=</xsl:text>
|
||||||
<xsl:value-of select="$filename"/>
|
<xsl:value-of select="$filename"/>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
|
||||||
BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
|
||||||
mkdir -p $SRC_DIR
|
mkdir -p $SRC_DIR
|
||||||
|
@ -146,54 +157,56 @@ mkdir -p $BUILD_DIR
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
|
||||||
<!-- If stats are requested, include some definitions and intitializations -->
|
<!-- If stats are requested, include some definitions and intitializations -->
|
||||||
<xsl:if test="contains($list-stat-norm,concat(' ',@id,' '))">
|
<xsl:if test="contains($list-stat-norm,concat(' ',@id,' '))">
|
||||||
<xsl:text>INFOLOG=$(pwd)/info-${JH_PKG_DIR}
|
<xsl:text>INFOLOG=$(pwd)/info-${JH_PKG_DIR}
|
||||||
TESTLOG=$(pwd)/test-${JH_PKG_DIR}
|
TESTLOG=$(pwd)/test-${JH_PKG_DIR}
|
||||||
unset MAKEFLAGS
|
unset MAKEFLAGS
|
||||||
#MAKEFLAGS=-j4
|
#MAKEFLAGS=-j4
|
||||||
echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
|
echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
|
||||||
> $TESTLOG
|
: > $TESTLOG
|
||||||
PKG_DEST=${BUILD_DIR}/dest
|
PKG_DEST=${BUILD_DIR}/dest
|
||||||
rm -rf $PKG_DEST
|
rm -rf $PKG_DEST
|
||||||
|
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<!-- Download code and build commands -->
|
<!-- Download code and build commands -->
|
||||||
<xsl:apply-templates select="sect2"/>
|
<xsl:apply-templates select="sect2"/>
|
||||||
<!-- Clean-up -->
|
<!-- Clean-up -->
|
||||||
<xsl:text>cd $BUILD_DIR
|
<xsl:text>cd $BUILD_DIR
|
||||||
[[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
[[ -n "$JH_KEEP_FILES" ]] || </xsl:text>
|
||||||
<!-- In some case, some files in the build tree are owned
|
<!-- In some case, some files in the build tree are owned
|
||||||
by root -->
|
by root -->
|
||||||
<xsl:if test="$sudo='y'">
|
<xsl:if test="$sudo='y'">
|
||||||
<xsl:text>sudo </xsl:text>
|
<xsl:text>sudo </xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>rm -rf $JH_UNPACKDIR unpacked

</xsl:text>
|
<xsl:text>rm -rf $JH_UNPACKDIR unpacked

</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- Non-package page -->
|
<!-- Non-package page -->
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:apply-templates select=".//screen" mode="not-pack"/>
|
<xsl:apply-templates select=".//screen" mode="not-pack"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text>exit</xsl:text>
|
<xsl:text>exit</xsl:text>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
</xsl:if><!-- id!=bootscript or id!=systemd-units -->
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!--======================= Sub-sections code =======================-->
|
<!--======================= Sub-sections code =======================-->
|
||||||
|
|
||||||
<xsl:template match="sect2">
|
<xsl:template match="sect2">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
|
|
||||||
<xsl:when test="@role = 'package'">
|
<xsl:when test="@role = 'package'">
|
||||||
<xsl:text>cd $SRC_DIR
|
<xsl:text>cd $SRC_DIR
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
<!-- Download information is in bridgehead tags -->
|
<!-- Download information is in bridgehead tags -->
|
||||||
<xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
<xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when><!-- @role="package" -->
|
||||||
|
|
||||||
<xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
<xsl:when test="@role = 'qt4-prefix' or @role = 'qt5-prefix'">
|
||||||
<xsl:apply-templates select=".//screen[./userinput]"/>
|
<xsl:apply-templates select=".//screen[./userinput]"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
|
||||||
<xsl:when test="@role = 'installation'">
|
<xsl:when test="@role = 'installation'">
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
|
@ -248,17 +261,21 @@ cd $JH_UNPACKDIR

|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
|
mode="installation"
|
||||||
select=".//screen[not(@role = 'nodump') and ./userinput] |
|
select=".//screen[not(@role = 'nodump') and ./userinput] |
|
||||||
.//para/command"/>
|
.//para/command[contains(text(),'check') or
|
||||||
|
contains(text(),'test')]"/>
|
||||||
<xsl:if test="$sudo = 'y'">
|
<xsl:if test="$sudo = 'y'">
|
||||||
<xsl:text>sudo /sbin/</xsl:text>
|
<xsl:text>sudo /sbin/</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:text>ldconfig

</xsl:text>
|
<xsl:text>ldconfig

</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when><!-- @role="installation" -->
|
||||||
|
|
||||||
<xsl:when test="@role = 'configuration'">
|
<xsl:when test="@role = 'configuration'">
|
||||||
<xsl:apply-templates mode="config"
|
<xsl:apply-templates mode="config"
|
||||||
select=".//screen[not(@role = 'nodump') and ./userinput]"/>
|
select=".//screen[not(@role = 'nodump') and ./userinput]"/>
|
||||||
</xsl:when>
|
</xsl:when><!-- @role="configuration" -->
|
||||||
|
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
@ -517,75 +534,30 @@ EOF
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<!--======================== Commands code ==========================-->
|
<!--======================== Commands code ==========================-->
|
||||||
|
<!-- Code for installation instructions is in gen-install.xsl -->
|
||||||
|
|
||||||
<xsl:template match="screen">
|
<xsl:template match="screen">
|
||||||
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
<xsl:choose>
|
||||||
<xsl:choose>
|
<!-- instructions run as root (configuration mainly) -->
|
||||||
<!-- First the case of installation instructions -->
|
<xsl:when test="@role = 'root'">
|
||||||
<xsl:when test="@role = 'root' and
|
<xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
||||||
ancestor::sect2[@role='installation'] and
|
<xsl:if test="$sudo = 'y'">
|
||||||
not(contains(string(),'useradd')) and
|
<xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
||||||
not(contains(string(),'usermod')) and
|
|
||||||
not(contains(string(),'icon-cache')) and
|
|
||||||
not(contains(string(),'desktop-database')) and
|
|
||||||
not(contains(string(),'compile-schemas')) and
|
|
||||||
not(contains(string(),'groupadd'))">
|
|
||||||
<xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
|
||||||
<xsl:if test="contains($list-stat-norm,
|
|
||||||
concat(' ',
|
|
||||||
ancestor::sect1/@id,
|
|
||||||
' '))">
|
|
||||||
<xsl:call-template name="output-destdir"/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="$sudo = 'y'">
|
|
||||||
<xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="$wrap-install = 'y'">
|
|
||||||
<xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
|
|
||||||
source $JH_PACK_INSTALL
|
|
||||||
export -f wrapInstall
|
|
||||||
export -f packInstall
|
|
||||||
fi
|
|
||||||
wrapInstall '
|
|
||||||
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:apply-templates mode="root"/>
|
</xsl:if>
|
||||||
<xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
<xsl:apply-templates mode="root"/>
|
||||||
<xsl:if test="$del-la-files = 'y'">
|
<xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
||||||
<xsl:call-template name="output-root">
|
<xsl:if test="$sudo = 'y'">
|
||||||
<xsl:with-param name="out-string" select="$la-files-instr"/>
|
<xsl:text>
ROOT_EOF</xsl:text>
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="$wrap-install = 'y'">
|
|
||||||
<xsl:text>'
packInstall</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:if test="$sudo = 'y'">
|
|
||||||
<xsl:text>
ROOT_EOF</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:when>
|
</xsl:if>
|
||||||
<!-- then the case of other instructions run as root (configuration mainly) -->
|
</xsl:when>
|
||||||
<xsl:when test="@role = 'root'">
|
|
||||||
<xsl:if test="not(preceding-sibling::screen[1][@role='root'])">
|
|
||||||
<xsl:if test="$sudo = 'y'">
|
|
||||||
<xsl:text>sudo -E sh << ROOT_EOF
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:apply-templates mode="root"/>
|
|
||||||
<xsl:if test="not(following-sibling::screen[1][@role='root'])">
|
|
||||||
<xsl:if test="$sudo = 'y'">
|
|
||||||
<xsl:text>
ROOT_EOF</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:when>
|
|
||||||
<!-- then all the instructions run as user -->
|
<!-- then all the instructions run as user -->
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:apply-templates select="userinput"/>
|
<xsl:apply-templates select="userinput"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="set-bootpkg-dir">
|
<xsl:template name="set-bootpkg-dir">
|
||||||
|
@ -652,42 +624,61 @@ popd</xsl:text>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="para/command">
|
<xsl:template match="command" mode="installation">
|
||||||
<xsl:variable name="ns" select="normalize-space(string())"/>
|
<xsl:variable name="ns" select="normalize-space(string())"/>
|
||||||
<xsl:if test="contains($ns,'test') or
|
<xsl:variable name="first"
|
||||||
contains($ns,'check')">
|
select="not(
|
||||||
<xsl:choose>
|
boolean(
|
||||||
<xsl:when test="contains($list-stat-norm,
|
preceding-sibling::command[contains(text(),'check') or
|
||||||
concat(' ',ancestor::sect1/@id,' '))">
|
contains(text(),'test')]))"/>
|
||||||
|
<xsl:variable name="last"
|
||||||
|
select="not(
|
||||||
|
boolean(
|
||||||
|
following-sibling::command[contains(text(),'check') or
|
||||||
|
contains(text(),'test')]))"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($list-stat-norm,
|
||||||
|
concat(' ',ancestor::sect1/@id,' '))">
|
||||||
|
<xsl:if test="$first">
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
echo Time after make: ${SECONDS} >> $INFOLOG
|
echo Time after make: ${SECONDS} >> $INFOLOG
|
||||||
echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG
|
echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG
|
||||||
echo Time before test: ${SECONDS} >> $INFOLOG
|
echo Time before test: ${SECONDS} >> $INFOLOG
|
||||||
|
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
</xsl:when>
|
</xsl:if>
|
||||||
<xsl:otherwise>
|
</xsl:when>
|
||||||
<xsl:text>#</xsl:text>
|
<xsl:otherwise>
|
||||||
</xsl:otherwise>
|
<xsl:text>#</xsl:text>
|
||||||
</xsl:choose>
|
</xsl:otherwise>
|
||||||
<xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:when test="contains($ns,'make')">
|
<xsl:choose>
|
||||||
<xsl:value-of select="substring-before($ns,'make ')"/>
|
<xsl:when test="contains($ns,'make')">
|
||||||
<xsl:text>make </xsl:text>
|
<xsl:value-of select="substring-before($ns,'make ')"/>
|
||||||
<xsl:if test="not(contains($ns,'-k'))">
|
<xsl:text>make </xsl:text>
|
||||||
<xsl:text>-k </xsl:text>
|
<xsl:if test="not(contains($ns,'-k'))">
|
||||||
</xsl:if>
|
<xsl:text>-k </xsl:text>
|
||||||
<xsl:value-of select="substring-after($ns,'make ')"/>
|
</xsl:if>
|
||||||
</xsl:when>
|
<xsl:value-of select="substring-after($ns,'make ')"/>
|
||||||
<xsl:otherwise>
|
</xsl:when>
|
||||||
<xsl:copy-of select="$ns"/>
|
<xsl:otherwise>
|
||||||
</xsl:otherwise>
|
<xsl:copy-of select="$ns"/>
|
||||||
</xsl:choose>
|
</xsl:otherwise>
|
||||||
<xsl:if test="contains($list-stat-norm,
|
</xsl:choose>
|
||||||
concat(' ',ancestor::sect1/@id,' '))">
|
<xsl:if test="contains($list-stat-norm,
|
||||||
<xsl:text> >> $TESTLOG 2>&1</xsl:text>
|
concat(' ',ancestor::sect1/@id,' '))">
|
||||||
</xsl:if>
|
<xsl:text> >> $TESTLOG 2>&1</xsl:text>
|
||||||
<xsl:text> || true
</xsl:text>
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
<xsl:if test="contains($list-stat-norm,
|
||||||
|
concat(' ',ancestor::sect1/@id,' ')) and $last">
|
||||||
|
<xsl:text>
|
||||||
|
echo Time after test: ${SECONDS} >> $INFOLOG
|
||||||
|
echo Size after test: $(sudo du -skx --exclude home /) >> $INFOLOG
|
||||||
|
echo Time before install: ${SECONDS} >> $INFOLOG
|
||||||
|
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="userinput">
|
<xsl:template match="userinput">
|
||||||
|
@ -700,8 +691,6 @@ echo Time before test: ${SECONDS} >> $INFOLOG
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:variable name="APOS">'</xsl:variable>
|
|
||||||
|
|
||||||
<xsl:template name="output-root">
|
<xsl:template name="output-root">
|
||||||
<xsl:param name="out-string" select="''"/>
|
<xsl:param name="out-string" select="''"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
|
@ -749,19 +738,6 @@ echo Time before test: ${SECONDS} >> $INFOLOG
|
||||||
select="substring-after($out-string,'\')"/>
|
select="substring-after($out-string,'\')"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="contains($out-string,string($APOS))
|
|
||||||
and $wrap-install = 'y'
|
|
||||||
and ancestor::sect2[@role='installation']">
|
|
||||||
<xsl:call-template name="output-root">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-before($out-string,string($APOS))"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text>'\''</xsl:text>
|
|
||||||
<xsl:call-template name="output-root">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-after($out-string,string($APOS))"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$out-string"/>
|
<xsl:value-of select="$out-string"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
|
@ -829,14 +805,6 @@ echo Time before test: ${SECONDS} >> $INFOLOG
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="output-destdir">
|
<xsl:template name="output-destdir">
|
||||||
<!-- Hopefully, the current node is the first screen with role equal to root.
|
|
||||||
We first output stats, since we are only called if stats are needed.
|
|
||||||
then we output DESTDIR instructions,etc -->
|
|
||||||
<xsl:text>
|
|
||||||
echo Time after tests: ${SECONDS} >> $INFOLOG
|
|
||||||
echo Size after tests: $(sudo du -skx --exclude home /) >> $INFOLOG
|
|
||||||
echo Time before install: ${SECONDS} >> $INFOLOG
|
|
||||||
</xsl:text>
|
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="userinput|following-sibling::screen[@role='root']/userinput"
|
select="userinput|following-sibling::screen[@role='root']/userinput"
|
||||||
mode="destdir"/>
|
mode="destdir"/>
|
||||||
|
|
Reference in a new issue