r2798 - in jhalfs/trunk: . CLFS HLFS LFS common

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Tue Jun 20 14:14:46 PDT 2006


Author: georgeb
Date: 2006-06-20 15:14:44 -0600 (Tue, 20 Jun 2006)
New Revision: 2798

Added:
   jhalfs/trunk/common/packages.xsl
Modified:
   jhalfs/trunk/CLFS/master.sh
   jhalfs/trunk/HLFS/master.sh
   jhalfs/trunk/LFS/master.sh
   jhalfs/trunk/common/common-functions
   jhalfs/trunk/master.sh
Log:
Extensive code changes. A different method for finding the tarball name. 

Modified: jhalfs/trunk/CLFS/master.sh
===================================================================
--- jhalfs/trunk/CLFS/master.sh	2006-06-19 19:12:37 UTC (rev 2797)
+++ jhalfs/trunk/CLFS/master.sh	2006-06-20 21:14:44 UTC (rev 2798)
@@ -117,25 +117,10 @@
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
                                   -e 's at -static@@' \
                                   -e 's at -final@@' \
-                                  -e 's at -headers@@' \
-                                  -e 's at -64@@' \
+				  -e 's at -64@@' \
                                   -e 's at -n32@@'`
-    # Adjust 'name' and patch a few scripts on the fly..
-    case $name in
-      linux-libc) name=linux-libc-headers ;;
-      linux)      name=linux-headers ;;
-    esac
-    #
-    # Find the version of the command files, if it corresponds with the building of a specific package
+    pkg_tarball=$(get_package_tarball_name $name)
 
-    # oh-oh.. This small ugly is necessary to handle the LFS headers naming scheme
-    if [ "${name}" = "linux-headers" ]; then
-      linux_vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-      vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-      vrs=${linux_vrs}-${vrs##*-}
-    else
-      vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-    fi
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -144,13 +129,13 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
     #
     wrt_run_as_su "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -183,10 +168,8 @@
     # Grab the name of the target, strip id number, XXX-script
     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'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
-
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -195,15 +178,15 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and to set the PKGDIR variable.
     #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
-    [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     wrt_run_as_su "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -257,13 +240,8 @@
       *)              name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's at -build@@' ` ;;
     esac
       # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
-    case $name in
-      bootscripts-cross-lfs)
-        vrs=`grep "^clfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-         ;;
-      *) vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-         ;;
-    esac
+    pkg_tarball=$(get_package_tarball_name $name)
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -272,11 +250,11 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
-    [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
+    [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
     # Select a script execution method
     case $this_script in
@@ -292,7 +270,7 @@
     esac
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -329,8 +307,9 @@
 
     # Grab the name of the target, strip id number, XXX-script
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
 
+    pkg_tarball=$(get_package_tarball_name $name)
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -339,13 +318,13 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       case $this_script in
-        *util-linux)    wrt_unpack  "$name-$vrs.tar.*"  ;;
-        *)              wrt_unpack2 "$name-$vrs.tar.*"  ;;
+        *util-linux)    wrt_unpack  "$pkg_tarball"  ;;
+        *)              wrt_unpack2 "$pkg_tarball"  ;;
       esac
       [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
@@ -353,12 +332,12 @@
     # Select a script execution method
     case $this_script in
       *kernfs)        wrt_run_as_root    "${this_script}" "${file}"  ;;
-      *util-linux)    wrt_run_as_su     "${this_script}" "${file}"  ;;
+      *util-linux)    wrt_run_as_su      "${this_script}" "${file}"  ;;
       *)              wrt_run_as_chroot1 "${this_script}" "${file}"  ;;
     esac
     #
     # Housekeeping...remove the build directory(ies), except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -394,7 +373,7 @@
                                   -e 's at 64@@' \
                                   -e 's at n32@@'`
 
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
@@ -405,8 +384,8 @@
     wrt_target "${this_script}" "$PREV"
     #
     case $name in
