r2368 - in jhalfs/branches/experimental: CLFS HLFS LFS common

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Sun Mar 19 03:14:43 PST 2006


Author: manuel
Date: 2006-03-19 04:14:42 -0700 (Sun, 19 Mar 2006)
New Revision: 2368

Modified:
   jhalfs/branches/experimental/CLFS/master.sh
   jhalfs/branches/experimental/HLFS/master.sh
   jhalfs/branches/experimental/LFS/master.sh
   jhalfs/branches/experimental/common/common-functions
   jhalfs/branches/experimental/common/makefile-functions
Log:
Simplified unpack code due tar >= 1.5 prerequisite.
If both bz2 and gz formats of the same package are found in the sources dir, only the more recent one is unpacked.

Modified: jhalfs/branches/experimental/CLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/CLFS/master.sh	2006-03-19 10:53:00 UTC (rev 2367)
+++ jhalfs/branches/experimental/CLFS/master.sh	2006-03-19 11:14:42 UTC (rev 2368)
@@ -287,7 +287,7 @@
     #
     # If $vrs isn't empty, we've got a package...
     #
-    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar" &&  echo -e '\ttrue' >> $MKFILE.tmp
+    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" &&  echo -e '\ttrue' >> $MKFILE.tmp
     #
     wrt_run_as_lfs "${this_script}" "${file}"
     #
@@ -339,7 +339,7 @@
     # If $vrs 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" && echo -e '\ttrue' >> $MKFILE.tmp
+    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
     #
     wrt_run_as_lfs "${this_script}" "${file}"
     #
@@ -411,7 +411,7 @@
     # If $vrs isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
     #
     # Select a script execution method
     case $this_script in
@@ -488,7 +488,7 @@
     #
     if [ "$vrs" != "" ] ; then
       case $this_script in
-        *util-linux)    wrt_unpack  "$name-$vrs.tar"
+        *util-linux)    wrt_unpack  "$name-$vrs.tar.*"
                         echo -e '\ttrue' >> $MKFILE.tmp
             ;;
         *)              wrt_unpack2 "$name-$vrs.tar.*"
@@ -551,8 +551,8 @@
     echo -e "\n$this_script:  $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
     #
     case $name in
-      tcl)    wrt_unpack2 "$name$vrs-src.tar" ;;
-      *)      wrt_unpack2 "$name-$vrs.tar"    ;;
+      tcl)    wrt_unpack2 "$name$vrs-src.tar.*" ;;
+      *)      wrt_unpack2 "$name-$vrs.tar.*"    ;;
     esac
     #
     wrt_run_as_chroot1 "${this_script}" "${file}"
@@ -604,8 +604,8 @@
     echo -e "\n$this_script:  $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
     #
     case $name in
-      tcl)    wrt_unpack4 "$name$vrs-src.tar.*" ;;
-      *)      wrt_unpack4 "$name-$vrs.tar.*"    ;;
+      tcl)    wrt_unpack3 "$name$vrs-src.tar.*" ;;
+      *)      wrt_unpack3 "$name-$vrs.tar.*"    ;;
     esac
     #
     wrt_run_as_root2 "${this_script}" "${file}"
@@ -818,8 +818,8 @@
     # If $vrs isn't empty, we've got a package...
     if [ "$vrs" != "" ] ; then
       case $name in
-        temp-perl) wrt_unpack4 "perl-$vrs.tar.*"    ;;
-        *)         wrt_unpack4 "$name-$vrs.tar.*"   ;;
+        temp-perl) wrt_unpack3 "perl-$vrs.tar.*"    ;;
+        *)         wrt_unpack3 "$name-$vrs.tar.*"   ;;
       esac
       #
       # Export a few 'config' vars..
@@ -985,7 +985,7 @@
     #
     # If $vrs isn't empty, we've got a package...
     #
-    [[ "$vrs" != "" ]] && wrt_unpack4 "$name-$vrs.tar.*"
+    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
     #
     wrt_run_as_root2 "${this_script}" "${file}"
     #
@@ -1056,7 +1056,7 @@
     # If $vrs isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
+    [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
     #
     # Select a script execution method
     case $this_script in
@@ -1100,7 +1100,7 @@
     # A little housekeeping on the scripts
     case $this_script in
       *grub*)     continue  ;;
-      *kernel) 
+      *kernel)
                # if there is no kernel config file do not build the kernel
                [[ -z $CONFIG ]] && continue
                cfg_file="/sources/`basename $CONFIG`"
@@ -1141,7 +1141,7 @@
     # If $vrs isn't empty, we've got a package...
     # Insert instructions for unpacking the package and changing directories
     #
