Added version checks for DocBook XML dtd and XSL.

Added version checks to ./blfs-tool.
DocBook-XML-DTD and Tidy must be added yet to BLFS_TOOL installation dependencies.
This commit is contained in:
Manuel Canales Esparcia 2006-09-17 10:26:55 +00:00
parent 6ef1f449ac
commit 4abc9ec56c
2 changed files with 90 additions and 4 deletions

View file

@ -72,6 +72,11 @@ source configuration
[[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
source $COMMON_DIR/func_check_version.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
[[ $VERBOSITY > 0 ]] && echo "OK"
[[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
source $COMMON_DIR/func_validate_configs.sh
[[ $? > 0 ]] && echo " function module did not load.." && exit 2
@ -94,6 +99,45 @@ case $BRANCH_ID in
* ) TREE=tags/${BRANCH_ID}/BOOK ;;
esac
# Check for minimun dependencies versions
xsltprocVer=`xsltproc -V | head -n1 `
libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
tidyVer=`tidy -V | cut -d " " -f9`
# Version numbers are packed strings not xx.yy.zz format.
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
check_version "2004" "${tidyVer}" "TIDY"
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
<article>
<title>Test file</title>
<sect1>
<title>Some title</title>
<para>Some text</para>
</sect1>
</article>"
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
check_version "4.4" "4.4" "DocBook XML DTD"
else
echo "Warning: not found a working DocBook XML DTD 4.4 installation"
exit 2
fi
if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
check_version "1.69.1" "1.69.1" "DocBook XSL"
else
echo "Warning: not found a working DocBook XSL 1.69.1 installation"
exit 2
fi
echo "${SD_BORDER}${nl_}"
# For consistency with other books
validate_config
echo "${SD_BORDER}${nl_}"

50
jhalfs
View file

@ -249,6 +249,7 @@ check_version "3.0" "`gcc -dumpversion`" "GCC"
tarVer=`tar --version | head -n1 | cut -d " " -f4`
check_version "1.15.0" "${tarVer}" "TAR"
# Check for minimum sudo version
SUDO_LOC="`whereis -b sudo | cut -d " " -f2`"
if [ -x $SUDO_LOC ]; then
sudoVer=`sudo -V | head -n1 | cut -d " " -f3`
@ -258,15 +259,56 @@ else
exit 1
fi
# Check for minimum libxml2 and libxslt versions
xsltprocVer=`xsltproc -V | head -n1 `
libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
tidyVer=`tidy -V | cut -d " " -f9`
# Version numbers are packed strings not xx.yy.zz format.
# Version numbers are packed strings not xx.yy.zz format.
check_version "2.06.20" "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}" "LIBXML2"
check_version "1.01.14" "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}" "LIBXSLT"
check_version "2004" "${tidyVer}" "TIDY"
# The next versions checks are required only when BLFS_TOOL is set and
# this dependencies has not be selected for installation
if [[ "$BLFS_TOOL" = "y" ]] ; then
if [[ -z "$DEP_TIDY" ]] ; then
tidyVer=`tidy -V | cut -d " " -f9`
check_version "2004" "${tidyVer}" "TIDY"
fi
# Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'
'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd'>
<article>
<title>Test file</title>
<sect1>
<title>Some title</title>
<para>Some text</para>
</sect1>
</article>"
if [[ -z "$DEP_DBXML" ]] ; then
if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
check_version "4.4" "4.4" "DocBook XML DTD"
else
echo "Warning: not found a working DocBook XML DTD 4.4 installation"
exit 2
fi
fi
if [[ -z "$DEP_DBXSL" ]] ; then
if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
check_version "1.69.1" "1.69.1" "DocBook XSL"
else
echo "Warning: not found a working DocBook XSL 1.69.1 installation"
exit 2
fi
fi
fi
echo "${SD_BORDER}${nl_}"