-      tcl)    wrt_unpack2 "$name$vrs-src.tar.*" ;;
-      *)      wrt_unpack2 "$name-$vrs.tar.*"    ;;
+      tcl)    wrt_unpack2 `grep "^tcl" $JHALFSDIR/my_packages` ;;
+      *)      wrt_unpack2 "$pkg_tarball"    ;;
     esac
     [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
@@ -449,7 +428,7 @@
                                   -e 's at 64@@' \
                                   -e 's at n32@@'`
 
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
@@ -460,8 +439,8 @@
     wrt_target "${this_script}" "$PREV"
     #
     case $name in
-      tcl)    wrt_unpack3 "$name$vrs-src.tar.*" ;;
-      *)      wrt_unpack3 "$name-$vrs.tar.*"    ;;
+      tcl)    wrt_unpack3 `grep "^tcl" $JHALFSDIR/my_packages` ;;
+      *)      wrt_unpack3 "$pkg_tarball"    ;;
     esac
     [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     #
@@ -531,17 +510,9 @@
     # 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
+    pkg_tarball=$(get_package_tarball_name $name)
 
-    # oh-oh.. This small ugly is necessary to handle the LFS headers naming scheme
-    if [ "${name}" = "linux-headers" ]; then
-      linux_vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-      vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-      vrs=${linux_vrs}-${vrs##*-}
-    else
-      vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-    fi
-
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
         *)  continue ;;
@@ -564,10 +535,9 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      FILE="$name-$vrs.tar.*"
-      wrt_unpack2 "$FILE"
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_unpack2 "$pkg_tarball"
       # If the testsuites must be run, initialize the log file
       case $name in
         binutils | gcc | glibc )
@@ -583,7 +553,7 @@
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -650,9 +620,10 @@
     # 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
+    pkg_tarball=$(get_package_tarball_name $name)
+
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
         *)  continue ;;
@@ -675,9 +646,9 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      FILE="$name-$vrs.tar.*"
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
+      FILE="$pkg_tarball"
       wrt_unpack3 "$FILE"
       # If the testsuites must be run, initialize the log file
       case $name in
@@ -694,7 +665,7 @@
     #
     wrt_run_as_root2 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -741,14 +712,7 @@
       *udev-rules)   name=udev-cross-lfs ;;
     esac
 
-      # Identify the unique version naming scheme for the clfs bootscripts..(bad boys)
-    case $name in
-      bootscripts-cross-lfs)
-	 vrs=`grep "^clfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-	 ;;
-      *) vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-         ;;
-    esac
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
@@ -758,13 +722,13 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     #
-    [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -809,8 +773,9 @@
       *bootscripts*) name=bootscripts-cross-lfs
        ;;
     esac
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
 
+    pkg_tarball=$(get_package_tarball_name $name)
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -819,13 +784,13 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     #
-    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
     #
     wrt_run_as_root2 "${this_script}" "${file}"
     #
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -872,8 +837,9 @@
       *kernel*) name=linux
        ;;
     esac
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
 
+    pkg_tarball=$(get_package_tarball_name $name)
+
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -882,10 +848,10 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball"
     #
     # Select a script execution method
     case $this_script in
@@ -899,7 +865,7 @@
     esac
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -945,12 +911,11 @@
     #
     # Grab the name of the target, strip id number and misc words.
     case $this_script in
