Improve script generation for BLFS tools:
- introduce a template for downloading code - account for various layout of the BLFS pages for package information and additional downloads - Add the possibility for addtional downloads in xorg pages
This commit is contained in:
parent
2ae5bbe4f0
commit
642722f5c1
2 changed files with 205 additions and 322 deletions
|
@ -349,6 +349,14 @@
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
<!-- If there is an additional download, we need to output that -->
|
||||||
|
<xsl:if test=".//bridgehead[contains(string(),'Additional')]">
|
||||||
|
<xsl:copy-of
|
||||||
|
select=".//bridgehead[contains(string(),'Additional')]"/>
|
||||||
|
<xsl:copy-of
|
||||||
|
select=".//bridgehead[contains(string(),'Additional')]
|
||||||
|
/following-sibling::itemizedlist[1]"/>
|
||||||
|
</xsl:if>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 role="installation">
|
<sect2 role="installation">
|
||||||
<title>Installation of <xsl:value-of select="$package"/></title>
|
<title>Installation of <xsl:value-of select="$package"/></title>
|
||||||
|
|
|
@ -56,50 +56,21 @@
|
||||||
<xsl:text>#!/bin/bash
set -e

</xsl:text>
|
<xsl:text>#!/bin/bash
set -e

</xsl:text>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<!-- Package page -->
|
<!-- Package page -->
|
||||||
<xsl:when test="sect2[@role='package'] and not(@id = 'xorg7-app' or
|
<xsl:when test="sect2[@role='package']">
|
||||||
@id = 'xorg7-data' or @id = 'xorg7-driver' or
|
<!-- We build in a subdirectory -->
|
||||||
@id = 'xorg7-font' or @id = 'xorg7-lib' or
|
<xsl:text>PKG_DIR=</xsl:text>
|
||||||
@id = 'xorg7-proto' or @id = 'xorg7-util')">
|
|
||||||
<!-- Variables -->
|
|
||||||
<!-- These three lines could be important if SRC_ARCHIVE,
|
|
||||||
FTP_SERVER and SRCDIR were not set in the environment.
|
|
||||||
But they are not tested for length or anything later,
|
|
||||||
so not needed
|
|
||||||
<xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
</xsl:text>
|
|
||||||
<xsl:text>FTP_SERVER=$FTP_SERVER
</xsl:text>
|
|
||||||
<xsl:text>SRC_DIR=$SRC_DIR

</xsl:text>-->
|
|
||||||
<xsl:text>
PKG_DIR=</xsl:text>
|
|
||||||
<xsl:value-of select="$filename"/>
|
<xsl:value-of select="$filename"/>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
<!-- Download code and build commands -->
|
<!-- Download code and build commands -->
|
||||||
<xsl:apply-templates select="sect2"/>
|
<xsl:apply-templates select="sect2"/>
|
||||||
<!-- Clean-up -->
|
<!-- Clean-up -->
|
||||||
<!-- xorg7-server used to require mesalib tree being present.
|
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
||||||
That is no more true
|
|
||||||
<xsl:if test="not(@id='mesalib')"> -->
|
|
||||||
<xsl:text>cd $SRC_DIR/$PKG_DIR
</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:text>rm -rf $UNPACKDIR unpacked

</xsl:text>
|
|
||||||
<!-- Same reason as preceding comment
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="@id='xorg7-server'">
|
<xsl:text>rm -rf $UNPACKDIR unpacked

</xsl:text>
|
||||||
<xsl:text>cd $SRC_DIR/MesaLib
|
|
||||||
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^./@@;s@/.*@@'`
|
|
||||||
rm -rf $UNPACKDIR unpacked

