r2596 - in jhalfs/trunk: . CLFS HLFS LFS common extras

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Sat Apr 29 07:44:30 PDT 2006


Author: manuel
Date: 2006-04-29 08:44:29 -0600 (Sat, 29 Apr 2006)
New Revision: 2596

Added:
   jhalfs/trunk/common/func_compare.sh
   jhalfs/trunk/extras/
Removed:
   jhalfs/trunk/common/func_ICA.sh
Modified:
   jhalfs/trunk/CLFS/master.sh
   jhalfs/trunk/HLFS/master.sh
   jhalfs/trunk/LFS/master.sh
   jhalfs/trunk/common/common-functions
   jhalfs/trunk/common/config
   jhalfs/trunk/common/func_validate_configs.sh
   jhalfs/trunk/extras/do_copy_files
   jhalfs/trunk/extras/do_ica_prep
   jhalfs/trunk/extras/do_ica_work
   jhalfs/trunk/extras/farce
   jhalfs/trunk/extras/filelist
   jhalfs/trunk/master.sh
Log:
Merged ICA/farce support from experimental branch.

Modified: jhalfs/trunk/CLFS/master.sh
===================================================================
--- jhalfs/trunk/CLFS/master.sh	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/CLFS/master.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -461,22 +461,42 @@
 #-----------------------------#
 final_system_Makefiles() {    #
 #-----------------------------#
-  echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
+  # Set envars and scripts for iteration targets
+  LOGS="" # Start with an empty global LOGS envar
+  if [[ -z "$1" ]] ; then
+    local N=""
+  else
+    local N=-build_$1
+    local basicsystem=""
+    mkdir final-system$N
+    cp final-system/* final-system$N
+    for script in final-system$N/* ; do
+      # Overwrite existing symlinks, files, and dirs
+      sed -e 's/ln -sv/&f/g' \
+          -e 's/mv -v/&f/g' \
+          -e 's/mkdir -v/&p/g' -i ${script}
+    done
+    # Remove Bzip2 binaries before make install
+    sed -e 's at make install at rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
+    # Fix how Module-Init-Tools do the install target
+    sed -e 's at make install at make INSTALL=install install@' -i final-system$N/*-module-init-tools
+    # Delete *old Readline libraries just after make install
+    sed -e 's at make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
+  fi
 
-  for file in final-system/* ; do
+  echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N${R_arrow}"
+
+  for file in final-system$N/* ; do
     # Keep the script file name
     this_script=`basename $file`
 
-    # Test if the stripping phase must be skipped
+    # Test if the stripping phase must be skipped.
+    # Skip alsp temp-perl for iterative runs
     case $this_script in
-      *stripping*) [[ "$STRIP" = "0" ]] && continue
-       ;;
+      *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
+      *temp-perl*) [[ -n "$N" ]] && continue ;;
     esac
 
-    # First append each name of the script files to a list (this will become
-    # the names of the targets in the Makefile
-    basicsystem="$basicsystem $this_script"
-
     # Grab the name of the target, strip id number, XXX-script
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
                                   -e 's at temp-@@' \
@@ -485,22 +505,38 @@
                                   -e 's at 64@@' \
                                   -e 's at n32@@'`
 
+    # Find the version of the command files, if it corresponds with the building of
+    # a specific package. We need this here to can skip scripts not needed for
+    # iterations rebuilds
     vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
 
+    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+      case "${this_script}" in
+        *stripping*) ;;
+        *)  continue ;;
+      esac
+    fi
+
+    # Append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    basicsystem="$basicsystem ${this_script}${N}"
+
+    # Append each name of the script files to a list (this will become
+    # the names of the logs to be moved for each iteration)
+    LOGS="$LOGS ${this_script}"
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
     #
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}" "$PREV"
+    wrt_target "${this_script}${N}" "$PREV"
 
     # If $vrs isn't empty, we've got a package...
     if [ "$vrs" != "" ] ; then
-      case $name in
-        temp-perl) wrt_unpack2 "perl-$vrs.tar.*"    ;;
-        *)         wrt_unpack2 "$name-$vrs.tar.*"   ;;
-      esac
+      FILE="$name-$vrs.tar.*"
+      wrt_unpack2 "$FILE"
     fi
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
@@ -515,8 +551,9 @@
     #--------------------------------------------------------------------#
     #
     # Keep the script file name for Makefile dependencies.
-    PREV=$this_script
-
+    PREV=${this_script}${N}
+    # Set system_build envar for iteration targets
+    system_build=$basicsystem
   done  # for file in final-system/* ...
 }
 
@@ -524,25 +561,44 @@
 #-----------------------------#
 bm_final_system_Makefiles() { #
 #-----------------------------#
-  echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
+  # Set envars and scripts for iteration targets
+  LOGS="" # Start with an empty global LOGS envar
+  if [[ -z "$1" ]] ; then
+    local N=""
+    # The makesys phase was initiated in bm_testsuite_tools_makefile
+    [[ "$TEST" = 0 ]] && PREV=""
+  else
+    local N=-build_$1
+    local basicsystem=""
+    mkdir final-system$N
+    cp final-system/* final-system$N
+    for script in final-system$N/* ; do
+      # Overwrite existing symlinks, files, and dirs
+      sed -e 's/ln -sv/&f/g' \
+          -e 's/mv -v/&f/g' \
+          -e 's/mkdir -v/&p/g' -i ${script}
+    done
+    # Remove Bzip2 binaries before make install
+    sed -e 's at make install at rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
+    # Fix how Module-Init-Tools do the install target
+    sed -e 's at make install at make INSTALL=install install@' -i final-system$N/*-module-init-tools
+    # Delete *old Readline libraries just after make install
+    sed -e 's at make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
+  fi
 
-  # The makesys phase was initiated in bm_testsuite_tools_makefile
-  [[ "$TEST" = 0 ]] && PREV=""
+  echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
 
-  for file in final-system/* ; do
+  for file in final-system$N/* ; do
     # Keep the script file name
     this_script=`basename $file`
 
     # Test if the stripping phase must be skipped
+    # Skip alsp temp-perl for iterative runs
     case $this_script in
-      *stripping*) [[ "$STRIP" = "0" ]] && continue
-       ;;
+      *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
+      *temp-perl*) [[ -n "$N" ]] && continue ;;
     esac
 
-    # First append each name of the script files to a list (this will become
-    # the names of the targets in the Makefile
-    basicsystem="$basicsystem $this_script"
-
     # Grab the name of the target, strip id number, XXX-script
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
                                   -e 's at temp-@@' \
@@ -551,22 +607,38 @@
                                   -e 's at 64@@' \
                                   -e 's at n32@@'`
 
+    # Find the version of the command files, if it corresponds with the building of
+    # a specific package. We need this here to can skip scripts not needed for
+    # iterations rebuilds
     vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
 
+    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+      case "${this_script}" in
+        *stripping*) ;;
+        *)  continue ;;
+      esac
+    fi
+
+    # Append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    basicsystem="$basicsystem ${this_script}${N}"
+
+    # Append each name of the script files to a list (this will become
+    # the names of the logs to be moved for each iteration)
+    LOGS="$LOGS ${this_script}"
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
     #
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}" "$PREV"
+    wrt_target "${this_script}${N}" "$PREV"
 
     # If $vrs isn't empty, we've got a package...
     if [ "$vrs" != "" ] ; then
-      case $name in
-        temp-perl) wrt_unpack3 "perl-$vrs.tar.*"    ;;
-        *)         wrt_unpack3 "$name-$vrs.tar.*"   ;;
-      esac
+      FILE="$name-$vrs.tar.*"
+      wrt_unpack3 "$FILE"
     fi
     #
     wrt_run_as_root2 "${this_script}" "${file}"
@@ -581,8 +653,9 @@
     #--------------------------------------------------------------------#
     #
     # Keep the script file name for Makefile dependencies.
-    PREV=$this_script
-
+    PREV=${this_script}${N}
+    # Set system_build envar for iteration targets
+    system_build=$basicsystem
   done  # for file in final-system/* ...
 }
 
@@ -885,6 +958,8 @@
       testsuite_tools_Makefiles    # $testsuitetools
     fi
     final_system_Makefiles         # $basicsystem
+    # Add the iterations targets, if needed
+    [[ "$COMPARE" != "0" ]] && wrt_compare_targets
     bootscripts_Makefiles          # $bootscripttools
     bootable_Makefiles             # $bootabletools
   else
@@ -893,6 +968,8 @@
       bm_testsuite_tools_Makefiles # $testsuitetools
     fi
     bm_final_system_Makefiles      # $basicsystem
+    # Add the iterations targets, if needed
+    [[ "$COMPARE" != "0" ]] && wrt_compare_targets
     bm_bootscripts_Makefiles       # $bootscipttools
     bm_bootable_Makefiles          # $bootabletoosl
   fi

Modified: jhalfs/trunk/HLFS/master.sh
===================================================================
--- jhalfs/trunk/HLFS/master.sh	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/HLFS/master.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -295,8 +295,31 @@
   local TARGET LOADER
   local file
   local this_script
+  # Set envars and scripts for iteration targets
+  LOGS="" # Start with an empty global LOGS envar
+  if [[ -z "$1" ]] ; then
+    local N=""
+  else
+    local N=-build_$1
+    local chapter6=""
+    mkdir chapter06$N
+    cp chapter06/* chapter06$N
+    for script in chapter06$N/* ; do
+      # Overwrite existing symlinks, files, and dirs
+      sed -e 's/ln -s /ln -sf /g' \
+          -e 's/^mv /&-f/g' -i ${script}
+    done
+    # Remove Bzip2 binaries before make install
+    sed -e 's at make install at rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
+    # Fix how Module-Init-Tools do the install target
+    sed -e 's at make install at make INSTALL=install install@' -i chapter06$N/*-module-init-tools
+    # Delete *old Readline libraries just after make install
+    sed -e 's at make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
+    # Don't readd already existing groups
+    sed -e '/groupadd/d' -i chapter06$N/*-udev
+  fi
 
-  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
+  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
   #
   # Set these definitions early and only once
   #
@@ -306,7 +329,7 @@
     TARGET="pc-linux-gnu";    LOADER="ld-linux.so.2"
   fi
 
-  for file in chapter06/* ; do
+  for file in chapter06$N/* ; do
     # Keep the script file name
     this_script=`basename $file`
 
@@ -317,26 +340,40 @@
       *chroot* )  continue ;;
         # Test if the stripping phase must be skipped
       *-stripping* )  [[ "$STRIP" = "0" ]] && continue ;;
-      *) ;;
     esac
 
-    # First append each name of the script files to a list (this will become
-    # the names of the targets in the Makefile
-    chapter6="$chapter6 $this_script"
-
     # Grab the name of the target
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
 
+    # Find the version of the command files, if it corresponds with the building of
+    # a specific package
+    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+      case "${this_script}" in
+        *stripping*) ;;
+        *)  continue ;;
+      esac
+    fi
+
+    # Append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile
+    chapter6="$chapter6 ${this_script}${N}"
+
+    # Append each name of the script files to a list (this will become
+    # the names of the logs to be moved for each iteration)
+    LOGS="$LOGS ${this_script}"
+
     #
     # Sed replacement to fix some rm command that could fail.
     # That should be fixed in the book sources.
     #
     case $name in
       glibc)
-          sed 's/rm /rm -f /' -i chapter06/$this_script
+          sed 's/rm /rm -f /' -i chapter06$N/$this_script
         ;;
       gcc)
-          sed 's/rm /rm -f /' -i chapter06/$this_script
+          sed 's/rm /rm -f /' -i chapter06$N/$this_script
         ;;
     esac
 
@@ -346,12 +383,8 @@
     #
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "$this_script" "$PREV"
+    wrt_target "${this_script}${N}" "$PREV"
 
-    # Find the version of the command files, if it corresponds with the building of
-    # a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
     # If $vrs isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     if [ "$vrs" != "" ] ; then
@@ -408,7 +441,9 @@
     #--------------------------------------------------------------------#
 
     # Keep the script file name for Makefile dependencies.
-    PREV=$this_script
+    PREV=${this_script}${N}
+    # Set system_build envar for iteration targets
+    system_build=$chapter6
   done # end for file in chapter06/*
 
 }
@@ -518,6 +553,8 @@
   chapter3_Makefiles
   chapter5_Makefiles
   chapter6_Makefiles
+  # Add the iterations targets, if needed
+  [[ "$COMPARE" != "0" ]] && wrt_compare_targets
   chapter7_Makefiles
 
   # Add a header, some variables and include the function file

Modified: jhalfs/trunk/LFS/master.sh
===================================================================
--- jhalfs/trunk/LFS/master.sh	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/LFS/master.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -144,9 +144,35 @@
 #----------------------------#
 chapter6_Makefiles() {
 #----------------------------#
-  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6${R_arrow}"
+  # Set envars and scripts for iteration targets
+  LOGS="" # Start with an empty global LOGS envar
+  if [[ -z "$1" ]] ; then
+    local N=""
+  else
+    local N=-build_$1
+    local chapter6=""
+    mkdir chapter06$N
+    cp chapter06/* chapter06$N
+    for script in chapter06$N/* ; do
+      # Overwrite existing symlinks, files, and dirs
+      sed -e 's/ln -sv/&f/g' \
+          -e 's/mv -v/&f/g' \
+          -e 's/mkdir -v/&p/g' -i ${script}
+    done
+    # Remove Bzip2 binaries before make install
+    sed -e 's at make install at rm -vf /usr/bin/bz*\n&@' -i chapter06$N/*-bzip2
+    # Fix how Module-Init-Tools do the install target
+    sed -e 's at make install at make INSTALL=install install@' -i chapter06$N/*-module-init-tools
+    # Delete *old Readline libraries just after make install
+    sed -e 's at make install@&\nrm -v /lib/lib{history,readline}*old@' -i chapter06$N/*-readline
+    # Let some Udev pre-installation commands to fail
+    sed -e 's@/lib/udev/devices/fd@& || true@' \
+        -e 's/mknod -m.*/& || true/' -i chapter06$N/*-udev
+  fi
 
-  for file in chapter06/* ; do
+  echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N${R_arrow}"
+
+  for file in chapter06$N/* ; do
     # Keep the script file name
     this_script=`basename $file`
 
@@ -157,25 +183,37 @@
       *stripping*) [[ "${STRIP}" = "0" ]] && continue ;;
     esac
 
-    # First append each name of the script files to a list (this will become
-    # the names of the targets in the Makefile
-    chapter6="$chapter6 ${this_script}"
-
     # Grab the name of the target
     name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@'`
 
+    # Find the version of the command files, if it corresponds with the building of
+    # a specific package. We need this here to can skip scripts not needed for
+    # iterations rebuilds
+    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+
+    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+      case "${this_script}" in
+        *stripping*) ;;
+        *)  continue ;;
+      esac
+    fi
+
+    # Append each name of the script files to a list (this will become
+    # the names of the targets in the Makefile)
+    chapter6="$chapter6 ${this_script}${N}"
+
+    # Append each name of the script files to a list (this will become
+    # the names of the logs to be moved for each iteration)
+    LOGS="$LOGS ${this_script}"
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
     #
     # Drop in the name of the target on a new line, and the previous target
     # as a dependency. Also call the echo_message function.
-    wrt_target "${this_script}" "$PREV"
+    wrt_target "${this_script}${N}" "$PREV"
 
-    # Find the version of the command files, if it corresponds with the building of
-    # a specific package
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-
     # If $vrs isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     if [ "$vrs" != "" ] ; then
@@ -204,7 +242,9 @@
     #--------------------------------------------------------------------#
 
     # Keep the script file name for Makefile dependencies.
-    PREV=${this_script}
+    PREV=${this_script}${N}
+    # Set system_build envar for iteration targets
+    system_build=$chapter6
   done # end for file in chapter06/*
 }
 
@@ -304,6 +344,8 @@
   chapter4_Makefiles
   chapter5_Makefiles
   chapter6_Makefiles
+  # Add the iterations targets, if needed
+  [[ "$COMPARE" != "0" ]] && wrt_compare_targets
   chapter789_Makefiles
 
 

Modified: jhalfs/trunk/common/common-functions
===================================================================
--- jhalfs/trunk/common/common-functions	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/common/common-functions	2006-04-29 14:44:29 UTC (rev 2596)
@@ -76,6 +76,15 @@
 [[ ${PROGNAME} != "blfs" ]] &&
 cat <<- -EOF-
 
+${BOLD}  -C, --comparasion TYPE${OFF}
+         do iterative comparison analysis. That will take several time due that
+         the final system packages wil be rebuilded the times defined in the
+         ITERATIONS config option.
+         Analisys types allowed are:
+           ICA   = do the ICA analisys designed by Greg Schafer
+           farce = do the farce analisys designed by Ken Moffat
+           both  = perfom both ICA and farce analisys
+
 ${BOLD}  -F, --fstab FILE${OFF}
         use FILE as the /etc/fstab file for the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} system. If not specified,
         a default /etc/fstab file with dummy values is created.

Modified: jhalfs/trunk/common/config
===================================================================
--- jhalfs/trunk/common/config	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/common/config	2006-04-29 14:44:29 UTC (rev 2596)
@@ -62,19 +62,28 @@
 #    Not used in LFS
 KEYMAP=none
 
-#=== Variables needed by ICA (Not implemented yet :-/)===
-#--- Run ICA testing 0/1  0(no)/1(yes)
+#=== Variables needed by iterative comparison analysis ===
+#--- Should some iterative comparison analysis by made? 0(no)/1(yes)
+COMPARE=0
+
+#--- The number of final stage builds to create and compare, min. 2, max. 5
+ITERATIONS=3
+
+#--- Run ICA testing 0(no)/1(yes)
 RUN_ICA=0
 
-#--- The number of final stage builds to create and compare
-ITERATIONS=
+#--- Run farce testing 0(no)/1(yes)
+RUN_FARCE=0
 
-#--- ICA report log directory
-ICALOGDIR=$JHALFSDIR/logs/ICA
-
 #==== INTERNAL VARIABLES ====
 # Don't edit it unless you know what you are doing
 
 #--- Working directories
 JHALFSDIR=$BUILDDIR/jhalfs
    LOGDIR=$JHALFSDIR/logs
+
+#--- ICA report log directory
+ICALOGDIR=$LOGDIR/ICA
+
+#--- farce report log directory
+FARCELOGDIR=$LOGDIR/farce

Deleted: jhalfs/trunk/common/func_ICA.sh
===================================================================
--- jhalfs/trunk/common/func_ICA.sh	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/common/func_ICA.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -1,179 +0,0 @@
-# $Id$
-
-# Acknowledgment:
-#  The following code is a modified version of an original work written by
-#  Greg Schafer for the "DIY Linux" project and is included here with his 
-#  permission. 
-#  ref: http://www.diy-linux.org
-#
-#
-# ---------------------------------------------------------------------------- #
-# Here are the ICA functions.
-# ---------------------------------------------------------------------------- #
-#
-# Here we prepare for the Iterative Comparison Analysis (ICA). Essentially, we
-# copy most of our chroot phase files to a new location then perform some
-# manipulations on the copied files to make diff comparisons easier. The steps
-# involved are:-
-#   (1) copy the whole tree (minus the PRUNEPATH defined below) to the CMP_DIR
-#       location. Use tar as it seems like the most appropriate tool for copying
-#       large directory trees around.
-#   (2) delete all symlinks.
-#   (3) gunzip all `*.gz' files.
-#   (4) delete all hardlinked files (of course trying to leaving the "master"
-#       intact)
-#   (5) convert all `*.a' files (ar archives) into a directory of the same name
-#       containing the unpacked object files.
-#   (6) fully strip the whole lot (but being careful to strip only the debug
-#       symbols from object `*.o' files).
-
-#----------------------------------#
-do_ica_prep() {                    #
-#----------------------------------#
-: <<inline_doc
-    desc:
-    
-    usage:	
-
-    input vars: 
-    externals:  --
-    modifies:   --
-    returns:    --
-    on error:	
-    on success: 
-inline_doc
-
-  local CMP_DIR F L BN
-  local ALL_FILES=/tmp/allfiles.$$
-  local UNIQUE_FILES=/tmp/uniquefiles.$$
-  local PRUNEPATH="$TT_PFX $PATCHES_DIR $SCRATCH_DIR $TARBALLS_DIR \
-                  /dev /home /mnt /proc /root /sys /tmp /usr/src /lost+found"
-
-  if [ ! -f "${STAMP_DIR}/icaprep" ]; then
-    CMP_DIR="${SCRATCH_DIR}/cmp/iter${ITER}"
-    test -d "$CMP_DIR" || mkdir -p $CMP_DIR
-
-    echo -e "\n${BORDER}\n${CYAN}[ICA] - starting ICA preparation for\c"
-    echo -e " Iteration ${ITER}.${OFF}\n"
-
-    # Create a file that we can pass to tar as an "exclude list".
-    # There might be an easier way to achieve tar exclusions? Strip
-    # the leading /.
-    for F in $PRUNEPATH; do
-      echo ${F#*/} >> $TMP_FILE
-    done
-
-    echo -n "Copying files to ${CMP_DIR}... "
-    cd /
-    tar -X $TMP_FILE -cf - . | tar -C $CMP_DIR -xf - || {
-	echo -e "\n\n${RED}ERROR:${OFF} tar copy failed!\n" >&2
-	exit 1
-	}
-    echo "done."
-    rm -f $TMP_FILE
-
-    echo -n "Removing symbolic links in ${CMP_DIR}... "
-    find $CMP_DIR -type l | xargs rm -f
-    echo "done."
-
-    echo -n "Gunzipping \".gz\" files in ${CMP_DIR}... "
-    find $CMP_DIR -name '*.gz' | xargs gunzip
-    echo "done."
-
-    # This was a bit tricky. You'll probably have to do it by hand
-    # to see what's actually going on. The "sort/uniq" part is
-    # inspired from the example DirCmp script from the book "Shell
-    # Programming Examples" by Bruce Blinn, published by Prentice
-    # Hall. We are essentially using the `-ls' option of the find
-    # utility to allow manipulations based on inode numbers.
-    #
-    # FIXME - this is a bit unreliable - rem out for now
-    #echo -n "Removing hardlinked file copies in ${CMP_DIR}... "
-    #find $CMP_DIR -ls | sort -n > $ALL_FILES
-    #find $CMP_DIR -ls | sort -n -u > $UNIQUE_FILES
-    #cat $UNIQUE_FILES $ALL_FILES | sort | uniq -u | awk '{ print $11 }' | xargs rm -f
-    #rm -f $ALL_FILES $UNIQUE_FILES
-    #echo "done."
-
-    # ar archives contain date & time stamp info that causes us
-    # grief when trying to find differences. Here we perform some
-    # hackery to allow easy diffing. Essentially, replace each
-    # archive with a dir of the same name and extract the object
-    # files from the archive into this dir. Despite their names,
-    # libieee.a & libmcheck.a are not actual ar archives.
-    #
-    echo -n "Extracting object files from \".a\" files in ${CMP_DIR}... "
-    L=$(find $CMP_DIR -name '*.a' ! -name 'libieee.a' ! -name 'libmcheck.a')
-
-    for F in $L; do
-      mv $F ${F}.XX
-      mkdir $F
-      cd $F
-      BN=${F##*/}
-      ar x ../${BN}.XX || {
-        echo -e "\n\n${RED}ERROR:${OFF} ar archive extraction failed!\n" >&2
-        exit 1
-	}
-      rm -f ../${BN}.XX
-    done
-    echo "done."
-
-    echo -n "Stripping (debug) symbols from \".o\" files in ${CMP_DIR}... "
-    find $CMP_DIR -name '*.o' | xargs strip -p -g 2>/dev/null
-    echo "done."
-
-    echo -n "Stripping (all) symbols from files OTHER THAN \".o\" files in ${CMP_DIR}... "
-    find $CMP_DIR ! -name '*.o' | xargs strip -p 2>/dev/null || :
-    echo "done."
-
-    echo -e "\n${CYAN}[ICA] - ICA preparation for Iteration ${ITER}\c"
-    echo -e " complete.${OFF}\n${BORDER}"
-    do_stamp icaprep
-  fi
-}
-
-
-#----------------------------------#
-do_ica_work() {                    #  Do the ICA grunt work.
-#----------------------------------#
-: <<inline_doc
-    desc:
-    
-    usage:	do_ica_work 1 2
-    		do_ica_work 2 3
-
-    input vars: $1 iteration number to use
-                $2 iteration number to use
-    externals:  --
-    modifies:   --
-    returns:    --
-    on error:	
-    on success: 
-inline_doc
-
-  local ICA_DIR="${SCRATCH_DIR}/cmp"
-  local RAWDIFF=/tmp/rawdiff.$$
-  local REPORT="${SCRATCH_DIR}/logs/REPORT.${1}V${2}"
-
-  cd $ICA_DIR
-
-  echo -n "Diffing iter${1} and iter${2}... "
-  diff -ur iter${1} iter${2} > $RAWDIFF || :
-  echo "done."
-
-  echo -e "The list of binary files that differ:\n" > $REPORT
-  grep "iles.*differ$" $RAWDIFF >> $REPORT
-  echo -e "\n" >> $REPORT
-
-  echo -e "The list of files that exist \"only in\" 1 of the directories:\n" >> $REPORT
-
-  if grep "^Only in" $RAWDIFF >/dev/null 2>&1; then
-     grep "^Only in" $RAWDIFF >> $REPORT
-  else
-    echo NONE >> $REPORT
-  fi
-
-  grep -v "iles.*differ$" $RAWDIFF | grep -v "^Only in" > ${SCRATCH_DIR}/logs/${1}V${2}.ASCII.DIFF
-  rm -f $RAWDIFF
-
-}