-      *kernel) name=linux
-         ;;
+      *kernel) name=linux  ;;
       *)       name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's at -build@@' ` ;;
     esac
 
-    vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
@@ -960,10 +925,10 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}" "$PREV"
     #
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+    [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball"
     #
     # Select a script execution method
     case $this_script in
@@ -979,7 +944,7 @@
     esac
     #
     # Housekeeping...remove any build directory(ies) except if the package build fails.
-    [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
+    [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}"
     #
     # Include a touch of the target name so make can check if it's already been made.
     wrt_touch
@@ -1091,6 +1056,9 @@
 
 clean:  clean-chapter4 clean-chapter3 clean-chapter2
 
+restart:
+	@echo "This feature does not exist for the CLFS makefile. (yet)"
+
 clean-chapter2:
 	-if [ ! -f user-lfs-exist ]; then \\
 		userdel lfs; \\
@@ -1170,6 +1138,9 @@
 
 clean:  clean-makesys clean-makeboot clean-jhalfs
 
+restart:
+	@echo "This feature does not exist for the CLFS makefile. (yet)"
+
 clean-jhalfs:
 	-if [ ! -f user-lfs-exist ]; then \\
 		userdel lfs; \\

Modified: jhalfs/trunk/HLFS/master.sh
===================================================================
--- jhalfs/trunk/HLFS/master.sh	2006-06-19 19:12:37 UTC (rev 2797)
+++ jhalfs/trunk/HLFS/master.sh	2006-06-20 21:14:44 UTC (rev 2798)
@@ -119,13 +119,14 @@
 
     # Adjust 'name'
     case $name in
-      linux-libc) name=linux-libc-headers ;;
+      linux-libc) name="linux-libc-headers" ;;
+      gcc)        name="gcc-core"  ;;
+      uclibc)     name="uClibc"  ;;
     esac
 
     # Set the dependency for the first target.
     if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi
 
-
     #--------------------------------------------------------------------#
     #         >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<<          #
     #--------------------------------------------------------------------#
@@ -136,22 +137,13 @@
 
     # 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...
-    if [ "$vrs" != "" ] ; then
-      # Deal with non-standard names
-      case $name in
-        tcl)    FILE="$name$vrs-src.tar.*"  ;;
-        uclibc) FILE="uClibc-$vrs.tar.*"    ;;
-        gcc)    FILE="gcc-core-$vrs.tar.*"  ;;
-        *)      FILE="$name-$vrs.tar.*"     ;;
-      esac
+    pkg_tarball=$(get_package_tarball_name $name)
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
       case $this_script in
-        *binutils* )
-          wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories
-        *)
-          wrt_unpack "$FILE" ;;
+        *binutils* )  wrt_unpack "$pkg_tarball" 1 ;; # Do not delete an existing package directories
+        *)            wrt_unpack "$pkg_tarball" ;;
       esac
       # If the testsuites must be run, initialize the log file
       [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
@@ -180,12 +172,11 @@
     # Remove the build directory(ies) except if the package build fails
     # (so we can review config.cache, config.log, etc.)
     # For Binutils the sources must be retained for some time.
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       case "${this_script}" in
-        *binutils*) : # do NOTHING
-          ;;
-        *) wrt_remove_build_dirs "$name"
-          ;;
+        *binutils*) : ;;   # do NOTHING
+	*gcc*) wrt_remove_build_dirs "gcc"    ;;
+        *)     wrt_remove_build_dirs "$name"    ;;
       esac
     fi
 
@@ -271,11 +262,25 @@
     # Grab the name of the target
     name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
 
+    #
+    # 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$N/$this_script        ;;
+      gcc)    sed 's/rm /rm -f /' -i chapter06$N/$this_script        ;;
+    esac
+
+    case $name in
+      gcc)     name="gcc-core" ;;
+      uclibc)  name="uClibc"   ;;
+    esac
+
     # 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'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
         *)  continue ;;
@@ -290,42 +295,23 @@
     # 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$N/$this_script
-        ;;
-      gcc)
-          sed 's/rm /rm -f /' -i chapter06$N/$this_script
-        ;;
-    esac
 
     #--------------------------------------------------------------------#
     #         >>>>>>>> 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.
+    # as a dependency. Also call the echo_message function.		
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
-    if [ "$vrs" != "" ] ; then
-      # Deal with non-standard names
-      case $name in
-        tcl)    FILE="$name$vrs-src.tar.*" ;;
-        uclibc) FILE="uClibc-$vrs.tar.*" ;;
-        gcc)    FILE="gcc-core-$vrs.tar.*" ;;
-        *)      FILE="$name-$vrs.tar.*" ;;
-      esac
-      wrt_unpack2 "$FILE"
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_unpack2 "$pkg_tarball"
       wrt_target_vars
       # If the testsuites must be run, initialize the log file
       case $name in
-        binutils | gcc | glibc )
+        binutils | gcc-core | glibc )
           [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
           ;;
         * )
@@ -353,7 +339,7 @@
     esac
     #
     # Remove the build directory(ies) except if the package build fails.
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       wrt_remove_build_dirs "$name"
     fi
     #
@@ -427,11 +413,9 @@
 
     case "${this_script}" in
       *bootscripts*)
-        vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-        FILE="lfs-bootscripts-$vrs.tar.*"
-        wrt_unpack2 "$FILE"
-        vrs=`grep "^blfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-        echo -e "\t at echo \"\$(MOUNT_PT)\$(SRC)/blfs-bootscripts-$vrs\" >> sources-dir" >> $MKFILE.tmp
+        wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts")
+        blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' )
+        echo -e "\t at echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp
         ;;
     esac
 