-    [[ "$vrs" != "" ]] && wrt_unpack4 "$name-$vrs.tar.*"
+    [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
     #
     # Select a script execution method
     case $this_script in

Modified: jhalfs/branches/experimental/HLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/HLFS/master.sh	2006-03-19 10:53:00 UTC (rev 2367)
+++ jhalfs/branches/experimental/HLFS/master.sh	2006-03-19 11:14:42 UTC (rev 2368)
@@ -215,10 +215,10 @@
     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"     ;;
+        tcl)    FILE="$name$vrs-src.tar.*"  ;;
+        uclibc) FILE="uClibc-$vrs.tar.*"    ;;
+        gcc)    FILE="gcc-core-$vrs.tar.*"  ;;
+        *)      FILE="$name-$vrs.tar.*"     ;;
       esac
      # Insert instructions for unpacking the package and to set the PKGDIR variable.
      wrt_unpack "$FILE"

Modified: jhalfs/branches/experimental/LFS/master.sh
===================================================================
--- jhalfs/branches/experimental/LFS/master.sh	2006-03-19 10:53:00 UTC (rev 2367)
+++ jhalfs/branches/experimental/LFS/master.sh	2006-03-19 11:14:42 UTC (rev 2368)
@@ -106,9 +106,9 @@
     # If $vrs isn't empty, we've got a package...
     if [ "$vrs" != "" ] ; then
       if [ "$name" = "tcl" ] ; then
-        FILE="$name$vrs-src.tar"
+        FILE="$name$vrs-src.tar.*"
       else
-        FILE="$name-$vrs.tar"
+        FILE="$name-$vrs.tar.*"
       fi
 
       # Insert instructions for unpacking the package and to set the PKGDIR variable.

Modified: jhalfs/branches/experimental/common/common-functions
===================================================================
--- jhalfs/branches/experimental/common/common-functions	2006-03-19 10:53:00 UTC (rev 2367)
+++ jhalfs/branches/experimental/common/common-functions	2006-03-19 11:14:42 UTC (rev 2368)
@@ -228,21 +228,6 @@
 }
 
 
-#=============================#
-wrt_unpack3() {               # Unpack and set 'ROOT' var
-#=============================#
-  local FILE=$1
-(
-cat  << EOF
-	@\$(call unpack3,$FILE)
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
-	echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
-	chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
-EOF
-) >> $MKFILE.tmp
-}
-
-
 #----------------------------------#
 wrt_unpack2() {                    #
 #----------------------------------#
@@ -258,12 +243,12 @@
 
 
 #=============================#
-wrt_unpack4() {               # Unpack and set 'ROOT' var
+wrt_unpack3() {               # Unpack and set 'ROOT' var
 #=============================#
   local FILE=$1
 (
 cat  << EOF
-	@\$(call unpack4,$FILE)
+	@\$(call unpack3,$FILE)
 	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
 	echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
 EOF

Modified: jhalfs/branches/experimental/common/makefile-functions
===================================================================
--- jhalfs/branches/experimental/common/makefile-functions	2006-03-19 10:53:00 UTC (rev 2367)
+++ jhalfs/branches/experimental/common/makefile-functions	2006-03-19 11:14:42 UTC (rev 2368)
@@ -1,3 +1,6 @@
+
+# $Id$
+
 BOLD= ""
 RED= ""
 GREEN= ""
@@ -13,25 +16,20 @@
 endef
 
 define unpack
-  @if [ -f $(MOUNT_PT)$(SRC)/$(1).bz2 ] ; then \
-    cd $(MOUNT_PT)$(SRC) ; tar -xvjf $(1).bz2 > /tmp/unpacked ; \
-  else \
-    cd $(MOUNT_PT)$(SRC) ; tar -xvzf $(1).gz > /tmp/unpacked ; \
-  fi ;
+  @cd $(MOUNT_PT)$(SRC) && \
+  tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
 endef
 
 define unpack2
-  @cd $(MOUNT_PT)$(SRC) ; /tools/bin/tar -xvf $(1) > /tmp/unpacked
+  @cd $(MOUNT_PT)$(SRC) && \
+  /tools/bin/tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
 endef
 
 define unpack3
-  @cd $(MOUNT_PT)$(SRC) ; tar -xvf $(1) > /tmp/unpacked
+  @cd $(SRC) && \
+  tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
 endef
 
-define unpack4
-  @cd $(SRC) ; tar -xvf $(1) > /tmp/unpacked
-endef
-
 define echo_finished
   @echo $(BOLD)
   @echo --------------------------------------------------------------------------------




More information about the alfs-log mailing list