Copied: jhalfs/trunk/common/func_compare.sh (from rev 2595, jhalfs/branches/experimental/common/func_compare.sh)
===================================================================
--- jhalfs/trunk/common/func_compare.sh	                        (rev 0)
+++ jhalfs/trunk/common/func_compare.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -0,0 +1,117 @@
+# $Id$
+
+#----------------------------------#
+wrt_compare_targets() {            #
+#----------------------------------#
+
+  for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
+                                          # and "ITERATIONS" with no "$".
+    ITERATION=iteration-$N
+    if [ "$N" != "1" ] ; then
+      wrt_system_build "$N" "$PREV_IT"
+    fi
+    this_script=$ITERATION
+    wrt_target "$ITERATION" "$PREV"
+    wrt_compare_work "$ITERATION" "$PREV_IT"
+    wrt_logs "$N"
+    PREV_IT=$ITERATION
+    PREV=$ITERATION
+  done
+}
+
+#----------------------------------#
+wrt_system_build() {               #
+#----------------------------------#
+  local     RUN=$1
+  local PREV_IT=$2
+
+  if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then
+    final_system_Makefiles $RUN
+  elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
+    bm_final_system_Makefiles $RUN
+  else
+    chapter6_Makefiles $RUN
+  fi
+
+  echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
+  PREV=system_build_$RUN
+
+}
+
+#----------------------------------#
+wrt_compare_work() {               #
+#----------------------------------#
+  local ITERATION=$1
+  local   PREV_IT=$2
+  local PRUNEPATH="/dev /home /jhalfs /lost+found /media /mnt /opt /proc \
+/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
+
+  if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
+    local    ROOT_DIR=/
+    local DEST_TOPDIR=/jhalfs
+    local   ICALOGDIR=/jhalfs/logs/ICA
+    local FARCELOGDIR=/jhalfs/logs/farce
+  else
+    local    ROOT_DIR=$BUILDDIR
+    local DEST_TOPDIR=$BUILDDIR/jhalfs
+  fi
+
+  if [[ "$RUN_ICA" = "1" ]] ; then
+    local DEST_ICA=$DEST_TOPDIR/ICA && \
+(
+    cat << EOF
+	@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
+	extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1
+EOF
+) >> $MKFILE.tmp
+    if [[ "$ITERATION" != "iteration-1" ]] ; then
+      wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
+    fi
+  fi
+
+  if [[ "$RUN_FARCE" = "1" ]] ; then
+    local DEST_FARCE=$DEST_TOPDIR/farce && \
+(
+    cat << EOF
+	@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
+	extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/$ITERATION.log 2>&1
+EOF
+) >> $MKFILE.tmp
+    if [[ "$ITERATION" != "iteration-1" ]] ; then
+      wrt_do_farce_work "$PREV_IT" "$ITERATION" "$DEST_FARCE"
+    fi
+  fi
+}
+
+#----------------------------------#
+wrt_do_ica_work() {                #
+#----------------------------------#
+  echo -e "\t at extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_do_farce_work() {              #
+#----------------------------------#
+  local OUTPUT=$FARCELOGDIR/${1}_V_${2}
+  local PREDIR=$3/$1
+  local PREFILE=$3/filelist-$1
+  local ITEDIR=$3/$2
+  local ITEFILE=$3/filelist-$2
+  echo -e "\t at extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_logs() {             #
+#----------------------------------#
+  local ITERATION=iteration-$1
+
+(
+    cat << EOF
+	@pushd logs 1> /dev/null && \\
+	mkdir $ITERATION && \\
+	mv ${LOGS} $ITERATION && \\
+	popd 1> /dev/null
+	@touch \$@
+EOF
+) >> $MKFILE.tmp
+}