@@ -546,6 +530,8 @@
 
 clean:  clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3
 
+restart: restart_code all
+
 clean-chapter3:
 	-if [ ! -f user-lfs-exist ]; then \\
 		userdel lfs; \\
@@ -599,6 +585,47 @@
 		rm -rf /home/lfs; \\
 	fi;
 
+restart_code:
+	@echo ">>> This feature is experimental, BUGS may exist"	
+	
+	@if [ ! -L /tools ]; then \\
+	  echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\
+	fi;
+	
+	@if [ ! -e /tools ]; then \\
+	  echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\
+	fi;
+	
+	@if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\
+	  echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\
+	fi;	
+
+	@if [ -f ???-kernfs ]; then \\
+	  mkdir -pv \$(MOUNT_PT)/{proc,sys};\\
+	  if !  mount -l | "\$(MOUNT_PT)/dev" >/dev/null ; then \\
+	    mount -vt ramfs ramfs \$(MOUNT_PT)/dev;\\
+	  fi;\\
+	  if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\
+	    mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\
+	  fi;\\
+	  if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\
+	    mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\
+	    mount -vt devpts -o gid=4,mode=620 devpts \$(MOUNT_PT)/dev/pts;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\
+	    mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
+	    mount -vt proc proc \$(MOUNT_PT)/proc;\\
+	  fi;\\
+	  if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
+	    mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
+	  fi;\\
+	fi;
+
+
 EOF
 ) >> $MKFILE
 

Modified: jhalfs/trunk/LFS/master.sh
===================================================================
--- jhalfs/trunk/LFS/master.sh	2006-06-19 19:12:37 UTC (rev 2797)
+++ jhalfs/trunk/LFS/master.sh	2006-06-20 21:14:44 UTC (rev 2798)
@@ -106,18 +106,12 @@
 
     # 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'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
-    # If $vrs isn't empty, we've got a package...
-    if [ "$vrs" != "" ] ; then
-      if [ "$name" = "tcl" ] ; then
-        FILE="$name$vrs-src.tar.*"
-      else
-        FILE="$name-$vrs.tar.*"
-      fi
-
+    # If $pkg_tarball isn't empty, we've got a package...
+    if [ "$pkg_tarball" != "" ] ; then
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
-      wrt_unpack "$FILE"
+      wrt_unpack "$pkg_tarball"
       # If the testsuites must be run, initialize the log file
       [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}"
       # If using optimizations, write the instructions
@@ -134,7 +128,7 @@
 
     # Remove the build directory(ies) except if the package build fails
     # (so we can review config.cache, config.log, etc.)
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       wrt_remove_build_dirs "$name"
     fi
 
@@ -195,9 +189,9 @@
     # 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'`
+    pkg_tarball=$(get_package_tarball_name $name)
 
-    if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
+    if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
         *stripping*) ;;
         *)  continue ;;
@@ -220,11 +214,10 @@
     # as a dependency. Also call the echo_message function.
     wrt_target "${this_script}${N}" "$PREV"
 
-    # If $vrs isn't empty, we've got a package...
+    # If $pkg_tarball isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
-    if [ "$vrs" != "" ] ; then
-      FILE="$name-$vrs.tar.*"
-      wrt_unpack2 "$FILE"
+    if [ "$pkg_tarball" != "" ] ; then
+      wrt_unpack2 "$pkg_tarball"
       # If the testsuites must be run, initialize the log file
       case $name in
         binutils | gcc | glibc )
@@ -246,7 +239,7 @@
     esac
 
     # Remove the build directory(ies) except if the package build fails.
-    if [ "$vrs" != "" ] ; then
+    if [ "$pkg_tarball" != "" ] ; then
       wrt_remove_build_dirs "$name"
     fi
 
@@ -304,14 +297,14 @@
     # Find the bootscripts and kernel package names
     case "${this_script}" in
       *bootscripts)
