Ignore:
Timestamp:
02/22/2012 05:09:47 PM (13 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs
Children:
c1987b0
Parents:
0216209
Message:

Initial modificaiton of BLFS tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BLFS/libs/func_dependencies

    r0216209 r63fc514  
    33# $Id$
    44#
    5 set -e
    65
    7 declare -i cntr=0
     6# A string of spaces for indenting:
    87declare -a spaceSTR="                                                                   "
     8declare -a exchange_triplet
     9
     10# In case we find a cirdular dependency, it has the form :
     11# parent->dependency_0->...->dependency_n->dependency_0
     12# If we want to build dependency_n before dependency_0,
     13# no problem: we just prune the tree at dependency_n.
     14# If we want to build first dependency_0, we need to
     15# put dependency_n as a dependency of parent. The triplet
     16# above shall contain (parent dependency_0 dependency_n)
    917
    1018#----------------------------#
     
    1220#----------------------------#
    1321: <<inline_doc
    14     function:   Create a dependency tree for the TARGET
    15     input vars: none
    16     externals:  vars: TARGET
    17                       PKGXML
     22    function:   Create a subtree of the dependency tree
     23                (recursive function)
     24    input vars: $1 : file with a list of targets
     25                     the first line of the file is an array
     26                     of links
     27    externals:  vars: BLFS_XML
    1828                      DEP_LEVEL
    19                 func: do_dependencies
    20     modifies:   vars: PKGXML
    21                       BLFS_XML
     29    modifies:   vars: none
    2230    returns:    nothing
    23     output:     files: $TARGET.dep
    24                        $TARGET-index.xml.tmp
    25                        depure.txt
     31    output:     files: for each pkg with dependencies in $1,
     32                       a file pkg.dep and its dependencies
    2633    on error:   nothing
    2734    on success: nothing
    2835inline_doc
    2936
    30   local ENTRY_START
    31   local ENTRY_END
     37local DepFile=$1
     38local -a rootlink
     39local -a otherlink
     40local -i depth
     41local -i count=0
     42local id_of_dep
     43local parent
     44local lines_to_remove=
     45local srootlink
     46local dep_level
    3247
    33   #---------------------
    34   # Create the working directory and cd into it
    35   if [[ -d $TARGET ]] ; then
    36     echo -e "\tERROR: Looks like $TARGET has been already processed."
    37     echo -e "\tPlease delete or rename the $TARGET directory.\n"
    38     exit 1
    39   else
    40     mkdir $TARGET && cd $TARGET
     48{
     49# BEWARE : the order of options matters : read -a -u6 rootlink hangs forever
     50# (actually, the doc says -a array -u fd)
     51# We use fd number 6 for input from DepFile, because we need 0 for user input
     52read -u6 -a rootlink
     53depth=${#rootlink[*]}
     54dep_level=$DEP_LEVEL
     55if (( $DEP_LEVEL > 2 )) && (( $depth > 1 )); then dep_level=2; fi
     56srootlink="${rootlink[*]} "
     57# start of Depfile
     58echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF}"
     59
     60while read -u6 id_of_dep; do
     61# count entries in file
     62  (( count++ ))
     63# Has this entry already been seen?
     64  if [ -f ${id_of_dep}.dep ]; then # found ${id_of_dep}.dep already in tree
     65    otherlink=($(head -n 1 ${id_of_dep}.dep))
     66    if [ -z "${otherlink[*]}" ]
     67      then echo otherlink empty for $id_of_dep.dep
     68      echo This should not happen, but happens to happen...
     69      exit 1
     70    fi
     71# Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11)
     72# and otherlink=(1 1)
     73    if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # circular dep
     74# First look for the other parent of this dependency.
     75# The parent has the same link without the last entry.
     76# We do not need otherlink anymore so just destroy the last element
     77      unset otherlink[${#otherlink[*]}-1]
     78      parent=$(grep ^"${otherlink[*]}"\$ -l *)
     79      parent=${parent%.dep}
     80      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BLUE}Circular dependency detected:${OFF}"
     81      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \
     82of ${BOLD}${parent}${OFF}"
     83      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${DepFile%.dep}${OFF} is a dependency \
     84of ${BOLD}${id_of_dep}${OFF}"
     85      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \
     86of ${BOLD}${DepFile%.dep}${OFF}"
     87# If idofdep is the parent of DepFile, we can exchange them if required
     88#      if grep -q ${DepFile%.dep} ${id_of_dep}.dep; then
     89# we propose exchange always
     90        echo -en "\nCirc: $depth${spaceSTR:0:$depth}Do you want to build ${id_of_dep} first? yes/no (no):"
     91        read ANSWER
     92        if [ x$ANSWER = "xyes" ] ; then  # exchange:
     93# set triplet and return 1
     94          exchange_triplet=($parent $id_of_dep ${DepFile%.dep})
     95          return 1
     96        else # no exchange: prune
     97          lines_to_remove="$lines_to_remove $id_of_dep"
     98        fi
     99#      else
     100#        lines_to_remove="$lines_to_remove $id_of_dep"
     101#      fi
     102    else # not circular: prune
     103      lines_to_remove="$lines_to_remove $id_of_dep"
     104    fi
     105    continue
    41106  fi
     107  flag=true
     108  while [ $flag = true ]; do
     109    flag=false
     110    xsltproc --stringparam dependencies ${dep_level} \
     111        --stringparam idofdep $id_of_dep \
     112        -o ${id_of_dep}.dep \
     113        ../xsl/dependencies.xsl ../packages.xml
    42114
    43   #---------------------
    44   # XML file of the target package
    45   PKGXML=`grep "^$TARGET[[:space:]]" ../packages | cut -f2`
    46 
    47   #---------------------
    48   # The BLFS sources directory.
    49   BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'`
    50 
    51   if [[ ! -d ../$BLFS_XML ]] ; then
    52     echo -e "\tThe BLFS book sources directory is missing.\n"
    53     echo -e "\tExecution aborted.\n"
    54     cd .. && rmdir $TARGET
    55     exit 1
    56   fi
    57 
    58   #---------------------
    59   # XInclude stuff
    60   ENTRY_START="<xi:include xmlns:xi=\"http://www.w3.org/2003/XInclude\" href=\"../"
    61   ENTRY_END="\"/>"
    62 
    63   echo -e "\tGenerating $TARGET dependencies tree ..."
    64 
    65   mkdir dependencies
    66 
    67   #---------------------
    68   # Create target package dependencies list
    69   case $TARGET in
    70     # Skip the creation when all dependencies are circular.
    71     alsa-lib | cracklib | libexif | unixodbc ) ;;
    72 
    73     # Meta-packages at target level
    74     alsa )
    75       cp ../libs/alsa.dep dependencies/
    76       ;;
    77     gnome-core )
    78       cp ../libs/gnome-core.dep dependencies/
    79       ;;
    80     gnome-full )
    81       cp ../libs/gnome-{core,full}.dep dependencies/
    82       ;;
    83     kde-core )
    84       cp ../libs/kde-core.dep dependencies/
    85       ;;
    86     kde-full )
    87       cp ../libs/kde-{core,full}.dep dependencies/
    88       ;;
    89     kde-koffice )
    90       cp ../libs/kde-{core,full,koffice}.dep dependencies/
    91       ;;
    92     xorg7 )
    93       cp ../libs/xorg7.dep dependencies/
    94       ;;
    95     * ) # Default
    96       xsltproc --stringparam dependencies $DEP_LEVEL \
    97                -o dependencies/$TARGET.dep \
    98                ../libs/dependencies.xsl ../$PKGXML
    99       ;;
    100   esac
    101 
    102   #---------------------
    103   # Start with a clean $TARGET-index.xml.tmp file
    104   > $TARGET-index.xml.tmp
    105 
    106   #---------------------
    107   # Write the XInclude
    108   case $TARGET in
    109     # If there is no usefull XML page, skip it.
    110     alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice | xorg7) ;;
    111     * )
    112       echo -e "    $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp
    113       ;;
    114   esac
    115 
    116   #---------------------
    117   # If have dependencies, write its XInclude and find sub-dependencies
    118   if [[ -f dependencies/$TARGET.dep ]]; then
    119     mkdir xincludes && do_dependencies $TARGET
    120   fi
    121 
    122   echo -e "\n\t... done"
     115    if [[ -f ${id_of_dep}.dep ]]; then
     116      sed -i "1i${rootlink[*]} $count" ${id_of_dep}.dep
     117      generate_dependency_tree ${id_of_dep}.dep
     118# Test return value, in case we exchange dependencies
     119      case $? in
     120       0) # Normal return
     121         ;;
     122       1) # We are backing up to parent
     123         if [[ ${exchange_triplet} == ${DepFile%.dep} ]]
     124           then tree_erase ${id_of_dep}.dep
     125# Just doing a sed -i "s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
     126# is not good if $DepFile contains several times the same line
     127# so first find the first line and then sed
     128           lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1)
     129           sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
     130           id_of_dep=${exchange_triplet[2]}
     131           flag=true
     132         else
     133# echo backing up to ${exchange_triplet} at ${DepFile%.dep}
     134           return 1
     135         fi
     136         ;;
     137      esac
     138    else
     139      echo "${rootlink[*]} $count" > ${id_of_dep}.dep
     140    fi
     141  done
     142done
     143echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}"
     144} 6<$DepFile
     145# It may happen that a file is created with several times
     146# the same line. Normally, all those lines but one
     147# would be flagged to be removed (or all of them if
     148# the dependency appeared before). a simple sed /$line/d
     149# destroys all the lines. We should instead remove
     150# only one for each appearance of it in lines_to_remove.
     151# so first get the number of first line and then delete
     152# that line
     153for line in $lines_to_remove
     154  do lineno=$(sed -n /^$line\$/= $DepFile | head -n1)
     155  sed -i ${lineno}d $DepFile
     156done
     157return 0
    123158}
    124159
     160#---------------#
     161tree_browse() { #
     162#---------------#
     163local file=$1
     164local f
    125165
     166#echo file=$file
     167for f in $(grep '[^0-9 ]' $file); do
     168#  echo f=$f
     169  if grep -q '[^0-9 ]' ${f}.dep ; then
     170    tree_browse ${f}.dep
     171  fi
     172  echo $f
     173done
     174}
    126175
    127 #-----------------------#
    128 do_dependencies()  {    #  Loop to find sub-dependencies  :::WARNING::: THIS IS A RECURVISE FUNCTION
    129 #-----------------------#
    130 : <<inline_doc
    131     function:   Loop through all the packages and create a sub-dependency tree
    132     input vars: $1, package name
    133     externals:  vars:  $DEP_LEVEL
    134                        $TARGET
    135                        $PRINT_SERVER
    136                        $KBR5
    137                        $GHOSTSCRIPT
    138                        $MAILSERVER
    139                 file:  depure.txt
    140                        $TARGET-index.xml.tmp
    141                        $PKG.dep
    142                        $PKG.inc
    143     modifies:   files
    144     returns:    nothing
    145     output:     file:  $PKG-xinc.tmp
    146                        depure.txt
    147                        $TARGET-index.xml.tmp
    148     on error:   exit
    149     on success:
    150 inline_doc
     176#--------------#
     177tree_erase() { #
     178#--------------#
     179local file=$1
     180local f
     181local -a rootlink
     182local -a rootlink2
    151183
    152   set -e
    153   local PKG=$1
    154   local saveIFS=$IFS
    155   local DEP_LV=$DEP_LEVEL
    156   local line line2 DEP pkg_ver inst_ver
    157 
    158   #------------------
    159   #  If a premade xinclude file exists, use it. If not, create one
    160   if [[ -f xincludes/$PKG.xinc ]] ; then
    161     IFS=$'\x0A'
    162     for line in `cat xincludes/$PKG.xinc` ; do
    163       IFS=$saveIFS
    164       # Remove the Xinclude entry if found. We want the most newer one.
    165       # Using double quotes to let bash expand variables.
    166       # Remove also the empty line created. Can not be done in one step
    167       # due that d requires the pattner between /, but we have a lot of /
    168       # inside the pattner.
    169       sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
    170       # Write the XInclude
    171       echo -e "$line" >> $TARGET-index.xml.tmp
    172     done
    173     return
     184#echo file=$file
     185rootlink=($(head -n1 $file))
     186for f in $(grep '[^0-9 ]' $file); do
     187#  echo "    f"=$f
     188  if [ -f ${f}.dep ]; then
     189    rootlink2=($(head -n1 ${f}.dep))
     190    if [[ "${rootlink2[*]}" =~ "${rootlink[*]}" ]] ; then
     191      tree_erase ${f}.dep
     192    fi
    174193  fi
    175 
    176   #------------------
    177   # Start with a clean $PKG.xinc.tmp file
    178   > xincludes/$PKG.xinc.tmp
    179   for DEP in `cat dependencies/$PKG.dep`; do
    180 
    181     # Special packages that need be remaped
    182     case $DEP in
    183 
    184       db ) continue ;; # The proper version of DB is installed in LFS
    185 
    186         # Don't have their own XML file
    187       hal-requirements | hal-runtime-dependencies ) continue ;;
    188       perl-* | tk-perl )         DEP=perl-modules ;;
    189       dbus-* )                   DEP=dbus-bindings ;;
    190       pyxml | pycairo | pygobject | pygtk | pyorbit | \
    191       gnome-python | gnome-python-desktop ) DEP=python-modules ;;
    192 
    193         # Orphan links (proper link must be created when generating the book)
    194       arts )                     DEP=aRts ;;
    195       kde )                      DEP=kde-core ;;
    196 
    197         # Set values for alternative packages
    198       LPRng | cups )             DEP=$PRINT_SERVER ;;
    199       mitkrb | heimdal )         DEP=$KBR5 ;;
    200       gs | espgs )               DEP=$GHOSTSCRIPT ;;
    201       server-mail )              DEP=$MAIL_SERVER ;;
    202       x-window-system )
    203         case $X11 in
    204           xorg7 ) DEP=xorg7 ;;
    205               * )
    206                   pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3)
    207                   inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4)
    208                   [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
    209                   [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
    210                   ;;
    211         esac
    212         ;;
    213     esac
    214 
    215     # If DEP has been previouly installed, skip it
    216     pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3)
    217     inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4)
    218     [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
    219     [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
    220 
    221     #------------------
    222     # Prevent circular dependencies
    223     # If all dependencies are circular, the creation of the *.dep file
    224     # must be skipped, not placed here, to avoid that the script will bomb
    225     # due empty *.xinc files
    226     case $DEP in
    227       akode )
    228         # Both are in the same page
    229         [[ "$PKG" = "kdemultimedia" ]] && continue
    230         ;;
    231       aRts )
    232         # esound-->aRts-->esound
    233         [[ "$PKG" = "esound" ]] && continue
    234         ;;
    235       dbus-bindings )
    236         # True circular dependecy
    237         [[ "$PKG" = "dbus-bindings" ]] && continue
    238         ;;
    239       DocBook )
    240         # Used to rebuild the documentation
    241         [[ "$PKG" = "linux-pam" ]] && continue
    242         ;;
    243       docbook-xsl )
    244         # Used to rebuild the documentation
    245         [[ "$PKG" = "linux-pam" ]] && continue
    246         ;;
    247       doxygen )
    248         # Used to rebuild the documentation
    249         [[ "$PKG" = "dbus" ]] && continue
    250         [[ "$PKG" = "libdvdcss" ]] && continue
    251         [[ "$PKG" = "libusb" ]] && continue
    252         [[ "$PKG" = "libxcb" ]] && continue
    253         ;;
    254       espgs )
    255         # Used to rebuild the documentation
    256         [[ "$PKG" = "$MAIL_SERVER" ]] && continue
    257         ;;
    258       ffmpeg )
    259         # alsa-plugins-->ffmpeg-->several-->alsa-plugins
    260         [[ "$PKG" = "alsa-plugins" ]] && continue
    261         ;;
    262       fop )
    263         # Used to rebuild the documentation
    264         [[ "$PKG" = "linux-pam" ]] && continue
    265         ;;
    266       graphviz )
    267         # Used to build the API documentation
    268         [[ "$PKG" = "libusb" ]] && continue
    269         ;;
    270       GTK )
    271         # deprecated GTK version
    272         [[ "$PKG" = "alsa-tools" ]] && continue
    273         ;;
    274       gtk2 )
    275         # Testsuite only
    276         [[ "$PKG" = "cairo" ]] && continue
    277         ;;
    278       jadetex )
    279         # Runtime only
    280         [[ "$PKG" = "docbook-utils" ]] && continue
    281         ;;
    282       $KBR5 )
    283         # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
    284         [[ "$PKG" = "cyrus-sasl" ]] && continue
    285         ;;
    286       librsvg )
    287         # Testsuite only
    288         [[ "$PKG" = "cairo" ]] && continue
    289         ;;
    290       libxslt )
    291         # libxml2-->libxslt-->libxml2
    292         [[ "$PKG" = "libxml2" ]] && continue
    293         ;;
    294       Links )
    295         # Runtime only
    296         [[ "$PKG" = "docbook-utils" ]] && continue
    297         ;;
    298       lynx )
    299         # Runtime only
    300         [[ "$PKG" = "docbook-utils" ]] && continue
    301         ;;
    302       openldap )
    303         # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
    304         [[ "$PKG" = "cyrus-sasl" ]] && continue
    305         ;;
    306       poppler )
    307         # Testsuite only
    308         [[ "$PKG" = "cairo" ]] && continue
    309         ;;
    310       postgresql )
    311         # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
    312         [[ "$PKG" = "cyrus-sasl" ]] && continue
    313         ;;
    314       python-modules )
    315         # True circular dependecy
    316         [[ "$PKG" = "python-modules" ]] && continue
    317         # libgsf-->python-modules-->several combinations-->libgsf
    318         [[ "$PKG" = "libgsf" ]] && continue
    319         # gimp-->python-modules-->several combinations-->gimp
    320         [[ "$PKG" = "gimp" ]] && continue
    321         # Used to rebuild the documentation
    322         [[ "$PKG" = "gstreamer" ]] && continue
    323         [[ "$PKG" = "gst-plugins-base" ]] && continue
    324         [[ "$PKG" = "gst-plugins-good" ]] && continue
    325         ;;
    326       tk )
    327         # python-->tk-->xorg7-->several combinations-->libxslt-->python
    328         [[ "$PKG" = "python" ]] && continue
    329         ;;
    330       w3m )
    331         # Runtime only
    332         [[ "$PKG" = "docbook-utils" ]] && continue
    333         # Used to rebuild the documentation
    334         [[ "$PKG" = "linux-pam" ]] && continue
    335         ;;
    336     esac
    337 
    338     #------------------
    339     # XML file of dependency package
    340     DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2`
    341     case $DEP in
    342       x-window-system | alsa ) ;; # No page for that (proper link must be created when generating the book)
    343       xorg7 ) ;; # This page will be dump in the xorg7.xinc file
    344       gnome-core | kde-core | kde-full ) ;; # Invented packages
    345       * )
    346         # Remove the Xinclude entry if found
    347         sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \
    348             -e '/./!d' -i xincludes/$PKG.xinc.tmp
    349         # Write the XInclude
    350         echo -e "    $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
    351         ;;
    352     esac
    353 
    354     #------------------
    355     # If not already created, create its dependencies list
    356     if [[ ! -f dependencies/$DEP.dep ]] ; then
    357       case $DEP in
    358         # Skip the creation when all dependencies are circular.
    359         alsa-lib | cracklib | libexif | unixodbc ) ;;
    360         # Meta-packages at dependency level
    361         alsa )
    362           cp ../libs/alsa.dep dependencies/
    363           ;;
    364         kde-core )
    365           cp ../libs/kde-core.dep dependencies/
    366           ;;
    367         x-window-system ) # When X11 is not Xorg7
    368           echo -e "x-config\nx-setup\n$X11" > dependencies/x-window-system.dep
    369           ;;
    370         xorg7 )
    371           cp ../libs/xorg7.dep dependencies/
    372           ;;
    373         * ) xsltproc --stringparam dependencies $DEP_LV \
    374                -o dependencies/$DEP.dep ../libs/dependencies.xsl ../$DEP_XML
    375           ;;
    376       esac
    377     fi
    378 
    379     #------------------
    380     # If needed, process its dependencies
    381     if [[ -f dependencies/$DEP.dep ]] ; then
    382       # If a premade xinclude file esist, include it
    383       if [[ -f xincludes/$DEP.xinc ]] ; then
    384         IFS=$'\x0A'
    385         for line2 in `cat xincludes/$DEP.xinc` ; do
    386           IFS=$saveIFS
    387           # Remove the Xinclude entry if found
    388           sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
    389           # Write the XInclude
    390           echo -e "$line2" >> xincludes/$PKG.xinc.tmp
    391         done
    392       #------------------
    393       # Create the xinclude file
    394       else
    395         #
    396         # >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<<
    397         #
    398         # If the recursion depth is not too great this is an acceptable methodology for a script language
    399         # However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables.
    400         #
    401         set +e
    402          [[ "${VERBOSITY}" > 0 ]] && echo -ne "\ncall: $((++cntr))${spaceSTR:0:$cntr}${RED}$DEP${OFF}"
    403             do_dependencies $DEP
    404          [[ "${VERBOSITY}" > 0 ]] && echo -ne "\n ret: $cntr${spaceSTR:0:$((cntr--))}${GREEN}$DEP${OFF}  Using $DEP Xinc to solve $PKG"
    405         set -e
    406 
    407         # Include it when done
    408         IFS=$'\x0A'
    409         for line2 in `cat xincludes/$DEP.xinc` ; do
    410           IFS=$saveIFS
    411           # Remove the Xinclude entry if found
    412           sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
    413           # Write the XInclude
    414           echo -e "$line2" >> xincludes/$PKG.xinc.tmp
    415         done
    416       fi
    417     fi
    418   done
    419 
    420   #------------------
    421   if [[ "$PKG" = "xorg7" ]] ; then
    422     # Add their XInclude
    423     PKG_XML=${BLFS_XML}/x/installing/xorg7.xml
    424     echo -e "    $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
    425   fi
    426 
    427   #------------------
    428   mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc
    429   IFS=$'\x0A'
    430   for line in `cat xincludes/$PKG.xinc` ; do
    431     IFS=$saveIFS
    432     # Remove the Xinclude entry if found.
    433     sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
    434     # Write the XInclude
    435     echo -e "$line" >> $TARGET-index.xml.tmp
    436   done
     194done
     195rm -f $file
    437196}
Note: See TracChangeset for help on using the changeset viewer.