Added a preliminar version of scripts.xsl.
Updated TODO.
This commit is contained in:
parent
7948a1ef70
commit
d6be7ea7af
3 changed files with 207 additions and 5 deletions
|
@ -19,8 +19,13 @@ What remains to do:
|
||||||
c. Run the packages.sh script.
|
c. Run the packages.sh script.
|
||||||
|
|
||||||
2. - To develop the XSL code needed to create the build scripts.
|
2. - To develop the XSL code needed to create the build scripts.
|
||||||
|
Work in progress.
|
||||||
|
|
||||||
3. - To develop the code to create the Makefile
|
3. - To develop the code to create the Makefile.
|
||||||
|
Should be a separate script to be run manually after the user has
|
||||||
|
review and edited the target build scripts.
|
||||||
|
Must make the build scripts executables and set the SRC_ARCHIVE and
|
||||||
|
FTP_SERVER envars.
|
||||||
|
|
||||||
4. - To find a way to track already installed packages by previous runs, to can
|
4. - To find a way to track already installed packages by previous runs, to can
|
||||||
skip them when creating the book/scripts/Makefile for a new target.
|
skip them when creating the book/scripts/Makefile for a new target.
|
||||||
|
|
|
@ -88,6 +88,8 @@ generate_target_book() { #
|
||||||
input vars: nothing
|
input vars: nothing
|
||||||
externals: vars: TARGET
|
externals: vars: TARGET
|
||||||
BLFS_XML
|
BLFS_XML
|
||||||
|
MAIL_SERVER
|
||||||
|
X11
|
||||||
modifies: nothing
|
modifies: nothing
|
||||||
returns: nothing
|
returns: nothing
|
||||||
output: file: NUMEROUS FILES
|
output: file: NUMEROUS FILES
|
||||||
|
@ -116,6 +118,7 @@ inline_doc
|
||||||
sh ../../$BLFS_XML/obfuscate.sh $filename
|
sh ../../$BLFS_XML/obfuscate.sh $filename
|
||||||
sed -i -e "s@text/html@application/xhtml+xml@g" $filename
|
sed -i -e "s@text/html@application/xhtml+xml@g" $filename
|
||||||
done
|
done
|
||||||
|
cd ..
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,15 +127,22 @@ inline_doc
|
||||||
create_build_scripts() { #
|
create_build_scripts() { #
|
||||||
#-------------------------#
|
#-------------------------#
|
||||||
: <<inline_doc
|
: <<inline_doc
|
||||||
function:
|
function: Create shell scripts of the requested TARGET.
|
||||||
input vars: nothing
|
input vars: nothing
|
||||||
externals: none
|
externals: TARGET
|
||||||
modifies: nothing
|
modifies: nothing
|
||||||
returns: nothing
|
returns: nothing
|
||||||
output: none
|
output: file: NUMEROUS FILES
|
||||||
on error: nothing
|
on error: nothing
|
||||||
on success: nothing
|
on success: nothing
|
||||||
inline_doc
|
inline_doc
|
||||||
|
|
||||||
echo -en "\tGenerating the build scripts ... not implemented yet, sorry\n"
|
# Log separator
|
||||||
|
echo -e "\n\tScripts generation errors:\n" >> xsltproc.log
|
||||||
|
|
||||||
|
echo -en "\tGenerating the build scripts ..."
|
||||||
|
xsltproc --xinclude --nonet \
|
||||||
|
-o ./scripts/ ../libs/scripts.xsl \
|
||||||
|
$TARGET-index.xml >> xsltproc.log 2>&1
|
||||||
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
187
BLFS/libs/scripts.xsl
Normal file
187
BLFS/libs/scripts.xsl
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:exsl="http://exslt.org/common"
|
||||||
|
extension-element-prefixes="exsl"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<!-- XSLT stylesheet to create shell scripts from BLFS books. -->
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:apply-templates select="//sect1"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--=================== Master chunks code ======================-->
|
||||||
|
|
||||||
|
<xsl:template match="sect1">
|
||||||
|
<xsl:if test="@id != 'locale-issues' and
|
||||||
|
(count(descendant::screen/userinput) > 0 and
|
||||||
|
count(descendant::screen/userinput) >
|
||||||
|
count(descendant::screen[@role='nodump']))">
|
||||||
|
<!-- The file names -->
|
||||||
|
<xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
||||||
|
<xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
||||||
|
<xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
||||||
|
<!-- Package variables BROKEN Need be fixed -->
|
||||||
|
<xsl:param name="package" select="sect1info/keywordset/keyword[@role='package']"/>
|
||||||
|
<xsl:param name="ftpdir" select="sect1info/keywordset/keyword[@role='ftpdir']"/>
|
||||||
|
<!-- The build order -->
|
||||||
|
<xsl:variable name="position" select="position()"/>
|
||||||
|
<xsl:variable name="order">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="string-length($position) = 1">
|
||||||
|
<xsl:text>00</xsl:text>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="string-length($position) = 2">
|
||||||
|
<xsl:text>0</xsl:text>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$position"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Creating dirs and files -->
|
||||||
|
<exsl:document href="{$order}-{$filename}" method="text">
|
||||||
|
<xsl:text>#!/bin/sh
set -e

</xsl:text>
|
||||||
|
<xsl:apply-templates select="sect2 | screen">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
<xsl:with-param name="ftpdir" select="$ftpdir"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
<xsl:if test="sect2[@role='package']">
|
||||||
|
<xsl:text>cd ~/sources/</xsl:text>
|
||||||
|
<xsl:value-of select="$ftpdir"/>
|
||||||
|
<xsl:text>
rm -rf $UNPACKDIR

</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>exit</xsl:text>
|
||||||
|
</exsl:document>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--======================= Sub-sections code =======================-->
|
||||||
|
|
||||||
|
<xsl:template match="sect2">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<xsl:param name="ftpdir" select="foo"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@role = 'package'">
|
||||||
|
<xsl:text>mkdir -p ~/sources/</xsl:text>
|
||||||
|
<xsl:value-of select="$ftpdir"/>
|
||||||
|
<xsl:text>
cd ~/sources/</xsl:text>
|
||||||
|
<xsl:value-of select="$ftpdir"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
<xsl:apply-templates select="itemizedlist/listitem/para">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
<xsl:with-param name="ftpdir" select="$ftpdir"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="@role = 'installation'">
|
||||||
|
<xsl:text>tar -xvf </xsl:text>
|
||||||
|
<xsl:value-of select="$package"/>
|
||||||
|
<xsl:text> > /tmp/unpacked
</xsl:text>
|
||||||
|
<xsl:text>UNPACKDIR=`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'`
</xsl:text>
|
||||||
|
<xsl:text>cd $UNPACKDIR
</xsl:text>
|
||||||
|
<xsl:apply-templates select=".//screen | .//para/command"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="@role = 'configuration'">
|
||||||
|
<xsl:apply-templates select=".//screen"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise/>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--==================== Download code =======================-->
|
||||||
|
|
||||||
|
<xsl:template match="itemizedlist/listitem/para">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<xsl:param name="ftpdir" select="foo"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains(string(),'HTTP')">
|
||||||
|
<!-- SRC_ARCHIVE may heva subdirectories or not -->
|
||||||
|
<xsl:text>cp $SRC_ARCHIVE/</xsl:text>
|
||||||
|
<xsl:value-of select="$ftpdir"/>
|
||||||
|
<xsl:text>/</xsl:text>
|
||||||
|
<xsl:value-of select="$package"/>
|
||||||
|
<xsl:text> || \
</xsl:text>
|
||||||
|
<xsl:text>cp $SRC_ARCHIVE/</xsl:text>
|
||||||
|
<xsl:value-of select="$package"/>
|
||||||
|
<xsl:text> || \
</xsl:text>
|
||||||
|
<!-- The FTP_SERVER mirror -->
|
||||||
|
<xsl:text>wget $FTP_SERVER/BLFS/conglomeration/</xsl:text>
|
||||||
|
<xsl:value-of select="$ftpdir"/>
|
||||||
|
<xsl:text>/</xsl:text>
|
||||||
|
<xsl:value-of select="$package"/>
|
||||||
|
<xsl:text> || \
</xsl:text>
|
||||||
|
<!-- Upstream HTTP URL -->
|
||||||
|
<xsl:text>wget </xsl:text>
|
||||||
|
<xsl:value-of select="ulink/@url"/>
|
||||||
|
<xsl:text> || \
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'FTP')">
|
||||||
|
<!-- Upstream FTP URL -->
|
||||||
|
<xsl:text>wget </xsl:text>
|
||||||
|
<xsl:value-of select="ulink/@url"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="contains(string(),'MD5')">
|
||||||
|
<xsl:text>echo "</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
||||||
|
<xsl:text>  </xsl:text>
|
||||||
|
<xsl:value-of select="$package"/>
|
||||||
|
<xsl:text>" | md5sum -c -
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Patches. Need be veryfied -->
|
||||||
|
<xsl:when test="contains(string(),'patch')">
|
||||||
|
<xsl:text>wget </xsl:text>
|
||||||
|
<xsl:value-of select="ulink/@url"/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise/>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!--======================== Commands code ==========================-->
|
||||||
|
|
||||||
|
<xsl:template match="screen">
|
||||||
|
<xsl:if test="child::* = userinput">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@role = 'nodump'"/>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:if test="@role = 'root'">
|
||||||
|
<xsl:text>sudo </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-templates select="userinput" mode="screen"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="para/command">
|
||||||
|
<xsl:if test="(contains(string(),'test') or
|
||||||
|
contains(string(),'check'))">
|
||||||
|
<xsl:text>#</xsl:text>
|
||||||
|
<xsl:value-of select="substring-before(string(),'make')"/>
|
||||||
|
<xsl:text>make -k</xsl:text>
|
||||||
|
<xsl:value-of select="substring-after(string(),'make')"/>
|
||||||
|
<xsl:text> || true
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="userinput" mode="screen">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="replaceable">
|
||||||
|
<xsl:text>**EDITME</xsl:text>
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
<xsl:text>EDITME**</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
Reference in a new issue