</xsl:text>
|
|
||||||
</xsl:if> -->
|
|
||||||
</xsl:when>
|
|
||||||
<!-- Xorg7 pseudo-packages -->
|
|
||||||
<xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
|
|
||||||
<xsl:text># Useless SRC_DIR=$SRC_DIR
|
|
||||||
|
|
||||||
cd $SRC_DIR
|
|
||||||
mkdir -p xc
|
|
||||||
cd xc
</xsl:text>
|
|
||||||
<xsl:apply-templates select="sect2" mode="xorg7"/>
|
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- Non-package page -->
|
<!-- Non-package page -->
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
@ -118,6 +89,7 @@ cd xc
</xsl:text>
|
||||||
<xsl:when test="@role = 'package'">
|
<xsl:when test="@role = 'package'">
|
||||||
<xsl:text>mkdir -p $SRC_DIR/$PKG_DIR
</xsl:text>
|
<xsl:text>mkdir -p $SRC_DIR/$PKG_DIR
</xsl:text>
|
||||||
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
||||||
|
<!-- 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>
|
||||||
|
@ -135,7 +107,7 @@ else
|
||||||
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
|
[[ -n $UNPACKDIR ]] && [[ -d $UNPACKDIR ]] && rm -rf $UNPACKDIR
|
||||||
unzip -d $UNPACKDIR ${PACKAGE}
|
unzip -d $UNPACKDIR ${PACKAGE}
|
||||||
fi
|
fi
|
||||||
cd $UNPACKDIR
</xsl:text>
|
cd $UNPACKDIR

</xsl:text>
|
||||||
<xsl:apply-templates select=".//screen | .//para/command"/>
|
<xsl:apply-templates select=".//screen | .//para/command"/>
|
||||||
<xsl:if test="$sudo = 'y'">
|
<xsl:if test="$sudo = 'y'">
|
||||||
<xsl:text>sudo /sbin/</xsl:text>
|
<xsl:text>sudo /sbin/</xsl:text>
|
||||||
|
@ -148,32 +120,12 @@ cd $UNPACKDIR
</xsl:text>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="sect2" mode="xorg7">
|
|
||||||
<xsl:choose>
|
|
||||||
<!-- <xsl:when test="@role = 'package'">
|
|
||||||
<xsl:apply-templates select="itemizedlist/listitem/para" mode="xorg7"/>
|
|
||||||
</xsl:when>-->
|
|
||||||
<xsl:when test="not(@role)">
|
|
||||||
<!-- This is the packages download instructions> -->
|
|
||||||
<xsl:apply-templates select=".//screen" mode="xorg7"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="@role = 'installation'">
|
|
||||||
<xsl:apply-templates select=".//screen" mode="xorg7"/>
|
|
||||||
<xsl:if test="$sudo = 'y'">
|
|
||||||
<xsl:text>sudo /sbin/</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text>ldconfig

</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="@role = 'configuration'">
|
|
||||||
<xsl:text>if [[ $XORG_PREFIX != /usr ]] ; then
</xsl:text>
|
|
||||||
<xsl:apply-templates select=".//screen"/>
|
|
||||||
<xsl:text>fi
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!--==================== Download code =======================-->
|
<!--==================== Download code =======================-->
|
||||||
|
|
||||||
|
<!-- template for extracting the filename from an url in the form:
|
||||||
|
proto://internet.name/dir1/.../dirn/filename?condition.
|
||||||
|
Needed, because substring-after(...,'/') returns only the
|
||||||
|
substring after the first '/'. -->
|
||||||
<xsl:template name="package_name">
|
<xsl:template name="package_name">
|
||||||
<xsl:param name="url" select="foo"/>
|
<xsl:param name="url" select="foo"/>
|
||||||
<xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
<xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
||||||
|
@ -196,207 +148,208 @@ cd $UNPACKDIR
</xsl:text>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="bridgehead">
|
<!-- Generates the code to download a package, an additional package or
|
||||||
<xsl:choose>
|
a patch. -->
|
||||||
<xsl:when test="string()='Package Information'">
|
<xsl:template name="download-file">
|
||||||
<xsl:variable name="url">
|
<xsl:param name="httpurl" select="''"/>
|
||||||
|
<xsl:param name="ftpurl" select="''"/>
|
||||||
|
<xsl:param name="md5" select="''"/>
|
||||||
|
<xsl:param name="varname" select="''"/>
|
||||||
|
<xsl:variable name="package">
|
||||||
|
<xsl:call-template name="package_name">
|
||||||
|
<xsl:with-param name="url">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when
|
<xsl:when test="string-length($httpurl) > 10">
|
||||||
test="string-length(
|
<xsl:value-of select="$httpurl"/>
|
||||||
following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url)
|
|
||||||
> 10">
|
|
||||||
<xsl:value-of select=
|
|
||||||
"following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url"/>
|
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select=
|
<xsl:value-of select="$ftpurl"/>
|
||||||
"following-sibling::itemizedlist[1]/listitem[2]/para/ulink/@url"/>
|
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:with-param>
|
||||||
<xsl:variable name="package">
|
</xsl:call-template>
|
||||||
<xsl:call-template name="package_name">
|
</xsl:variable>
|
||||||
<xsl:with-param name="url" select="$url"/>
|
<xsl:variable name="first_letter"
|
||||||
</xsl:call-template>
|
select="translate(substring($package,1,1),
|
||||||
</xsl:variable>
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||||
<xsl:variable
|
'abcdefghijklmnopqrstuvwxyz')"/>
|
||||||
name="first_letter"
|
<xsl:text>
</xsl:text>
|
||||||
select="translate(substring($package,1,1),
|
<xsl:value-of select="$varname"/>
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
<xsl:text>=</xsl:text>
|
||||||
'abcdefghijklmnopqrstuvwxyz')"/>
|
<xsl:value-of select="$package"/>
|
||||||
<xsl:text>PACKAGE=</xsl:text>
|
<xsl:text>
if [[ ! -f $</xsl:text>
|
||||||
<xsl:value-of select="$package"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text>
if [[ ! -f $PACKAGE ]] ; then
</xsl:text>
|
<xsl:text> ]] ; then
</xsl:text>
|
||||||
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
||||||
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then
</xsl:text>
|
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
|
||||||
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE
</xsl:text>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text> elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then
</xsl:text>
|
<xsl:text> ]] ; then
</xsl:text>
|
||||||
<xsl:text> cp $SRC_ARCHIVE/$PACKAGE $PACKAGE
 else
