Changeset 6ed3dd7 for common/libs


Ignore:
Timestamp:
12/15/2013 10:10:25 AM (11 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
2.4, ablfs-more, legacy, new_features, trunk
Children:
532ede6
Parents:
382b083
Message:

Change the prerequisite tests so that alfs tools are first checked, then blfs,
and the host reqs are tested later

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/libs/func_check_version.sh

    r382b083 r6ed3dd7  
    3535
    3636  write_error_and_die() {
    37      echo -e "\n\t\t$TXT version -->${tst_version}<-- is too old.
     37     echo -e "\n\t\t$TXT is missing or version -->${tst_version}<-- is too old.
    3838                    This script requires ${ref_version} or greater\n"
    3939   # Ask the user instead of bomb, to make happy that packages which version
    4040   # ouput don't follow our expectations
    41     echo "If you are sure that you have instaled a proper version of ${BOLD}$TXT${OFF}"
     41    echo "If you are sure that you have installed a proper version of ${BOLD}$TXT${OFF}"
    4242    echo "but jhalfs has failed to detect it, press 'c' and 'ENTER' keys to continue,"
    4343    echo -n "otherwise press 'ENTER' key to stop jhalfs.  "
     
    8989#----------------------------#
    9090
    91   # Maybe we should check xsltproc first?
    92     case $PROGNAME in
    93       clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;;
    94       *) HOSTREQS="prologue/hostreqs.xml" ;;
    95     esac
     91  case $PROGNAME in
     92    clfs | clfs2 | clfs3) HOSTREQS="BOOK/prologue/common/hostreqs.xml" ;;
     93    *) HOSTREQS="prologue/hostreqs.xml" ;;
     94  esac
    9695
    9796  eval $(xsltproc $COMMON_DIR/hostreqs.xsl $BOOK/$HOSTREQS)
     
    128127  check_version "$MIN_Texinfo_VER"   "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO"
    129128  check_version "$MIN_Xz_VER"        "$(xz --version | head -n1 | cut -d" " -f4)"         "XZ"
     129}
     130
     131#----------------------------#
     132check_alfs_tools() {         #
     133#----------------------------#
     134: << inline_doc
     135Those tools are needed for the proper operation of jhalfs
     136inline_doc
     137
     138  # Avoid translation of version strings
     139  local LC_ALL=C
     140  export LC_ALL
     141
    130142  # Check for minimum sudo version
    131   if [ -z $MIN_Sudo_VER ]; then MIN_Sudo_VER=1.7.0; fi
    132143  SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
    133144  if [ -x $SUDO_LOC ]; then
    134145    sudoVer="$(sudo -V | head -n1 | cut -d" " -f3)"
    135     check_version "$MIN_Sudo_VER"  "${sudoVer}"      "SUDO"
     146    check_version "1.7.0"  "${sudoVer}"      "SUDO"
    136147  else
    137148    echo "${nl_}\"${RED}sudo${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
     
    139150  fi
    140151
    141   # Check for minimum wget version
     152  # Check for wget presence (using a dummy version)
    142153  WGET_LOC="$(whereis -b wget | cut -d" " -f2)"
    143154  if [ -x $WGET_LOC ]; then
     
    149160  fi
    150161
    151   # Before checking libmxl2 and libxslt version information, ensure tools needed from those
    152   # packages are actually available. Avoids a small cosmetic bug of book version information
    153   # not being retrieved if xmllint is unavailable, especially when on recent non-LFS hosts.
     162  # Before checking libxml2 and libxslt version information, ensure tools
     163  # needed from those packages are actually available. Avoids a small
     164  # cosmetic bug of book version information not being retrieved if
     165  # xmllint is unavailable, especially when on recent non-LFS hosts.
    154166
    155167  XMLLINT_LOC="$(whereis -b xmllint | cut -d" " -f2)"
    156168  XSLTPROC_LOC="$(whereis -b xsltproc | cut -d" " -f2)"
    157   XML_NOTE_MSG="${nl_} ${BOLD} This can happen when running jhalfs on non-LFS hosts. ${OFF}"
    158169 
    159170  if [ ! -x $XMLLINT_LOC ]; then
    160171    echo "${nl_}\"${RED}xmllint${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
    161     echo ${XML_NOTE_MSG}
    162172    exit 1
    163173  fi
     
    165175  if [ -x $XSLTPROC_LOC ]; then
    166176
    167   # Check for minimum libxml2 and libxslt versions
    168   xsltprocVer=$(xsltproc -V | head -n1 )
    169   libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
    170   libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
    171 
    172   # Version numbers are packed strings not xx.yy.zz format.
    173   check_version "2.06.20"  "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}"     "LIBXML2"
    174   check_version "1.01.14"  "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}"  "LIBXSLT"
     177    # Check for minimum libxml2 and libxslt versions
     178    xsltprocVer=$(xsltproc -V | head -n1 )
     179    libxmlVer=$(echo $xsltprocVer | cut -d " " -f3)
     180    libxsltVer=$(echo $xsltprocVer | cut -d " " -f5)
     181
     182    # Version numbers are packed strings not xx.yy.zz format.
     183    check_version "2.06.20"  "${libxmlVer:0:1}.${libxmlVer:1:2}.${libxmlVer:3:2}"     "LIBXML2"
     184    check_version "1.01.14"  "${libxsltVer:0:1}.${libxsltVer:1:2}.${libxsltVer:3:2}"  "LIBXSLT"
    175185 
    176186  else
    177187    echo "${nl_}\"${RED}xsltproc${OFF}\" ${BOLD}must be installed on your system for jhalfs to run"
    178     echo ${XML_NOTE_MSG}
    179     exit 1
    180   fi
    181   # The next versions checks are required only when BLFS_TOOL is set and
    182   # this dependencies has not be selected for installation
    183   if [[ "$BLFS_TOOL" = "y" ]] ; then
    184 
    185     if [[ -z "$DEP_TIDY" ]] ; then
    186       tidyVer=$(tidy -V | cut -d " " -f9)
    187       check_version "2004" "${tidyVer}" "TIDY"
    188     fi
    189 
    190     # Check if the proper DocBook-XML-DTD and DocBook-XSL are correctly installed
    191 XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
     188    exit 1
     189  fi
     190}
     191
     192#----------------------------#
     193check_blfs_tools() {         #
     194#----------------------------#
     195: << inline_doc
     196In addition to the tools needed for the LFS part, tidy and docbook-xml
     197are needed for installing the BLFS tools
     198inline_doc
     199
     200  # Avoid translation of version strings
     201  local LC_ALL=C
     202  export LC_ALL
     203
     204  tidyVer=$(tidy -V | cut -d " " -f9)
     205  check_version "2004" "${tidyVer}" "TIDY"
     206
     207  # Minimal docbook-xml code for testing
     208  XML_FILE="<?xml version='1.0' encoding='ISO-8859-1'?>
    192209<?xml-stylesheet type='text/xsl' href='http://docbook.sourceforge.net/release/xsl/1.69.1/xhtml/docbook.xsl'?>
    193210<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
     
    201218</article>"
    202219
    203     if [[ -z "$DEP_DBXML" ]] ; then
    204       if `echo $XML_FILE | xmllint -noout -postvalid - 2>/dev/null` ; then
    205         check_version "4.5" "4.5" "DocBook XML DTD"
    206       else
    207         echo "Warning: not found a working DocBook XML DTD 4.5 installation"
    208         exit 2
    209       fi
    210     fi
    211 
    212 #     if [[ -z "$DEP_DBXSL" ]] ; then
    213 #       if `echo $XML_FILE | xsltproc --noout - 2>/dev/null` ; then
    214 #         check_version "1.69.1" "1.69.1" "DocBook XSL"
    215 #       else
    216 #         echo "Warning: not found a working DocBook XSL 1.69.1 installation"
    217 #         exit 2
    218 #       fi
    219 #     fi
    220 
    221   fi # end BLFS_TOOL=Y
    222 
    223 }
     220  if `echo $XML_FILE | xmllint -nonet -noout -postvalid - 2>/dev/null` ; then
     221    check_version "4.5" "4.5" "DocBook XML DTD"
     222  else
     223    echo "Error: you need docbook for installing BLFS tools"
     224    exit 2
     225  fi
     226}
Note: See TracChangeset for help on using the changeset viewer.