Property changes on: jhalfs/trunk/common/func_compare.sh
___________________________________________________________________
Name: svn:keywords
   + Author Date Rev Id

Modified: jhalfs/trunk/common/func_validate_configs.sh
===================================================================
--- jhalfs/trunk/common/func_validate_configs.sh	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/common/func_validate_configs.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -1,7 +1,8 @@
 # $Id$
 
-validate_target() {
-
+#----------------------------#
+validate_target() {          #
+#----------------------------#
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}TARGET${R_arrow}\" value ${L_arrow}${BOLD}${TARGET}${R_arrow} is invalid for the ${L_arrow}${BOLD}${ARCH}${R_arrow} architecture'
   local -r ERROR_MSG_pt2='  check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
 
@@ -67,7 +68,7 @@
 
 
 #----------------------------#
-validate_config()    {       # Are the config values sane (within reason)
+validate_config() {          # Are the config values sane (within reason)
 #----------------------------#
 : <<inline_doc
       Validates the configuration parameters. The global var PROGNAME selects the
@@ -78,24 +79,24 @@
                 PROGNAME (lfs,clfs,hlfs,blfs)
     modifies:   none
     returns:    nothing
-    on error:	write text to console and dies
+    on error:   write text to console and dies
     on success: write text to console and returns
 inline_doc
 
   # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
   local -r blfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG         DEPEND                TEST"
-  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
-  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
-  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE                       TEST REPORT STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
+  local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE MODEL GRSECURITY_HOST TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG KEYMAP         PAGE TIMEZONE LANG LC_ALL"
+  local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE METHOD  ARCH  TARGET  TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG KEYMAP VIMLANG PAGE TIMEZONE LANG"
+  local -r  lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE HPKG RUNMAKE                       TEST REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB             CONFIG        VIMLANG PAGE TIMEZONE LANG"
 
   local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,'
   local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \<common/config\>${OFF}'
   local -r PARAM_VALS='${config_param}: ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
 
   local    PARAM_LIST=
-
   local config_param
   local validation_str
+  local save_param
 
   write_error_and_die() {
     echo -e "\n${DD_BORDER}"
@@ -105,150 +106,155 @@
     exit 1
   }
 
-  validate_str() {
+  validate_against_str() {
      # This is the 'regexp' test available in bash-3.0..
      # using it as a poor man's test for substring
      echo -e "`eval echo $PARAM_VALS`"
-     if [[ ! "${validation_str}" =~ "x${!config_param}x" ]] ; then
+     if [[ ! "$1" =~ "x${!config_param}x" ]] ; then
        # parameter value entered is no good
        write_error_and_die
      fi
   }
 
-  set +e
-  for PARAM_GROUP in ${PROGNAME}_PARAM_LIST; do
-    for config_param in ${!PARAM_GROUP}; do
-      # This is a tricky little piece of code.. executes a cmd string.
-      case $config_param in
-        BUILDDIR) # We cannot have an <empty> or </> root mount point
-            echo -e "`eval echo $PARAM_VALS`"
-            if [[ "xx x/x" =~ "x${!config_param}x" ]]; then
-              write_error_and_die
-            fi
-            continue  ;;
-        TIMEZONE)  continue;;
-        MKFILE)    continue;;
-        HPKG)      validation_str="x0x x1x";          validate_str; continue ;;
-        RUNMAKE)   validation_str="x0x x1x";          validate_str; continue ;;
-        TEST)      validation_str="x0x x1x x2x x3x";  validate_str; continue ;;
-        REPORT)    validation_str="x0x x1x";          validate_str;
-            if [[ "${!config_param}" = "1" ]]; then
-              if [[ `type -p bc` ]]; then
-                continue
-              else
-                echo -e "  ${BOLD}The bc binary was not found${OFF}"
-                echo -e "  The SBU and disk usage report creation will be skiped"
-                REPORT=0
-                continue
-              fi
-            fi ;;
-        STRIP)     validation_str="x0x x1x";          validate_str; continue ;;
-        VIMLANG)   validation_str="x0x x1x";          validate_str; continue ;;
-        DEPEND)    validation_str="x0x x1x x2x";      validate_str; continue ;;
-        MODEL)     validation_str="xglibcx xuclibcx"; validate_str; continue ;;
-        PAGE)      validation_str="xletterx xA4x";    validate_str; continue ;;
-        GRSECURITY_HOST)  validation_str="x0x x1x";   validate_str; continue ;;
-        METHOD)    validation_str="xchrootx xbootx";  validate_str; continue ;;
-        ARCH)      validation_str="xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax";  validate_str; continue ;;
-        TARGET)    validate_target; continue ;;
-      esac
+  validate_file() {
+     # For parameters ending with a '+' failure causes a warning message only
+     echo -n "`eval echo $PARAM_VALS`"
+     while test $# -gt 0 ; do
+       case $1 in
+        # Failures caused program exit
+        "-z")  [[   -z "${!config_param}" ]] && echo "${tab_}<-- NO file name given"  && write_error_and_die ;;
+        "-e")  [[ ! -e "${!config_param}" ]] && echo "${tab_}<-- file does not exist" && write_error_and_die ;;
+        "-s")  [[ ! -s "${!config_param}" ]] && echo "${tab_}<-- file has zero bytes" && write_error_and_die ;;
+        "-r")  [[ ! -r "${!config_param}" ]] && echo "${tab_}<-- no read permission " && write_error_and_die ;;
+        "-w")  [[ ! -w "${!config_param}" ]] && echo "${tab_}<-- no write permission" && write_error_and_die ;;
+        "-x")  [[ ! -x "${!config_param}" ]] && echo "${tab_}<-- file cannot be executed" && write_error_and_die ;;
+        # Warning messages only
+        "-z+") [[   -z "${!config_param}" ]] && echo && return ;;
+       esac
+       shift 1
+     done
+     echo
+  }
 