-          vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-          FILE="lfs-bootscripts-$vrs.tar.*"
-          wrt_unpack2 "$FILE"
+            name="lfs-bootscripts"
+            pkg_tarball=$(get_package_tarball_name $name)
+            wrt_unpack2 "$pkg_tarball"
         ;;
       *kernel)
-          vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
-          FILE="linux-$vrs.tar.*"
-          wrt_unpack2 "$FILE"
+            name="linux"
+            pkg_tarball=$(get_package_tarball_name $name)
+            wrt_unpack2 "$pkg_tarball"
        ;;
     esac
 
@@ -502,7 +495,7 @@
 	  if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\
 	    mount -vt proc proc \$(MOUNT_PT)/proc;\\
 	  fi;\\
-	  if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\
+	  if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\
 	    mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\
 	  fi;\\
 	fi;

Modified: jhalfs/trunk/common/common-functions
===================================================================
--- jhalfs/trunk/common/common-functions	2006-06-19 19:12:37 UTC (rev 2797)
+++ jhalfs/trunk/common/common-functions	2006-06-20 21:14:44 UTC (rev 2798)
@@ -683,6 +683,9 @@
   local saveIFS=$IFS
   local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
 
+  # ALWAYS create a list of the full filenames
+  create_package_list
+
     # Test if the packages must be downloaded
   [ ! "$GETPKG" = "1" ] && return
 
@@ -800,7 +803,29 @@
   fi
 }
 
+#----------------------------#
+create_package_list() {      #
+#----------------------------#
 
+  # Create the packages file. We need it for proper Makefile creation
+  echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
+  case ${PROGNAME} in
+    clfs)
+        xsltproc --nonet \
+                 --xinclude \
+                 -o pkg_tarball_list packages.xsl $BOOK/${ARCH}-index.xml
+      ;;
+    hlfs | lfs )
+        xsltproc --nonet \
+                 --xinclude \
+                 -o pkg_tarball_list packages.xsl $BOOK/index.xml
+      ;;
+  esac
+  echo " ...OK"
+
+}
+
+
 #----------------------------#
 create_urls() {              #
 #----------------------------#
@@ -836,3 +861,19 @@
 
   cd $BUILDDIR/sources
 }
+
+
+#----------------------------#
+get_package_tarball_name() { #
+#----------------------------#
+  local script_name=$1
+
+   # The use of 'head' is necessary to limit the return value to the FIRST match..
+   # hopefully this will not cause problems.
+   #
+   case $script_name in
+     tcl)   echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+     *)     echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
+   esac
+
+}
\ No newline at end of file

Added: jhalfs/trunk/common/packages.xsl
===================================================================
--- jhalfs/trunk/common/packages.xsl	                        (rev 0)
+++ jhalfs/trunk/common/packages.xsl	2006-06-20 21:14:44 UTC (rev 2798)
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!-- $Id$ -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    version="1.0">
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//para"/>
+  </xsl:template>
+
+  <xsl:template match="para">
+    <xsl:if test="contains(string(),'Download:')">
+      <xsl:call-template name="package_name">
+        <xsl:with-param name="url" select="ulink/@url"/>
+      </xsl:call-template>
+      <xsl:text>&#xA;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="package_name">
+    <xsl:param name="url" select="foo"/>
+    <xsl:param name="sub-url" select="substring-after($url,'/')"/>
+    <xsl:choose>
+      <xsl:when test="contains($sub-url,'/')">
+        <xsl:call-template name="package_name">
+          <xsl:with-param name="url" select="$sub-url"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:choose>
+          <xsl:when test="contains($sub-url,'.patch')"/>
+          <xsl:when test="contains($sub-url,'?')">
+            <xsl:value-of select="substring-before($sub-url,'?')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$sub-url"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>


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

Modified: jhalfs/trunk/master.sh
===================================================================
--- jhalfs/trunk/master.sh	2006-06-19 19:12:37 UTC (rev 2797)
+++ jhalfs/trunk/master.sh	2006-06-20 21:14:44 UTC (rev 2798)
@@ -507,6 +507,7 @@
   fi
   #
   [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl  $JHALFSDIR/
+  cp $COMMON_DIR/packages.xsl  $JHALFSDIR/
   #
   sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
   export XSL=$JHALFSDIR/${XSL}




More information about the alfs-log mailing list