r2709 - jhalfs/branches/experimental/BLFS

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Wed May 24 12:31:49 PDT 2006


Author: georgeb
Date: 2006-05-24 13:31:48 -0600 (Wed, 24 May 2006)
New Revision: 2709

Added:
   jhalfs/branches/experimental/BLFS/TODO
   jhalfs/branches/experimental/BLFS/func_makefile
   jhalfs/branches/experimental/BLFS/func_parser
Modified:
   jhalfs/branches/experimental/BLFS/blfs-parser.sh
   jhalfs/branches/experimental/BLFS/func_dependencies
Log:
Creation of func_xxx files, TODO list, reorganize internal code

Added: jhalfs/branches/experimental/BLFS/TODO
===================================================================
--- jhalfs/branches/experimental/BLFS/TODO	                        (rev 0)
+++ jhalfs/branches/experimental/BLFS/TODO	2006-05-24 19:31:48 UTC (rev 2709)
@@ -0,0 +1,27 @@
+#####
+#
+# Project TODO list
+#
+# $Id:
+#####
+
+For now the code is able to do the first step for the new approach: to create 
+LFS-like books from BLFS sources, allowing to create linear build scrips and 
+Makefiles similars to the current ones for {C,H}LFS.
+
+What remains to do:
+
+1. - To make the top-level blfs script functional. That script should to create 
+       the working directory (selected at command line)
+     a. Copy all BLFS/* files to it, 
+     b. Fetch the BLFS sources (output directory selected at command line or 
+          based on the book version), 
+     c. Run the packages.sh script.
+  
+2. - To develop the XSL code needed to create the build scripts.
+
+3. - To develop the code to create the Makefile
+
+4. - To find a way to track already installed packages by previous runs, to can 
+       skip them when creating the book/scripts/Makefile for a new target.
+


Property changes on: jhalfs/branches/experimental/BLFS/TODO
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev Id

Modified: jhalfs/branches/experimental/BLFS/blfs-parser.sh
===================================================================
--- jhalfs/branches/experimental/BLFS/blfs-parser.sh	2006-05-23 19:00:36 UTC (rev 2708)
+++ jhalfs/branches/experimental/BLFS/blfs-parser.sh	2006-05-24 19:31:48 UTC (rev 2709)
@@ -3,33 +3,60 @@
 # $Id$
 #
 set -e
+declare TARGET
+declare DEP_LEVEL
+declare PKGXML
+declare BLFS_XML
+declare VERBOSITY=1
 
+# Grab and name the command line options
+    optTARGET=$1 
+optDEPENDENCY=$2
+
+
+#---------------------
+# Constants
+source constants.inc
+[[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
+
+#---------------------
 # Configuration file for alternatives
 source alternatives.conf
-[[ $? > 0 ]] && echo -e "\n\tWARNING: alternatives.conf did not load..\n" && exit
+[[ $? > 0 ]] && echo -e "\n\tERROR: alternatives.conf did not load..\n" && exit
 
+#---------------------
 # Dependencies module
 source func_dependencies
-[[ $? > 0 ]] && echo -e "\n\tWARNING: func_dependencies did not load..\n" && exit
+[[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
 
-#======= MAIN ========
 
-if [[ ! -f packages ]] ; then
-  echo -e "\tNo packages file has been found.\n"
-  echo -e "\tExecution aborted.\n"
-  exit 1
-fi
 
-# ID of target package (as listed in packages file)
-if [[ -z "$1" ]] ; then
-  echo -e "\n\tYou must to provide a package ID."
-  echo -e "\tSee packages file for a list of available targets.\n"
-  exit 1
-elif ! grep  "^$1[[:space:]]" packages > /dev/null ; then
-  echo -e "\n\t$1 is not a valid package ID."
-  echo -e "\tSee packages file for a list of available targets.\n"
-  exit 1
-else
+#-------------------------#
+validate_target() {       # ID of target package (as listed in packages file)
+#-------------------------#
+: <<inline_doc
+    function:   Validate the TARGET parameter. 
+    input vars: $1, package/target to validate
+    externals:  file: packages
+    modifies:   TARGET
+    returns:    nothing
+    output:     nothing
+    on error:   exit
+    on success: modifies TARGET 
+inline_doc
+
+  if [[ -z "$1" ]] ; then
+    echo -e "\n\tYou must to provide a package ID."
+    echo -e "\tSee packages file for a list of available targets.\n"
+    exit 1
+  fi
+
+  if ! grep  "^$1[[:space:]]" packages > /dev/null ; then
+    echo -e "\n\t$1 is not a valid package ID."
+    echo -e "\tSee packages file for a list of available targets.\n"
+    exit 1
+  fi
+
   case $1 in
     xorg7 )
       TARGET=xterm2
@@ -41,175 +68,81 @@
       echo -e "\n\tUsing $TARGET as the target package."
       ;;
   esac
-fi
+}
 
-# Dependencies level 1(required)/2(1 + recommended)/3(2+ optional)
-if [[ -z "$2" ]] ; then
-  DEP_LEVEL=2
-  echo -e "\n\tNo dependencies level has been defined."
-  echo -e "\tAssuming level $DEP_LEVEL (Required plus Recommended).\n"
-else
-  case $2 in
+#-------------------------#
+validate_dependency() {   # Dependencies level 1(required)/2(1 + recommended)/3(2+ optional)
+#-------------------------#
+: <<inline_doc
+    function:   Validate the dependency level requested. 
+    input vars: $1, requested dependency level
+    externals:  vars: TARGET
+    modifies:   vars: DEP_LEVEL
+    returns:    nothing
+    output:     nothing
+    on error:   nothing
+    on success: modifies DEP_LEVEL, default value = 2
+inline_doc
+
+  if [[ -z "$1" ]] ; then
+    DEP_LEVEL=2
+    echo -e "\n\tNo dependencies level has been defined."
+    echo -e "\tAssuming level $DEP_LEVEL (Required plus Recommended).\n"
+    return
+  fi
+
+  case $1 in
     1 | 2 )
-      DEP_LEVEL=$2
+      DEP_LEVEL=$1
       echo -e "\n\tUsing $DEP_LEVEL as dependencies level.\n"
       ;;
-    # Prevent circular dependencies when level 3
-    # cracklib-->python-->tk-->X-->linux-pam-->cracklib
-    # docbook-utils--> Optional dependencies are runtime only
-    # libxml2-->libxslt-->libxml2
-    # cyrus-sasl-->openldap-->cyrus-sasl
-    # alsa-lib-->doxygen-->graphviz-->jdk-->alsa-lib
-    # unixodbc-->qt-->unixodbc
-    # cups-->php-->sendmail-->espgs-->cups
-    # libexif-->graphviz-->php-->libexif
-    # esound-->aRts-->esound
-    # gimp-->imagemagick-->gimp
+      # Prevent circular dependencies when level 3
+      # cracklib-->python-->tk-->X-->linux-pam-->cracklib
+      # docbook-utils--> Optional dependencies are runtime only
+      # libxml2-->libxslt-->libxml2
+      # cyrus-sasl-->openldap-->cyrus-sasl
+      # alsa-lib-->doxygen-->graphviz-->jdk-->alsa-lib
+      # unixodbc-->qt-->unixodbc
+      # cups-->php-->sendmail-->espgs-->cups
+      # libexif-->graphviz-->php-->libexif
+      # esound-->aRts-->esound
+      # gimp-->imagemagick-->gimp
     3 )
       case $TARGET in
         cracklib | docbook-utils | libxml2 | cyrus-sasl | alsa-lib | \
         unixodbc | cups | libexif | esound | gimp )
           DEP_LEVEL=2
-          echo -e "\n\t$TARGET have circular dependencies at level $2"
+          echo -e "\n\t$TARGET have circular dependencies at level $1"
           echo -e "\tUsing $DEP_LEVEL as dependencies level.\n"
           ;;
         * )
-          DEP_LEVEL=$2
+          DEP_LEVEL=$1
           echo -e "\n\tUsing $DEP_LEVEL as dependencies level.\n"
           ;;
       esac
       ;;
     * )
       DEP_LEVEL=2
-      echo -e "\n\t$2 is not a valid dependencies level."
+      echo -e "\n\t$1 is not a valid dependencies level."
       echo -e "\tAssuming level $DEP_LEVEL (Required plus Recommended).\n"
       ;;
   esac
-fi
+}
 
-# Create the working directory and cd into it
-mkdir $TARGET && cd $TARGET
 
-# XML file of the target package
-PKGXML=`grep "^$TARGET[[:space:]]" ../packages | cut -f2`
 
-# The BLFS sources directory.
-BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'`
 
-if [[ ! -d ../$BLFS_XML ]] ; then
-  echo -e "\tThe BLFS book sources directory is missing.\n"
+
+#------- MAIN --------
+if [[ ! -f packages ]] ; then
+  echo -e "\tNo packages file has been found.\n"
   echo -e "\tExecution aborted.\n"
-  cd .. && rmdir $TARGET
   exit 1
 fi
 
-# XInclude stuff
-ENTRY_START="<xi:include xmlns:xi=\"http://www.w3.org/2003/XInclude\" href=\"../"
-ENTRY_END="\"/>"
-
-echo -en "\tGenerating $TARGET dependencies tree ..."
-
-# Create target package dependencies list
-case $TARGET in
-  # Meta-packages at target level
-  # KDE and Gnome-{core,full} could be made via packages.sh, but not sure yet how.
-  alsa ) # When target "alsa", use all alsa-* packages
-    echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
-             alsa-plugins\nalsa-lib" > dependencies/$TARGET.dep
-    ;;
-  * ) # Default
-    xsltproc --stringparam dependencies $DEP_LEVEL -o dependencies/$TARGET.dep \
-             ../dependencies.xsl ../$PKGXML
-    ;;
-esac
-
-# Start with a clean $TARGET-index.xml.tmp file
-> $TARGET-index.xml.tmp
-
-# Write the XInclude
-echo -e "    $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp
-
-# Start with a clean depure.txt file
-> depure.txt
-
-# If have dependencies, write its XInclude and find sub-dependencies
-[[ -f dependencies/$TARGET.dep ]] && \
-echo -e "Start loop for PKG $TARGET\n" >> depure.txt && \
-mkdir xincludes && do_dependencies $TARGET
-
-echo "done"
-
-echo -en "\tGenerating $TARGET-index.xml ..."
-
-# Header to $TARGET-index.xml
-{
-cat << EOF
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" >
-
-<book>
-
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/book/bookinfo.xml"/>
-
-  <preface>
-    <?dbhtml filename="preface.html" dir="preface"?>
-
-    <title>Preface</title>
-
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/locale-issues.xml"/>
-    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/bootscripts.xml"/>
-
-  </preface>
-
-  <chapter>
-    <?dbhtml filename="chapter.html" dir="installing"?>
-
-    <title>Installing $TARGET in Dependencies Build Order</title>
-
-EOF
-} > $TARGET-index.xml
-
-# Dump $TARGET-index.xml.tmp in reverse order.
-tac $TARGET-index.xml.tmp >> $TARGET-index.xml
-rm $TARGET-index.xml.tmp
-
-# Footer of $TARGET-index.xml
-{
-cat << EOF
-
-  </chapter>
-
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/creat-comm.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/ac-free-lic.xml"/>
-
-  <index/>
-
-</book>
-
-EOF
-} >> $TARGET-index.xml
-
-echo "done"
-
-echo -en  "\tGenerating the HTML book ..."
-
-xsltproc --xinclude --nonet --stringparam base.dir HTML/ \
-         --stringparam chunk.quietly 1 \
-         ../$BLFS_XML/stylesheets/blfs-chunked.xsl \
-         $TARGET-index.xml > xsltproc.log 2>&1
-mkdir HTML/{stylesheets,images}
-cp ../$BLFS_XML/stylesheets/*.css HTML/stylesheets
-cp ../$BLFS_XML/images/*.png HTML/images
-cd HTML
-sed -i -e "s at ../stylesheets at stylesheets@g" *.html
-sed -i -e "s at ../images at images@g" *.html
-for filename in `find . -name "*.html"` ; do
-  tidy -config ../../$BLFS_XML/tidy.conf $filename || true
-  sh ../../$BLFS_XML/obfuscate.sh $filename
-  sed -i -e "s at text/html at application/xhtml+xml at g" $filename
-done
-
-echo "done"
-
-echo -en  "\tGenerating the build scripts ... not implemented yet, sorry\n"
+validate_target     "${optTARGET}"
+validate_dependency "${optDEPENDENCY}"
+generate_dependency_tree
+generate_TARGET_xml
+generate_target_book
+create_build_scripts

Modified: jhalfs/branches/experimental/BLFS/func_dependencies
===================================================================
--- jhalfs/branches/experimental/BLFS/func_dependencies	2006-05-23 19:00:36 UTC (rev 2708)
+++ jhalfs/branches/experimental/BLFS/func_dependencies	2006-05-24 19:31:48 UTC (rev 2709)
@@ -4,19 +4,133 @@
 #
 set -e
 
+declare -i cntr=0
+declare -a spaceSTR="                                                                   "
+
+#----------------------------#
+generate_dependency_tree() { #
+#----------------------------#
+: <<inline_doc
+    function:   Create a dependency tree for the TARGET
+    input vars: none
+    externals:  vars: TARGET
+                      PKGXML
+		      DEP_LEVEL
+                func: do_dependencies
+    modifies:   vars: PKGXML 
+                      BLFS_XML
+    returns:    nothing
+    output:     files: $TARGET.dep
+                       $TARGET-index.xml.tmp
+                       depure.txt
+    on error:   nothing
+    on success: nothing
+inline_doc
+
+  local ENTRY_START
+  local ENTRY_END
+  
+  #---------------------
+  # Create the working directory and cd into it
+  mkdir $TARGET && cd $TARGET
+
+  #---------------------
+  # XML file of the target package
+  PKGXML=`grep "^$TARGET[[:space:]]" ../packages | cut -f2`
+
+  #---------------------
+  # The BLFS sources directory.
+  BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'`
+
+  if [[ ! -d ../$BLFS_XML ]] ; then
+    echo -e "\tThe BLFS book sources directory is missing.\n"
+    echo -e "\tExecution aborted.\n"
+    cd .. && rmdir $TARGET
+    exit 1
+  fi
+
+  #---------------------
+  # XInclude stuff
+  ENTRY_START="<xi:include xmlns:xi=\"http://www.w3.org/2003/XInclude\" href=\"../"
+  ENTRY_END="\"/>"
+
+  echo -en "\tGenerating $TARGET dependencies tree ..."
+
+  #---------------------
+  # Create target package dependencies list
+  case $TARGET in
+    # Meta-packages at target level
+    # KDE and Gnome-{core,full} could be made via packages.sh, but not sure yet how.
+    alsa ) # When target "alsa", use all alsa-* packages
+      echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
+               alsa-plugins\nalsa-lib" > dependencies/$TARGET.dep
+      ;;
+    * ) # Default
+      xsltproc --stringparam dependencies $DEP_LEVEL \
+               -o dependencies/$TARGET.dep \
+               ../dependencies.xsl ../$PKGXML
+      ;;
+  esac
+
+  #---------------------
+  # Start with a clean $TARGET-index.xml.tmp file
+  > $TARGET-index.xml.tmp
+
+  #---------------------
+  # Write the XInclude
+  echo -e "    $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp
+
+  #------------------P---
+  # Start with a clean depure.txt file
+  > depure.txt
+
+  #---------------------
+  # If have dependencies, write its XInclude and find sub-dependencies
+  if [[ -f dependencies/$TARGET.dep ]]; then
+    echo -e "Start loop for PKG $TARGET\n" >> depure.txt
+    mkdir xincludes && do_dependencies $TARGET
+  fi
+
+  echo "done"
+}
+
+
+
 #-----------------------#
-do_dependencies()  {    #  Loop to find sub-dependencies
+do_dependencies()  {    #  Loop to find sub-dependencies  :::WARNING::: THIS IS A RECURVISE FUNCTION
 #-----------------------#
+: <<inline_doc
+    function:   Loop through all the packages and create a sub-dependency tree
+    input vars: $1, package name
+    externals:  vars:  $DEP_LEVEL
+                       $TARGET
+                       $PRINT_SERVER
+                       $KBR5
+                       $GHOSTSCRIPT
+                       $MAILSERVER
+                file:  depure.txt
+                       $TARGET-index.xml.tmp
+                       $PKG.dep
+                       $PKG.inc		
+    modifies:   files
+    returns:    nothing
+    output:     file:  $PKG-xinc.tmp
+                       depure.txt
+                       $TARGET-index.xml.tmp
+    on error:   exit
+    on success: 
+inline_doc
+
   set -e
   local PKG=$1
   local saveIFS=$IFS
   local DEP_LV=$DEP_LEVEL
   local line line2 DEP
-
   echo -e "\tPKG is $PKG" >> depure.txt
   echo -e "\tDEP_LEVEL for $PKG is $DEP_LV\n" >> depure.txt
 
-  #  If a premade xinclude file esist, use it. If not, create one
+  #------------------
+  #  If a premade xinclude file exists, use it. If not, create one
   if [[ -f xincludes/$PKG.xinc ]] ; then
     echo -e "\tReusing xinclude file for PKG $PKG" >> depure.txt
     IFS=$'\x0A'
@@ -31,120 +145,147 @@
       # Write the XInclude
       echo -e "$line" >> $TARGET-index.xml.tmp
     done
-  else
-    # Start with a clean $PKG.xinc.tmp file
-    > xincludes/$PKG.xinc.tmp
-    for DEP in `cat dependencies/$PKG.dep`; do
-      # Especial packages (a lot of hacks)
-      case $DEP in
-        # The proper version of DB is installed in LFS
-        db ) continue ;;
-        # ID value don't have their own XML package file
-        hal-requirements ) continue ;;
-        perl-* | tk-perl ) DEP=perl-modules ;;
+    return
+  fi
+  
+  #------------------
+  # Start with a clean $PKG.xinc.tmp file
+  > xincludes/$PKG.xinc.tmp
+  for DEP in `cat dependencies/$PKG.dep`; do
+    # Special packages (a lot of hacks)
+    case $DEP in
+        
+      db ) # The proper version of DB is installed in LFS
+        continue ;;        
+      hal-requirements ) # ID value don't have their own XML package file
+        continue ;;
+      perl-* | tk-perl )  DEP=perl-modules ;;
+
         # Orphan links (proper link must be created when generating the book)
-        arts ) DEP=aRts ;; # That should be fixed in the BLFS book
+      arts )              DEP=aRts ;; # That should be fixed in the BLFS book
         # Set values for alternative packages
         # X is a meta-package, thus handled in another way.
-        LPRng | cups ) DEP=$PRINT_SERVER ;;
-        mitkrb | heimdal ) DEP=$KBR5 ;;
-        gs | espgs ) DEP=$GHOSTSCRIPT ;;
-        MTA ) DEP=$MAIL_SERVER ;; # The BLFS book need be fixed yet for that
-      esac
-      echo -e "\tDEP for $PKG is $DEP" >> depure.txt
+      LPRng | cups )      DEP=$PRINT_SERVER ;;
+      mitkrb | heimdal )  DEP=$KBR5 ;;
+      gs | espgs )        DEP=$GHOSTSCRIPT ;;
+      MTA )               DEP=$MAIL_SERVER ;; # The BLFS book need be fixed yet for that
+    esac
+
+    #------------------
+    echo -e "\tDEP for $PKG is $DEP" >> depure.txt
+    case $DEP in
+      # Circular dependencies at level 3
+      cracklib | docbook-utils | libxml2 | cyrus-sasl | alsa-lib | \
+      unixodbc | cups | libexif | esound | gimp )
+        [[ "$DEP_LV" = "3" ]] && DEP_LV=2
+        ;;
+      * ) DEP_LV=$DEP_LEVEL ;;
+    esac
+
+    #------------------
+    echo -e "\tDEP_LEVEL for $DEP is $DEP_LV" >> depure.txt
+    # XML file of dependency package
+    DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2`
+    echo -e "\t\tDEP_XML is $DEP_XML\n" >> depure.txt
+    case $DEP in
+      x-window-system ) ;; # No page for that (proper link must be created when generating the book)
+      xorg7 ) ;; # This page will be dump in the xorg7.xinc file
+      * )
+        # Remove the Xinclude entry if found
+        sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \
+            -e '/./!d' -i xincludes/$PKG.xinc.tmp
+        # Write the XInclude
+        echo -e "    $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
+        ;;
+    esac
+
+    #------------------
+    # If not already created, create its dependencies list
+    if [[ ! -f dependencies/$DEP.dep ]] ; then
       case $DEP in
-        # Circular dependencies at level 3
-        cracklib | docbook-utils | libxml2 | cyrus-sasl | alsa-lib | \
-        unixodbc | cups | libexif | esound | gimp )
-          [[ "$DEP_LV" = "3" ]] && DEP_LV=2
+        # Meta-packages at dependency level (ugly *.dep files, but work for now)
+        alsa ) # When dependency "alsa", use all alsa-* packages
+          echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
+                   alsa-plugins\nalsa-lib" > dependencies/$DEP.dep
           ;;
-        * ) DEP_LV=$DEP_LEVEL ;;
+        x-window-system ) # X11 alternatives
+          echo -e "x-config\nx-setup\n$X11" > dependencies/$DEP.dep
+          ;;
+        xorg7 ) # All Xorg7 packages except Xterm (circular dependency)
+          echo -e "rman\nxorg7-driver\nxorg7-server\nluit\nxorg7-font\n \
+                   xorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \
+                   xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/$DEP.dep
+          ;;
+        * ) xsltproc --stringparam dependencies $DEP_LV \
+               -o dependencies/$DEP.dep ../dependencies.xsl ../$DEP_XML
+          ;;
       esac
-      echo -e "\tDEP_LEVEL for $DEP is $DEP_LV" >> depure.txt
-      # XML file of dependency package
-      DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2`
-      echo -e "\t\tDEP_XML is $DEP_XML\n" >> depure.txt
-      case $DEP in
-        x-window-system ) ;; # No page for that (proper link must be created when generating the book)
-        xorg7 ) ;; # This page will be dump in the xorg7.xinc file
-        * )
+    fi
+
+    #------------------
+    # If needed, process its dependencies
+    if [[ -f dependencies/$DEP.dep ]] ; then
+      # If a premade xinclude file esist, include it
+      if [[ -f xincludes/$DEP.xinc ]] ; then
+        echo -e "\tReusing xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt
+        IFS=$'\x0A'
+        for line2 in `cat xincludes/$DEP.xinc` ; do
+          IFS=$saveIFS
           # Remove the Xinclude entry if found
-          sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \
-              -e '/./!d' -i xincludes/$PKG.xinc.tmp
+          sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
           # Write the XInclude
-          echo -e "    $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
-          ;;
-      esac
-      # If not already created, create its dependencies list
-      if [[ ! -f dependencies/$DEP.dep ]] ; then
-        case $DEP in
-          # Meta-packages at dependency level (ugly *.dep files, but work for now)
-          alsa ) # When dependency "alsa", use all alsa-* packages
-            echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \
-                     alsa-plugins\nalsa-lib" > dependencies/$DEP.dep
-            ;;
-          x-window-system ) # X11 alternatives
-            echo -e "x-config\nx-setup\n$X11" > dependencies/$DEP.dep
-            ;;
-          xorg7 ) # All Xorg7 packages except Xterm (circular dependency)
-            echo -e "rman\nxorg7-driver\nxorg7-server\nluit\nxorg7-font\n \
-                     xorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \
-                     xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/$DEP.dep
-            ;;
-          * ) xsltproc --stringparam dependencies $DEP_LV \
-                 -o dependencies/$DEP.dep ../dependencies.xsl ../$DEP_XML
-            ;;
-        esac
+          echo -e "$line2" >> xincludes/$PKG.xinc.tmp
+        done
+      #------------------
+      # Create the xinclude file
+      else
+        echo -e "\nStart new loop for PKG $DEP (to solve $PKG)\n" >> depure.txt
+	#
+	# >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<<
+	#
+	# If the recursion depth is not too great this is an acceptable methodology for a script language
+	# However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables.
+	# 
+        set +e
+         [[ "${VERBOSITY}" > 0 ]] && echo -ne "\nrecursive call: $((++cntr)) ${spaceSTR:0:$cntr} ${RED}$DEP${OFF}"
+         echo -ne "\nrecursive call: $cntr ${spaceSTR:0:$cntr} $DEP" >>koffice.XX
+            do_dependencies $DEP
+         echo -ne  "\nrecursive ret:  $cntr ${spaceSTR:0:$cntr} $DEP\t(to solve $PKG)" >>koffice.XX
+         [[ "${VERBOSITY}" > 0 ]] && echo -ne  "\nrecursive ret:  $cntr ${spaceSTR:0:$((cntr--))} ${GREEN}$DEP${OFF}\tUsing the new xinclude file for PKG $DEP (to solve $PKG)"
+        set -e
+	
+        # Include it when done
+        echo -e "\tUsing the new xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt
+        IFS=$'\x0A'
+        for line2 in `cat xincludes/$DEP.xinc` ; do
+          IFS=$saveIFS
+          # Remove the Xinclude entry if found
+          sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
+          # Write the XInclude
+          echo -e "$line2" >> xincludes/$PKG.xinc.tmp
+        done
       fi
-      # If needed, process its dependencies
-      if [[ -f dependencies/$DEP.dep ]] ; then
-        # If a premade xinclude file esist, include it
-        if [[ -f xincludes/$DEP.xinc ]] ; then
-          echo -e "\tReusing xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt
-          IFS=$'\x0A'
-          for line2 in `cat xincludes/$DEP.xinc` ; do
-            IFS=$saveIFS
-            # Remove the Xinclude entry if found
-            sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
-            # Write the XInclude
-            echo -e "$line2" >> xincludes/$PKG.xinc.tmp
-          done
-        # Create the xinclude file
-        else
-          echo -e "\nStart new loop for PKG $DEP (to solve $PKG)\n" >> depure.txt
-          # We will call the function from inside it
-          set +e
-          do_dependencies $DEP
-          set -e
-          # Include it when done
-          echo -e "\tUsing the new xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt
-          IFS=$'\x0A'
-          for line2 in `cat xincludes/$DEP.xinc` ; do
-            IFS=$saveIFS
-            # Remove the Xinclude entry if found
-            sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
-            # Write the XInclude
-            echo -e "$line2" >> xincludes/$PKG.xinc.tmp
-          done
-        fi
-      fi
-    done
-    if [[ "$PKG" = "xorg7" ]] ; then
-      # Add their XInclude
-      PKG_XML=`grep "^$PKG[[:space:]]" ../packages | cut -f2`
-      echo -e "    $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
     fi
-    mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc
-    echo -e "Using the new xinclude file for PKG $PKG" >> depure.txt
-    IFS=$'\x0A'
-    for line in `cat xincludes/$PKG.xinc` ; do
-      IFS=$saveIFS
-      # Remove the Xinclude entry if found.
-      sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
-      # Write the XInclude
-      echo -e "$line" >> $TARGET-index.xml.tmp
-    done
+  done
+
+  #------------------
+  if [[ "$PKG" = "xorg7" ]] ; then
+    # Add their XInclude
+    PKG_XML=`grep "^$PKG[[:space:]]" ../packages | cut -f2`
+    echo -e "    $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
   fi
 
- echo -e "\nEnd loop for PKG $PKG\n" >> depure.txt
+  #------------------
+  mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc
+  echo -e "Using the new xinclude file for PKG $PKG" >> depure.txt
+  IFS=$'\x0A'
+  for line in `cat xincludes/$PKG.xinc` ; do
+    IFS=$saveIFS
+    # Remove the Xinclude entry if found.
+    sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
+    # Write the XInclude
+    echo -e "$line" >> $TARGET-index.xml.tmp
+  done
+
+  echo -e "\nEnd loop for PKG $PKG\n" >> depure.txt
 }

Added: jhalfs/branches/experimental/BLFS/func_makefile
===================================================================
--- jhalfs/branches/experimental/BLFS/func_makefile	                        (rev 0)
+++ jhalfs/branches/experimental/BLFS/func_makefile	2006-05-24 19:31:48 UTC (rev 2709)
@@ -0,0 +1,6 @@
+#####
+#
+# 
+#
+# $Id:
+#####


Property changes on: jhalfs/branches/experimental/BLFS/func_makefile
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev Id

Added: jhalfs/branches/experimental/BLFS/func_parser
===================================================================
--- jhalfs/branches/experimental/BLFS/func_parser	                        (rev 0)
+++ jhalfs/branches/experimental/BLFS/func_parser	2006-05-24 19:31:48 UTC (rev 2709)
@@ -0,0 +1,135 @@
+#####
+#
+# Parse the XML documents to create a 'package' book
+#
+# $Id:
+#####
+
+
+#----------------------------#
+generate_TARGET_xml()  {     #
+#----------------------------#
+: <<inline_doc
+    function:   Generate the XML document for the TARGET package
+    input vars: nothing
+    externals:  vars: TARGET
+    modifies:   nothing
+    returns:    nothing
+    output:     file: $TARGET-index.xml
+    on error:   nothing
+    on success: nothing
+inline_doc
+
+  local  
+  echo -en "\tGenerating $TARGET-index.xml ..."
+
+  #---------------------
+  # Header to $TARGET-index.xml
+{
+cat << EOF
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" >
+
+<book>
+
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/book/bookinfo.xml"/>
+
+  <preface>
+    <?dbhtml filename="preface.html" dir="preface"?>
+
+    <title>Preface</title>
+
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/locale-issues.xml"/>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/introduction/important/bootscripts.xml"/>
+
+  </preface>
+
+  <chapter>
+    <?dbhtml filename="chapter.html" dir="installing"?>
+
+    <title>Installing $TARGET in Dependencies Build Order</title>
+
+EOF
+} > $TARGET-index.xml
+
+  #---------------------
+  # Dump $TARGET-index.xml.tmp in reverse order.
+  tac $TARGET-index.xml.tmp >> $TARGET-index.xml
+  rm $TARGET-index.xml.tmp
+
+  #---------------------
+  # Footer of $TARGET-index.xml
+{
+cat << EOF
+
+  </chapter>
+
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/creat-comm.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../$BLFS_XML/appendices/ac-free-lic.xml"/>
+
+  <index/>
+
+</book>
+
+EOF
+} >> $TARGET-index.xml
+
+  echo "done"
+}
+
+
+#-------------------------#
+generate_target_book() {  #
+#-------------------------#
+: <<inline_doc
+    function:   Create an HTML document of the requested TARGET.
+    input vars: nothing
+    externals:  vars: TARGET
+                      BLFS_XML
+    modifies:   nothing
+    returns:    nothing
+    output:     file: NUMEROUS FILES
+    on error:   nothing
+    on success: nothing
+inline_doc
+
+  local filename # output filename
+  
+  echo -en  "\tGenerating the HTML book ..."
+  xsltproc --xinclude --nonet --stringparam base.dir HTML/ \
+           --stringparam chunk.quietly 1 \
+           ../$BLFS_XML/stylesheets/blfs-chunked.xsl \
+           $TARGET-index.xml > xsltproc.log 2>&1
+
+  mkdir HTML/{stylesheets,images}
+  cp ../$BLFS_XML/stylesheets/*.css HTML/stylesheets
+  cp ../$BLFS_XML/images/*.png HTML/images
+  cd HTML
+  sed -i -e "s at ../stylesheets at stylesheets@g" *.html
+  sed -i -e "s at ../images at images@g" *.html
+  for filename in `find . -name "*.html"` ; do
+    tidy -config ../../$BLFS_XML/tidy.conf $filename || true
+    sh ../../$BLFS_XML/obfuscate.sh $filename
+    sed -i -e "s at text/html at application/xhtml+xml at g" $filename
+  done
+  echo "done"
+}
+
+
+#-------------------------#
+create_build_scripts() {  # 
+#-------------------------#
+: <<inline_doc
+    function:   
+    input vars: nothing
+    externals:  none
+    modifies:   nothing    
+    returns:    nothing
+    output:     none
+    on error:   nothing
+    on success: nothing
+inline_doc
+
+  echo -en  "\tGenerating the build scripts ... not implemented yet, sorry\n"
+}


Property changes on: jhalfs/branches/experimental/BLFS/func_parser
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev Id




More information about the alfs-log mailing list