+  validate_dir() {
+     # For parameters ending with a '+' failure causes a warning message only
+     echo -n "`eval echo $PARAM_VALS`"
+     while test $# -gt 0 ; do
+       case $1 in
+        "-z") [[   -z "${!config_param}" ]] && echo "${tab_}NO directory name given" && write_error_and_die ;;
+        "-d") [[ ! -d "${!config_param}" ]] && echo "${tab_}This is NOT a directory" && write_error_and_die ;;
+        "-w") if [[ ! -w "${!config_param}" ]]; then
+                echo "${nl_}${DD_BORDER}"
+                echo "${tab_}${RED}You do not have ${L_arrow}write${R_arrow}${RED} access to the directory${OFF}"
+                echo "${tab_}${BOLD}${!config_param}${OFF}"
+                echo "${DD_BORDER}${nl_}"
+                exit 1
+              fi  ;;
+        # Warnings only
+        "-w+") if [[ ! -w "${!config_param}" ]]; then
+                 echo "${nl_}${DD_BORDER}"
+                 echo "${tab_}WARNING-- You do not have ${L_arrow}write${R_arrow} access to the directory${OFF}"
+                 echo "${tab_}       -- ${BOLD}${!config_param}${OFF}"
+                 echo "${DD_BORDER}"
+               fi  ;;
+        "-z+") [[ -z "${!config_param}" ]] && echo "${tab_}<-- NO directory name given" && return
+       esac
+       shift 1
+     done
+     echo
+  }
 