</xsl:text>
|
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
|
||||||
<!-- The FTP_SERVER mirror -->
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
<xsl:text> $</xsl:text>
|
||||||
<xsl:value-of select="$first_letter"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text>/$PACKAGE</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
<xsl:apply-templates
|
<xsl:text> elif [[ -f $SRC_ARCHIVE/$</xsl:text>
|
||||||
select="following-sibling::itemizedlist[1]/listitem/para"
|
<xsl:value-of select="$varname"/>
|
||||||
mode="package"/>
|
<xsl:text> ]] ; then
</xsl:text>
|
||||||
|
<xsl:text> cp $SRC_ARCHIVE/$</xsl:text>
|
||||||
|
<xsl:value-of select="$varname"/>
|
||||||
|
<xsl:text> $</xsl:text>
|
||||||
|
<xsl:value-of select="$varname"/>
|
||||||
|
<xsl:text>
 else
</xsl:text>
|
||||||
|
<!-- The FTP_SERVER mirror -->
|
||||||
|
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
||||||
|
<xsl:value-of select="$first_letter"/>
|
||||||
|
<xsl:text>/$</xsl:text>
|
||||||
|
<xsl:value-of select="$varname"/>
|
||||||
|
<xsl:if test="string-length($httpurl) > 10">
|
||||||
|
<xsl:text> ||
|
||||||
|
wget -T 30 -t 5 </xsl:text>
|
||||||
|
<xsl:value-of select="$httpurl"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="string-length($ftpurl) > 10">
|
||||||
|
<xsl:text> ||
|
||||||
|
wget -T 30 -t 5 </xsl:text>
|
||||||
|
<xsl:value-of select="$ftpurl"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>
|
||||||
|
cp $</xsl:text>
|
||||||
|
<xsl:value-of select="$varname"/>
|
||||||
|
<xsl:text> $SRC_ARCHIVE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:if test="string-length($md5) > 10">
|
||||||
|
<xsl:text>echo "</xsl:text>
|
||||||
|
<xsl:value-of select="$md5"/>
|
||||||
|
<xsl:text>  $</xsl:text>
|
||||||
|
<xsl:value-of select="$varname"/>
|
||||||
|
<xsl:text>" | md5sum -c -
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Extract the MD5 sum information -->
|
||||||
|
<xsl:template match="para" mode="md5">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
||||||
|
<xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- We have several templates itemizedlist, depending on whether we
|
||||||
|
expect the package information, or additional package(s) or patch(es)
|
||||||
|
information. Select the appropriate mode here. -->
|
||||||
|
<xsl:template match="bridgehead">
|
||||||
|
<xsl:choose>
|
||||||
|
<!-- Special case for Openjdk -->
|
||||||
|
<xsl:when test="contains(string(),'Source Package Information')">
|
||||||
|
<xsl:apply-templates
|
||||||
|
select="following-sibling::itemizedlist[1]//simplelist">
|
||||||
|
<xsl:with-param name="varname" select="'PACKAGE'"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
<xsl:apply-templates select="following-sibling::itemizedlist
|
||||||
|
[preceding-sibling::bridgehead[1]=current()
|
||||||
|
and position() >1]//simplelist">
|
||||||
|
<xsl:with-param name="varname" select="'PACKAGE1'"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Package information -->
|
||||||
|
<xsl:when test="contains(string(),'Package Information')">
|
||||||
|
<xsl:apply-templates select="following-sibling::itemizedlist
|
||||||
|
[preceding-sibling::bridgehead[1]=current()]"
|
||||||
|
mode="package"/>
|
||||||
|
</xsl:when>
|
||||||
|
<!-- Additional package information -->
|
||||||
<xsl:when test="contains(string(),'Additional')">
|
<xsl:when test="contains(string(),'Additional')">
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates select="following-sibling::itemizedlist"
|
||||||
select="following-sibling::itemizedlist[1]/listitem/para"
|
mode="additional"/>
|
||||||
mode="additional"/>
|
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<!-- Do not do anything if the dev has created another type of
|
||||||
|
bridgehead. -->
|
||||||
<xsl:otherwise/>
|
<xsl:otherwise/>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="para" mode="package">
|
<!-- Call the download code template with appropriate parameters -->
|
||||||
<xsl:choose>
|
<xsl:template match="itemizedlist" mode="package">
|
||||||
<xsl:when test="contains(string(),'HTTP')">
|
<xsl:call-template name="download-file">
|
||||||
<!-- Upstream HTTP URL -->
|
<xsl:with-param name="httpurl">
|
||||||
<xsl:if test="string-length(ulink/@url) > '10'">
|
<xsl:value-of select="./listitem[1]/para/ulink/@url"/>
|
||||||
<xsl:text> || \
 wget -T 30 -t 5 </xsl:text>
