BLFS tools:
- Separates the groups of xorg package into individual builds
This commit is contained in:
parent
d0c94a3a6e
commit
d236bbdf03
4 changed files with 325 additions and 52 deletions
|
@ -2,20 +2,38 @@
|
|||
|
||||
# $Id: gen-special.sh 21 2012-02-16 15:06:19Z labastie $
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# generates an xsl stylesheet containing a template for special
|
||||
# cases in the book:
|
||||
# - If the version does not begin with a number, it is impossible to know
|
||||
# where the package name ends and where the version begins. We therefore
|
||||
# use the ENTITY at the beginning of the validated full-xml.
|
||||
# - If a package is part of a group of xorg packages (proto, fonts, etc)
|
||||
# there is no easy way to extract it from the xml. We use the ENTITY at
|
||||
# the top of each file x7*.xml
|
||||
# - If a pacakge is versioned but the version is not mentioned in the book
|
||||
# (currently only udev), we retrieve the version by other means
|
||||
#-------------------------------------------------------------------------
|
||||
# Arguments:
|
||||
# $1 contains the name of the validated xml book
|
||||
# $2 contains the name of the ouput xsl file
|
||||
# $3 contains the name of the book sources directory
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
BLFS_XML=$1
|
||||
if ! test -f ${BLFS_XML}; then
|
||||
echo ${BLFS_XML} does not exist
|
||||
echo File \`${BLFS_XML}\' does not exist
|
||||
exit 1
|
||||
fi
|
||||
SPECIAL_FILE=$2
|
||||
if test -z "${SPECIAL_FILE}"; then SPECIAL_FILE=specialCases.xsl;fi
|
||||
BLFS_DIR=$3
|
||||
if test -z "${BLFS_DIR}"; then BLFS_DIR=$(cd $(dirname ${BLFS_XML})/.. ; pwd);fi
|
||||
|
||||
# Packages whose version does not begin with a number
|
||||
EXCEPTIONS=$(grep 'ENTITY.*version[ ]*"[^0-9"&.].*[0-9]' $BLFS_XML |
|
||||
sed 's@^[^"]*"\([^"]*\)".*@\1@')
|
||||
# Version for X Window packages without a version in the book
|
||||
XVERSION=$(grep 'ENTITY xorg-version' $BLFS_XML |
|
||||
sed 's@^[^"]*"\([^"]*\)".*@\1@')
|
||||
# The case of udev
|
||||
|
||||
# Set PATH to be sure to find udevadm
|
||||
SAVPATH=$PATH
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||
|
@ -29,7 +47,7 @@ cat >$SPECIAL_FILE << EOF
|
|||
|
||||
<xsl:template match='*' mode="special">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@id='udev'">
|
||||
<xsl:when test="contains(@id,'udev')">
|
||||
<xsl:text> </xsl:text>
|
||||
<package><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
|
||||
|
@ -53,46 +71,94 @@ cat >$SPECIAL_FILE << EOF
|
|||
<xsl:text>
 </xsl:text>
|
||||
</package><xsl:text>
</xsl:text>
|
||||
</xsl:when>
|
||||
<!-- Although versioned, this page is not a package -->
|
||||
<xsl:when test="@id='xorg7'"/>
|
||||
<xsl:when test="../@id='x-window-system' and
|
||||
not(contains(translate(@xreflabel,
|
||||
'123456789',
|
||||
'000000000'),
|
||||
'-0'))">
|
||||
EOF
|
||||
|
||||
# Taking packages inside x7proto etc, as versionned modules.
|
||||
# We also write a dependency expansion when a dep is of the form
|
||||
# xorg7-something. Since that is another template, we need
|
||||
# a temporary file, which we shall concatenate at the end
|
||||
cat >tmpfile << EOF
|
||||
<xsl:template name="expand-deps">
|
||||
<xsl:param name="section"/>
|
||||
<xsl:param name="status"/>
|
||||
<xsl:choose>
|
||||
EOF
|
||||
for file in $(ls ${BLFS_DIR}/x/installing/x7* | grep -v x7driver); do
|
||||
id=$(grep xreflabel $file | sed 's@.*id="\([^"]*\).*@\1@')
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
<xsl:when test="@id='$id'">
|
||||
<xsl:text> </xsl:text>
|
||||
<package><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name"><xsl:value-of select="@id"/></xsl:element>
|
||||
<xsl:text>
 </xsl:text>
|
||||
<xsl:element name="version">$XVERSION</xsl:element>
|
||||
<xsl:if
|
||||
test="document(\$installed-packages)//package[name=current()/@id]">
|
||||
<xsl:element name="name">$id</xsl:element>
|
||||
<xsl:text>
 </xsl:text>
|
||||
EOF
|
||||
cat >> tmpfile << EOF
|
||||
<xsl:when test="\$section='$id'">
|
||||
EOF
|
||||
# In the list, the preceding package is a dependency of the following,
|
||||
# except the first:
|
||||
precpack=NONE
|
||||
# Rationale for the sed below: the following for breaks words at spaces (unless
|
||||
# we tweak IFS). So replace spaces with commas in lines so that only newlines
|
||||
# are separators.
|
||||
for pack in \
|
||||
$(grep 'ENTITY.*version' $file | sed 's/[ ]\+/,/g'); do
|
||||
packname=$(echo $pack | sed s'@.*ENTITY,\(.*\)-version.*@\1@')
|
||||
packversion=$(echo $pack | sed 's@[^"]*"\([^"]*\).*@\1@')
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
<module><xsl:text>
 </xsl:text>
|
||||
<xsl:element name="name">$packname</xsl:element>
|
||||
<xsl:element name="version">$packversion</xsl:element>
|
||||
<xsl:if test="document(\$installed-packages)//package[name='$packname']">
|
||||
<xsl:element name="inst-version">
|
||||
<xsl:value-of
|
||||
select="document(\$installed-packages
|
||||
)//package[name=current()/@id]/version"/>
|
||||
)//package[name='$packname']/version"/>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
<!-- Dependencies -->
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
EOF
|
||||
if test $precpack != NONE; then
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
<xsl:element name="dependency">
|
||||
<xsl:attribute name="status">required</xsl:attribute>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of
|
||||
select="preceding-sibling::sect1[1]/@id"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="name">$precpack</xsl:attribute>
|
||||
<xsl:attribute name="type">ref</xsl:attribute>
|
||||
</xsl:element>
|
||||
EOF
|
||||
else
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
<xsl:apply-templates select=".//para[@role='required' or
|
||||
@role='recommended' or
|
||||
@role='optional']"
|
||||
mode="dependency"/>
|
||||
EOF
|
||||
fi
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
<!-- End dependencies -->
|
||||
<xsl:text>
 </xsl:text>
|
||||
</package><xsl:text>
</xsl:text>
|
||||
</module>
|
||||
EOF
|
||||
cat >> tmpfile << EOF
|
||||
<xsl:element name="dependency">
|
||||
<xsl:attribute name="status">
|
||||
<xsl:value-of select="\$status"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="name">$packname</xsl:attribute>
|
||||
<xsl:attribute name="type">ref</xsl:attribute>
|
||||
</xsl:element>
|
||||
EOF
|
||||
precpack=$packname
|
||||
done
|
||||
cat >>$SPECIAL_FILE << EOF
|
||||
</package>
|
||||
</xsl:when>
|
||||
EOF
|
||||
cat >> tmpfile << EOF
|
||||
</xsl:when>
|
||||
EOF
|
||||
done
|
||||
|
||||
for ver_ent in $EXCEPTIONS; do
|
||||
id=$(grep 'xreflabel=".*'$ver_ent $BLFS_XML | sed 's@.*id="\([^"]*\)".*@\1@')
|
||||
|
@ -137,6 +203,17 @@ cat >>$SPECIAL_FILE << EOF
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
EOF
|
||||
cat $SPECIAL_FILE tmpfile > tmpfile1
|
||||
mv tmpfile1 $SPECIAL_FILE
|
||||
rm tmpfile
|
||||
cat >> $SPECIAL_FILE << EOF
|
||||
<xsl:otherwise>
|
||||
<xsl:message>
|
||||
<xsl:text>You should not be seeing this</xsl:text>
|
||||
</xsl:message>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
EOF
|
||||
|
|
|
@ -181,9 +181,19 @@ depends MENU_</xsl:text>
|
|||
<xsl:text>]</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>"
|
||||
			default	n
|
||||
			default	</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(../name,'xorg')">
|
||||
<xsl:text>y
|
||||
|
||||
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>n
|
||||
|
||||
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
|
|
@ -256,6 +256,18 @@
|
|||
<xsl:variable name="status" select="./@role"/>
|
||||
<!-- No ulink for now (see special case for Perl modules) -->
|
||||
<xsl:for-each select="./xref">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(@linkend,'xorg7-')">
|
||||
<xsl:call-template name="expand-deps">
|
||||
<xsl:with-param name="section">
|
||||
<xsl:value-of select="@linkend"/>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="status">
|
||||
<xsl:value-of select="$status"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:element name="dependency">
|
||||
|
@ -267,6 +279,8 @@
|
|||
</xsl:attribute>
|
||||
<xsl:attribute name="type">ref</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
|
|
@ -34,27 +34,47 @@
|
|||
</book>
|
||||
</xsl:template>
|
||||
|
||||
<!-- apply-templates for each id in the list.
|
||||
<!-- apply-templates for each item in the list.
|
||||
Normally, those items are id of nodes.
|
||||
Those nodes can be sect1 (normal case),
|
||||
sect2 (python modules or DBus bindings)
|
||||
bridgehead (perl modules)
|
||||
para (dependency of perl modules).
|
||||
The templates after this one treat each of those cases-->
|
||||
The templates after this one treat each of those cases.
|
||||
However, some items are xorg package names, and not id.
|
||||
We need special instructions in that case.
|
||||
The difficulty is that some of those names *are* id's,
|
||||
because they are referenced in the index.
|
||||
Hopefully, none of those id's are sect{1,2}, bridgehead or para...-->
|
||||
<xsl:template name="apply-list">
|
||||
<xsl:param name="list" select="''"/>
|
||||
<xsl:if test="string-length($list) > 0">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($list,' ')">
|
||||
<xsl:apply-templates select="id(substring-before($list,' '))"/>
|
||||
<xsl:call-template name="apply-list">
|
||||
<xsl:with-param name="list"
|
||||
select="substring-before($list,' ')"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="apply-list">
|
||||
<xsl:with-param name="list"
|
||||
select="substring-after($list,' ')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(id($list)/self::sect1|sect2|para|bridgehead)">
|
||||
<xsl:apply-templates
|
||||
select="//sect1[contains(string(.//userinput),$list)]"
|
||||
mode="xorg">
|
||||
<xsl:with-param name="package" select="$list"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="id($list)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
@ -265,4 +285,156 @@
|
|||
</xsl:for-each>
|
||||
</sect2>
|
||||
</xsl:template>
|
||||
|
||||
<!-- we have got an xorg package. We are at the installation page
|
||||
but now we need to make an autonomous page from the global
|
||||
one -->
|
||||
<xsl:template match="sect1" mode="xorg">
|
||||
<xsl:param name="package"/>
|
||||
<xsl:variable name="tarball">
|
||||
<xsl:call-template name="tarball">
|
||||
<xsl:with-param name="package" select="$package"/>
|
||||
<xsl:with-param name="cat-md5"
|
||||
select="string(.//userinput[starts-with(string(),'cat')])"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="md5sum">
|
||||
<xsl:call-template name="md5sum">
|
||||
<xsl:with-param name="package" select="$package"/>
|
||||
<xsl:with-param name="cat-md5"
|
||||
select=".//userinput[starts-with(string(),'cat')]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="install-instructions">
|
||||
<xsl:call-template name="inst-instr">
|
||||
<xsl:with-param name="inst-instr"
|
||||
select=".//userinput[starts-with(string(),'for')]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:element name="sect1">
|
||||
<xsl:attribute name="id"><xsl:value-of select="$package"/></xsl:attribute>
|
||||
<xsl:processing-instruction name="dbhtml">
|
||||
filename="<xsl:value-of select='$package'/>.html"
|
||||
</xsl:processing-instruction>
|
||||
<title><xsl:value-of select="$package"/></title>
|
||||
<sect2 role="package">
|
||||
<title>Introduction to <xsl:value-of select="$package"/></title>
|
||||
<bridgehead renderas="sect3">Package Information</bridgehead>
|
||||
<itemizedlist spacing="compact">
|
||||
<listitem>
|
||||
<para>Download (HTTP): <xsl:element name="ulink">
|
||||
<xsl:attribute name="url">
|
||||
<xsl:value-of
|
||||
select=".//para[contains(string(),'(HTTP)')]/ulink/@url"/>
|
||||
<xsl:value-of select="$tarball"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Download (FTP): <xsl:element name="ulink">
|
||||
<xsl:attribute name="url">
|
||||
<xsl:value-of
|
||||
select=".//para[contains(string(),'(FTP)')]/ulink/@url"/>
|
||||
<xsl:value-of select="$tarball"/>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Download MD5 sum: <xsl:value-of select="$md5sum"/>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
<sect2 role="installation">
|
||||
<title>Installation of <xsl:value-of select="$package"/></title>
|
||||
|
||||
<para>
|
||||
Install <application><xsl:value-of select="$package"/></application>
|
||||
by running the following commands:
|
||||
</para>
|
||||
|
||||
<screen><userinput>packagedir=<xsl:value-of
|
||||
select="substring-before($tarball,'.tar.bz2')"/>
|
||||
<xsl:text>
</xsl:text>
|
||||
<xsl:value-of select="substring-before($install-instructions,
|
||||
'as_root')"/>
|
||||
</userinput></screen>
|
||||
|
||||
<para>
|
||||
Now as the <systemitem class="username">root</systemitem> user:
|
||||
</para>
|
||||
<screen role='root'>
|
||||
<userinput><xsl:value-of select="substring-after(
|
||||
$install-instructions,
|
||||
'as_root')"/>
|
||||
</userinput>
|
||||
</screen>
|
||||
</sect2>
|
||||
</xsl:element><!-- sect1 -->
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- get the tarball name from the text that comes from the .md5 file -->
|
||||
<xsl:template name="tarball">
|
||||
<xsl:param name="package"/>
|
||||
<xsl:param name="cat-md5"/>
|
||||
<!-- DEBUG
|
||||
<xsl:message><xsl:text>Entering "tarball" template:
|
||||
package is: </xsl:text>
|
||||
<xsl:value-of select="$package"/><xsl:text>
|
||||
cat-md5 is: </xsl:text>
|
||||
<xsl:value-of select="$cat-md5"/>
|
||||
</xsl:message>
|
||||
END DEBUG -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(substring-before($cat-md5,$package),'
')">
|
||||
<xsl:call-template name="tarball">
|
||||
<xsl:with-param name="package" select="$package"/>
|
||||
<xsl:with-param name="cat-md5"
|
||||
select="substring-after($cat-md5,'
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="substring-after(
|
||||
substring-before($cat-md5,'
'),' ')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- same for md5sum -->
|
||||
<xsl:template name="md5sum">
|
||||
<xsl:param name="package"/>
|
||||
<xsl:param name="cat-md5"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains(substring-before($cat-md5,$package),'
')">
|
||||
<xsl:call-template name="md5sum">
|
||||
<xsl:with-param name="package" select="$package"/>
|
||||
<xsl:with-param name="cat-md5"
|
||||
select="substring-after($cat-md5,'
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="substring-before($cat-md5,' ')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="inst-instr">
|
||||
<xsl:param name="inst-instr"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($inst-instr,'pushd')">
|
||||
<xsl:call-template name="inst-instr">
|
||||
<xsl:with-param name="inst-instr"
|
||||
select="substring-after(
|
||||
substring-after($inst-instr,'pushd'),
|
||||
'
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="substring-before($inst-instr,'popd')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
|
Reference in a new issue