-      if [[ "${config_param}" = "LC_ALL" ]]; then
-         echo "`eval echo $PARAM_VALS`"
-         [[ -z "${!config_param}" ]] && echo -e "\nVariable LC_ALL cannot be empty!" && write_error_and_die
-          # See it the locale values exist on this machine
-         if [[ "`locale -a | grep -c ${!config_param}`" > 0 ]]; then
-           continue
-         else  # If you make it this far then there is a problem
-           write_error_and_die
-         fi
-      fi
+  set +e
+  PARAM_GROUP=${PROGNAME}_PARAM_LIST
+  for config_param in ${!PARAM_GROUP}; do
+    # This is a tricky little piece of code.. executes a cmd string.
+    case $config_param in
+      BUILDDIR) # We cannot have an <empty> or </> root mount point
+                  echo -e "`eval echo $PARAM_VALS`"
+                  [[ "xx x/x" =~ "x${!config_param}x" ]] &&
+                       write_error_and_die
+                  ;;
+      TIMEZONE)   ;;
 
-      if [[ "${config_param}" = "LANG" ]]; then
-         echo "`eval echo $PARAM_VALS`"
-         [[ -z "${!config_param}" ]] && echo -e "\nVariable LANG cannot be empty!" && write_error_and_die
-          # See if the locale values exist on this machine
-         if [[ "`locale -a | grep -c ${!config_param}`" > 0 ]]; then
-           continue
-         else  # If you make it this far then there is a problem
-           write_error_and_die
-         fi
-      fi
+      # Validate general parameters..
+      HPKG)       validate_against_str "x0x x1x" ;;
+      RUNMAKE)    validate_against_str "x0x x1x" ;;
+      REPORT)     validate_against_str "x0x x1x"
+                  if [[ "${!config_param}" = "1" ]]; then
+                    if [[ `type -p bc` ]]; then
+                      continue
+                    else
+                      echo -e "  ${BOLD}The bc binary was not found${OFF}"
+                      echo -e "  The SBU and disk usage report creation will be skiped"
+                      REPORT=0
+                      continue
+                    fi
+                  fi ;;
+      COMPARE)    if [[ ! "$COMPARE" = "1" ]]; then
+                    validate_against_str "x0x x1x"
+                  else
+                    if [[ ! "${RUN_ICA}" = "1" ]] && [[ ! "${RUN_FARCE}" = "1" ]]; then
+                       echo  "${nl_}${DD_BORDER}"
+                       echo  "You have elected to analyse your build but have failed to select a tool." >&2
+                       echo  "Edit /common/config and set ${L_arrow}${BOLD}RUN_ICA${R_arrow} and/or ${L_arrow}${BOLD}RUN_FARCE${R_arrow} to the required values" >&2
+                       echo  "${DD_BORDER}${nl_}"
+                       exit 1
+                    fi
+                  fi ;;
+      RUN_ICA)    [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;;
+      RUN_FARCE)  [[ "$COMPARE" = "1" ]] && validate_against_str "x0x x1x" ;;
+      ITERATIONS) [[ "$COMPARE" = "1" ]] && validate_against_str "x2x x3x x4x x5x" ;;
+      TEST)       validate_against_str "x0x x1x x2x x3x" ;;
+      STRIP)      validate_against_str "x0x x1x" ;;
+      VIMLANG)    validate_against_str "x0x x1x" ;;
+      DEPEND)     validate_against_str "x0x x1x x2x" ;;
+      MODEL)      validate_against_str "xglibcx xuclibcx" ;;
+      PAGE)       validate_against_str "xletterx xA4x" ;;
+      METHOD)     validate_against_str "xchrootx xbootx" ;;
+      ARCH)       validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax" ;;
+      TARGET)     validate_target ;;
+      GRSECURITY_HOST)  validate_against_str "x0x x1x" ;;
 