|
</xsl:with-param>
|
||||||
<xsl:choose>
|
<xsl:with-param name="ftpurl">
|
||||||
<xsl:when test="contains(ulink/@url,'?')">
|
<xsl:value-of select="./listitem/para[contains(string(),'FTP')]/ulink/@url"/>
|
||||||
<xsl:value-of select="substring-before(ulink/@url,'?')"/>
|
</xsl:with-param>
|
||||||
</xsl:when>
|
<xsl:with-param name="md5">
|
||||||
<xsl:otherwise>
|
<xsl:apply-templates select="./listitem/para[contains(string(),'MD5')]"
|
||||||
<xsl:value-of select="ulink/@url"/>
|
mode="md5"/>
|
||||||
</xsl:otherwise>
|
</xsl:with-param>
|
||||||
</xsl:choose>
|
<xsl:with-param name="varname" select="'PACKAGE'"/>
|
||||||
<xsl:if test="not(contains(string(parent::listitem/following-sibling::listitem[1]/para),'FTP'))">
|
</xsl:call-template>
|
||||||
<xsl:text>
|
|
||||||
cp $PACKAGE $SRC_ARCHIVE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains(string(),'FTP')">
|
|
||||||
<!-- Upstream FTP URL -->
|
|
||||||
<xsl:if test="string-length(ulink/@url) > '10'">
|
|
||||||
<xsl:text> || \
 wget -T 30 -t 5 </xsl:text>
