From 4abc9ec56cc3e675fa973813fb6ae9acdaf271b1 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 17 Sep 2006 10:26:55 +0000 Subject: [PATCH] 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. --- blfs-tool | 44 ++++++++++++++++++++++++++++++++++++++++++++ jhalfs | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 90 insertions(+), 4 deletions(-) diff --git a/blfs-tool b/blfs-tool index d4376d3..72ae6d8 100755 --- a/blfs-tool +++ b/blfs-tool @@ -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 ..." +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 ..." 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=" + + +
+ Test file + + Some title + Some text + +
" + +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_}" diff --git a/jhalfs b/jhalfs index 8a85515..9c2992b 100755 --- a/jhalfs +++ b/jhalfs @@ -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=" + + +
+ Test file + + Some title + Some text + +
" + + 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_}"