+      # BOOK validation. Very ugly, need be fixed
+      BOOK)        if [[ "${WC}" = "1" ]] ; then
+                     validate_dir -z -d
+                   else
+                     validate_against_str "x${PROGNAME}-developmentx xlfs-udev_updatex"
+                   fi
+                   ;;
 
-      if [[ "${config_param}"  = "KEYMAP" ]]; then
-         echo "`eval echo $PARAM_VALS`"
-         [[ "${!config_param}" = "none" ]] && continue
-         if [[ -e "/usr/share/kbd/keymaps/${!config_param}" ]] &&
-            [[ -s "/usr/share/kbd/keymaps/${!config_param}" ]]; then
-            continue
-         else
-            write_error_and_die
-         fi
-      fi
+      # Validate directories, testable states:
+      #  fatal   -z -d -w,
+      #  warning -z+   -w+
+      SRC_ARCHIVE) validate_dir -z+ -d -w+ ;;
 
-      if [[ "${config_param}" = "SRC_ARCHIVE" ]]; then
-         echo -n "`eval echo $PARAM_VALS`"
-         if [ ! -z ${SRC_ARCHIVE} ]; then
-           if [ ! -d ${SRC_ARCHIVE} ]; then
-             echo "   -- is NOT a directory"
-	     write_error_and_die
-           fi
-           if [ ! -w ${SRC_ARCHIVE} ]; then
-             echo -n "${nl_} [${BOLD}${YELLOW}WARN$OFF] You do not have <write> access to this directory, ${nl_}${tab_}downloaded files can not be saved in this archive"
-           fi
-        fi
-        echo
-        continue
-      fi
+      # Validate files, testable states:
+      #  fatal   -z -e -s -w -x -r,
+      #  warning -z+
+      FSTAB)       validate_file -z+ -e -s ;;
+      CONFIG)      validate_file -z+ -e -s ;;
+      BOOT_CONFIG) [[ "${METHOD}" = "boot" ]] && validate_file -z -e -s ;;
 