|
|
||||||
<xsl:value-of select="ulink/@url"/>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:text>
|
|
||||||
cp $PACKAGE $SRC_ARCHIVE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains(string(),'MD5')">
|
|
||||||
<!-- some md5 sums are written with a LF -->
|
|
||||||
<xsl:variable name="md5">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
|
||||||
<xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:text>echo "</xsl:text>
|
|
||||||
<xsl:value-of select="$md5"/>
|
|
||||||
<xsl:text>  $PACKAGE" | md5sum -c -
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="para" mode="additional">
|
<xsl:template match="itemizedlist" mode="additional">
|
||||||
<xsl:choose>
|
<!-- The normal layout is "one listitem"<->"one url", but some devs
|
||||||
<xsl:when test="contains(string(ulink/@url),'.patch')">
|
find amusing to have FTP and/or MD5sum listitems, or to
|
||||||
<xsl:variable name="patch">
|
enclose the download information inside a simplelist tag... -->
|
||||||
<xsl:call-template name="package_name">
|
<xsl:for-each select="listitem[.//ulink]">
|
||||||
<xsl:with-param name="url" select="ulink/@url"/>
|
<xsl:choose>
|
||||||
|
<!-- hopefully, there was a HTTP line before -->
|
||||||
|
<xsl:when test="contains(string(./para),'FTP')"/>
|
||||||
|
<xsl:when test=".//simplelist">
|
||||||
|
<xsl:apply-templates select=".//simplelist">
|
||||||
|
<xsl:with-param name="varname" select="'PACKAGE1'"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="download-file">
|
||||||
|
<xsl:with-param name="httpurl">
|
||||||
|
<xsl:value-of select="./para/ulink/@url"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
<xsl:with-param name="ftpurl">
|
||||||
|
<xsl:value-of
|
||||||
|
select="following-sibling::listitem[1]/
|
||||||
|
para[contains(string(),'FTP')]/ulink/@url"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
<xsl:with-param name="md5">
|
||||||
|
<xsl:apply-templates
|
||||||
|
select="following-sibling::listitem[position()<3]/
|
||||||
|
para[contains(string(),'MD5')]"
|
||||||
|
mode="md5"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
<xsl:with-param name="varname">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains(./para/ulink/@url,'.patch')">
|
||||||
|
<xsl:text>PATCH</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>PACKAGE1</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:otherwise>
|
||||||
<xsl:text>PATCH=</xsl:text>
|
</xsl:choose>
|
||||||
<xsl:value-of select="$patch"/>
|
</xsl:for-each>
|
||||||
<xsl:text>
if [[ ! -f $PATCH ]] ; then
</xsl:text>
|
|
||||||
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
|
||||||
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PATCH ]] ; then
</xsl:text>
|
|
||||||
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PATCH $PATCH
</xsl:text>
|
|
||||||
<xsl:text> elif [[ -f $SRC_ARCHIVE/$PATCH ]] ; then
</xsl:text>
|
|
||||||
<xsl:text> cp $SRC_ARCHIVE/$PATCH $PATCH
 else
</xsl:text>
|
|
||||||
<xsl:text>wget -T 30 -t 5 </xsl:text>
|
|
||||||
<xsl:value-of select="ulink/@url"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
<xsl:text>
|
|
||||||
cp $PATCH $SRC_ARCHIVE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="ulink">
|
|
||||||
<xsl:if test="string-length(ulink/@url) > '10'">
|
|
||||||
<xsl:variable name="package">
|
|
||||||
<xsl:call-template name="package_name">
|
|
||||||
<xsl:with-param name="url" select="ulink/@url"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:variable
|
|
||||||
name="first_letter"
|
|
||||||
select="translate(substring($package,1,1),
|
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
||||||
'abcdefghijklmnopqrstuvwxyz')"/>
|
|
||||||
<xsl:text>PACKAGE1=</xsl:text>
|
|
||||||
<xsl:value-of select="$package"/>
|
|
||||||
<xsl:text>
if [[ ! -f $PACKAGE1 ]] ; then
</xsl:text>
|
|
||||||
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
|
||||||
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then
</xsl:text>
|
|
||||||
<xsl:text> cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1
</xsl:text>
|
|
||||||
<xsl:text> elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then
</xsl:text>
|
|
||||||
<xsl:text> cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1
 else
</xsl:text>
|
|
||||||
<!-- The FTP_SERVER mirror -->
|
|
||||||
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
|
|
||||||
<xsl:value-of select="$first_letter"/>
|
|
||||||
<xsl:text>/$PACKAGE1</xsl:text>
|
|
||||||
<xsl:text> || \
 wget -T 30 -t 5 </xsl:text>
