r2736 - in jhalfs/trunk: HLFS common

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Wed May 31 19:34:40 PDT 2006


Author: georgeb
Date: 2006-05-31 20:34:38 -0600 (Wed, 31 May 2006)
New Revision: 2736

Modified:
   jhalfs/trunk/HLFS/master.sh
   jhalfs/trunk/common/common-functions
Log:
Added function(s) wrt_delete_existings_dirs. Requested by Gerald B

Modified: jhalfs/trunk/HLFS/master.sh
===================================================================
--- jhalfs/trunk/HLFS/master.sh	2006-05-31 21:08:02 UTC (rev 2735)
+++ jhalfs/trunk/HLFS/master.sh	2006-06-01 02:34:38 UTC (rev 2736)
@@ -141,7 +141,12 @@
         *)      FILE="$name-$vrs.tar.*"     ;;
       esac
       # Insert instructions for unpacking the package and to set the PKGDIR variable.
-      wrt_unpack "$FILE"
+      case $this_script in
+        *binutils* ) 
+	  wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories
+	*)
+	  wrt_unpack "$FILE" ;;
+      esac
       [[ "$OPTIMIZE" = "2" ]] &&  wrt_optimize "$name" && wrt_makeflags "$name"
     fi
 

Modified: jhalfs/trunk/common/common-functions
===================================================================
--- jhalfs/trunk/common/common-functions	2006-05-31 21:08:02 UTC (rev 2735)
+++ jhalfs/trunk/common/common-functions	2006-06-01 02:34:38 UTC (rev 2736)
@@ -209,9 +209,48 @@
 
 
 #----------------------------------#
+wrt_remove_existing_dirs() {       #
+#----------------------------------#
+  local PKG_NAME=$1
+(
+cat << EOF
+	@ROOT=\`tar -tf \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
+	[[ -n \$\$ROOT ]] && \\
+	rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
+	if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build ]; then \\
+		rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build; \\
+	fi;
+EOF
+) >> $MKFILE.tmp
+}
+
+#----------------------------------#
+wrt_remove_existing_dirs2() {      #
+#----------------------------------#
+  local PKG_NAME=$1
+(
+cat << EOF
+	@ROOT=\`tar -tf \$(SRC)/${PKG_NAME} | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
+	[[ -n \$\$ROOT ]] && \\
+	rm -rf \$(SRC)/\$\$ROOT && \\
+	if [ -e \$(SRC)/${PKG_NAME%%-*}-build ]; then \\
+		rm -rf \$(SRC)/${PKG_NAME%%-*}-build; \\
+	fi;
+EOF
+) >> $MKFILE.tmp
+}
+
+
+
+#----------------------------------#
 wrt_unpack() {                     # Unpack and set 'ROOT' var
 #----------------------------------#
   local FILE=$1
+  local optSAVE_PREVIOUS=$2
+  
+  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
+    wrt_remove_existing_dirs "$FILE"
+  fi
 (
 cat << EOF
 	@\$(call unpack,$FILE)
@@ -227,6 +266,11 @@
 wrt_unpack2() {                    #
 #----------------------------------#
   local FILE=$1
+  local optSAVE_PREVIOUS=$2
+
+  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
+    wrt_remove_existing_dirs "$FILE"
+  fi
 (
 cat  << EOF
 	@\$(call unpack2,$FILE)
@@ -241,6 +285,11 @@
 wrt_unpack3() {                    #
 #----------------------------------#
   local FILE=$1
+  local optSAVE_PREVIOUS=$2
+
+  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
+    wrt_remove_existing_dirs2 "$FILE"
+  fi
 (
 cat  << EOF
 	@\$(call unpack3,$FILE)
@@ -250,7 +299,6 @@
 ) >> $MKFILE.tmp
 }
 
-
 #----------------------------------#
 wrt_target_vars() {                # Target vars for hlfs (cross-build method)
 #----------------------------------#




More information about the alfs-log mailing list