-      if [[ "${config_param}" = "FSTAB" ]]; then
-         echo "`eval echo $PARAM_VALS`"
-         [[ -z "${!config_param}" ]] && continue
-         if [[ -e "${!config_param}" ]] &&
-            [[ -s "${!config_param}" ]]; then
-           continue
-         else
-           write_error_and_die
-         fi
-      fi
-
-      if [[ "${config_param}" = "BOOK" ]]; then
-         echo "`eval echo $PARAM_VALS`"
-         [[ ! "${WC}" = 1 ]] && continue
-         [[ -z "${!config_param}" ]] && continue
-         if [[ -e "${!config_param}" ]] &&
-            [[ -s "${!config_param}" ]]; then
-           continue
-         else
-           write_error_and_die
-         fi
-      fi
-
-      if [[ "${config_param}" = "CONFIG" ]]; then
-         echo "`eval echo $PARAM_VALS`"
-         [[ -z "${!config_param}" ]] && continue
-         if [[ -e "${!config_param}" ]] &&
-            [[ -s "${!config_param}" ]]; then
-           continue
-         else
-           write_error_and_die
-         fi
-      fi
-
-      if [[ "${config_param}" = "BOOT_CONFIG" ]]; then
-        if [[ "${METHOD}" = "boot" ]]; then
-            echo "`eval echo $PARAM_VALS`"
-           # There must be a config file when the build method is 'boot'
-           [[ -e "${!config_param}" ]] && [[ -s "${!config_param}" ]] && continue
-           # If you make it this far then there is a problem
-          write_error_and_die
-        fi
-      fi
-    done
+      # Treatment of 'special' parameters
+      LANG | \
+      LC_ALL)  # See it the locale values exist on this machine
+               echo -n "`eval echo $PARAM_VALS`"
+               [[ -z "${!config_param}" ]] &&
+                 echo " -- Variable $config_param cannot be empty!" &&
+                 write_error_and_die
+               [[ ! "`locale -a | grep -c ${!config_param}`" > 0 ]] &&
+                  write_error_and_die
+               echo
+               ;;
+      KEYMAP)  echo "`eval echo $PARAM_VALS`"
+               save_param=${KEYMAP}
+               [[ ! "${!config_param}" = "none" ]] &&
+                  KEYMAP="/usr/share/kbd/keymaps/${KEYMAP}" &&
+                  validate_file -z -e -s
+               KEYMAP=${save_param}
+               ;;
+    esac
   done