|
|
||||||
<xsl:value-of select="ulink/@url"/>
|
|
||||||
<xsl:text>
|
|
||||||
cp $PACKAGE1 $SRC_ARCHIVE
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains(string(),'MD5')">
|
|
||||||
<!-- some md5 sums are written with a LF -->
|
|
||||||
<xsl:variable name="md5">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="contains(substring-after(string(),'sum: '),'
')">
|
|
||||||
<xsl:value-of select="substring-before(substring-after(string(),'sum: '),'
')"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="substring-after(string(),'sum: ')"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
<xsl:text>echo "</xsl:text>
|
|
||||||
<xsl:value-of select="$md5"/>
|
|
||||||
<xsl:text>  $PACKAGE1" | md5sum -c -
</xsl:text>
|
|
||||||
</xsl:when>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="itemizedlist/listitem/para" mode="xorg7">
|
<!-- the simplelist case. Hopefully, the layout is one member for
|
||||||
<xsl:if test="contains(string(ulink/@url),'.md5') or
|
url, one for md5 and others for various information, that we do not
|
||||||
contains(string(ulink/@url),'.wget')">
|
use -->
|
||||||
<xsl:text>wget -T 30 -t 5 </xsl:text>
|
<xsl:template match="simplelist">
|
||||||
<xsl:value-of select="ulink/@url"/>
|
<xsl:param name="varname" select="'PACKAGE1'"/>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:call-template name="download-file">
|
||||||
</xsl:if>
|
<xsl:with-param name="httpurl" select=".//ulink/@url"/>
|
||||||
|
<xsl:with-param name="md5">
|
||||||
|
<xsl:value-of select="substring-after(member[contains(string(),'MD5')],'sum: ')"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
<xsl:with-param name="varname" select="$varname"/>
|
||||||
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
|
|
||||||
<xsl:if test="contains(string(ulink/@url),'.patch')">
|
|
||||||
<xsl:text>wget -T 30 -t 5 </xsl:text>
|
|
||||||
<xsl:value-of select="ulink/@url"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<!--======================== Commands code ==========================-->
|
<!--======================== Commands code ==========================-->
|
||||||
|
|
||||||
<xsl:template match="screen">
|
<xsl:template match="screen">
|
||||||
|
@ -419,13 +372,6 @@ fi
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="screen" mode="xorg7">
|
|
||||||
<xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
|
||||||
<xsl:apply-templates select="userinput" mode="xorg7"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="screen" mode="config">
|
<xsl:template match="screen" mode="config">
|
||||||
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
<xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
|
||||||
<xsl:text>[[ ! -d $SRC_DIR/blfs-bootscripts ]] && mkdir $SRC_DIR/blfs-bootscripts
|
<xsl:text>[[ ! -d $SRC_DIR/blfs-bootscripts ]] && mkdir $SRC_DIR/blfs-bootscripts
|
||||||
|
@ -467,14 +413,6 @@ popd</xsl:text>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="screen" mode="sect-ver">
|
|
||||||
<xsl:text>section=</xsl:text>
|
|
||||||
<xsl:value-of select="substring-before(substring-after(string(),'mkdir '),' &')"/>
|
|
||||||
<xsl:text>
sect_ver=</xsl:text>
|
|
||||||
<xsl:value-of select="substring-before(substring-after(string(),'-c ../'),'.md5')"/>
|
|
||||||
<xsl:text>
</xsl:text>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="para/command">
|
<xsl:template match="para/command">
|
||||||
<xsl:if test="(contains(string(),'test') or
|
<xsl:if test="(contains(string(),'test') or
|
||||||
contains(string(),'check'))">
|
contains(string(),'check'))">
|
||||||
|
@ -493,69 +431,6 @@ popd</xsl:text>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="userinput" mode="xorg7">
|
|
||||||
<xsl:apply-templates mode="xorg7"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="text()" mode="xorg7">
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string" select="string()"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="output-text">
|
|
||||||
<xsl:param name="out-string" select="''"/>
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="contains($out-string,'bash -e')">
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-before($out-string,'bash -e')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text># bash -e</xsl:text>
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-after($out-string,'bash -e')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains($out-string,'exit')">
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-before($out-string,'exit')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text># exit</xsl:text>
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-after($out-string,'exit')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains($out-string,'mkdir')">
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-before($out-string,'mkdir')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text>mkdir -p</xsl:text>
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-after($out-string,'mkdir')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="contains($out-string,'rm -r ')">
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-before($out-string,'rm -r ')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:text>rm -rf </xsl:text>
|
|
||||||
<xsl:call-template name="output-text">
|
|
||||||
<xsl:with-param name="out-string"
|
|
||||||
select="substring-after($out-string,'rm -r ')"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
<xsl:value-of select="$out-string"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="text()" mode="root">
|
<xsl:template match="text()" mode="root">
|
||||||
<xsl:call-template name="output-root">
|
<xsl:call-template name="output-root">
|
||||||
<xsl:with-param name="out-string" select="string()"/>
|
<xsl:with-param name="out-string" select="string()"/>
|
||||||
|
|
Reference in a new issue