-
   set -e
   echo "$tab_***${BOLD}${GREEN} ${PARAM_GROUP%%_*T} config parameters look good${OFF} ***"
 }

Copied: jhalfs/trunk/extras (from rev 2595, jhalfs/branches/experimental/extras)

Modified: jhalfs/trunk/master.sh
===================================================================
--- jhalfs/trunk/master.sh	2006-04-29 14:26:56 UTC (rev 2595)
+++ jhalfs/trunk/master.sh	2006-04-29 14:44:29 UTC (rev 2596)
@@ -51,12 +51,16 @@
 [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
 [[ $VERBOSITY > 0 ]] && echo "OK"
 #
-
 [[ $VERBOSITY > 0 ]] && echo -n "Loading masterscript conf..."
 source $COMMON_DIR/config
 [[ $? > 0 ]] && echo "$COMMON_DIR/conf did not load.." && exit
 [[ $VERBOSITY > 0 ]] && echo "OK"
 #
+[[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
+source $COMMON_DIR/func_compare.sh
+[[ $? > 0 ]] && echo "$COMMON_DIR/func_compare.sh did not load.." && exit
+[[ $VERBOSITY > 0 ]] && echo "OK"
+#
 [[ $VERBOSITY > 0 ]] && echo -n "Loading config module <$MODULE_CONFIG>..."
 source $MODULE_CONFIG
 [[ $? > 0 ]] && echo "$MODULE_CONFIG did not load.." && exit 1
@@ -92,7 +96,7 @@
 
 
 ###################################
-###		MAIN		###
+###          MAIN               ###
 ###################################
 
 # Evaluate any command line switches
@@ -213,6 +217,29 @@
       ;;
 
     # Common options for LFS, CLFS and HLFS
+    --comparasion | -C )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      case $1 in
+        ICA)              RUN_ICA=1
+                        RUN_FARCE=0
+                          COMPARE=1
+        ;;
+        farce)            RUN_ICA=0
+                        RUN_FARCE=1
+                          COMPARE=1
+        ;;
+        both)             RUN_ICA=1
+                        RUN_FARCE=1
+                          COMPARE=1
+        ;;
+        *)
+          echo -e "\n$1 is an unknown analisys method."
+          exit 1
+          ;;
+      esac
+      ;;
+
     --fstab | -F )
       test $# = 1 && eval "$exit_missing_arg"
       shift
@@ -454,6 +481,10 @@
 
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
   cp $COMMON_DIR/makefile-functions $JHALFSDIR/
+  if [[ "$COMPARE" != "0" ]] ; then
+    mkdir -p $JHALFSDIR/extras
+    cp extras/* $JHALFSDIR/extras
+  fi
   if [[ -n "$FILES" ]]; then
     # pushd/popd necessary to deal with mulitiple files
     pushd $PACKAGE_DIR 1> /dev/null




More information about the alfs-log mailing list