r2746 - in jhalfs/branches/experimental: . CLFS HLFS LFS common

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Fri Jun 2 10:53:18 PDT 2006


Author: manuel
Date: 2006-06-02 11:53:17 -0600 (Fri, 02 Jun 2006)
New Revision: 2746

Added:
   jhalfs/branches/experimental/common/progress_bar.sh
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/config
   jhalfs/branches/experimental/common/func_compare.sh
   jhalfs/branches/experimental/common/makefile-functions
   jhalfs/branches/experimental/master.sh
Log:
Merged r2734:2745 from trunk.

Modified: jhalfs/branches/experimental/CLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/CLFS/master.sh	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/CLFS/master.sh	2006-06-02 17:53:17 UTC (rev 2746)
@@ -991,6 +991,7 @@
 
 SRC= /sources
 MOUNT_PT= $BUILDDIR
+PKG_LST= $PKG_LST
 
 include makefile-functions
 

Modified: jhalfs/branches/experimental/HLFS/master.sh
===================================================================
--- jhalfs/branches/experimental/HLFS/master.sh	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/HLFS/master.sh	2006-06-02 17:53:17 UTC (rev 2746)
@@ -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
 
@@ -149,7 +154,7 @@
       *binutils* )  # Dump the path to sources directory for later removal
 (
 cat << EOF
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	echo "\$(MOUNT_PT)\$(SRC)/\$\$ROOT" >> sources-dir
 EOF
 ) >> $MKFILE.tmp
@@ -429,7 +434,7 @@
       *bootscripts*)
 (
 cat << EOF
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
 	@rm -r \`cat sources-dir\` && \\
 	rm sources-dir
@@ -478,6 +483,7 @@
 
 SRC= /sources
 MOUNT_PT= $BUILDDIR
+PKG_LST= $PKG_LST
 
 include makefile-functions
 
@@ -571,7 +577,7 @@
 		userdel lfs; \\
 		rm -rf /home/lfs; \\
 	fi;
-	
+
 EOF
 ) >> $MKFILE
 

Modified: jhalfs/branches/experimental/LFS/master.sh
===================================================================
--- jhalfs/branches/experimental/LFS/master.sh	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/LFS/master.sh	2006-06-02 17:53:17 UTC (rev 2746)
@@ -355,6 +355,7 @@
 
 SRC= /sources
 MOUNT_PT= $BUILDDIR
+PKG_LST= $PKG_LST
 
 include makefile-functions
 
@@ -431,7 +432,7 @@
 	fi;
 	@chown lfs:lfs /home/lfs/.bash* && \\
 	touch \$@
-	
+
 do_housekeeping:
 	-umount \$(MOUNT_PT)/sys
 	-umount \$(MOUNT_PT)/proc
@@ -442,7 +443,7 @@
 		userdel lfs; \\
 		rm -rf /home/lfs; \\
 	fi;
-	
+
 EOF
 ) >> $MKFILE
 

Modified: jhalfs/branches/experimental/common/common-functions
===================================================================
--- jhalfs/branches/experimental/common/common-functions	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/common/common-functions	2006-06-02 17:53:17 UTC (rev 2746)
@@ -57,7 +57,7 @@
 
 ${BOLD}  -D  --directory DIR${OFF}
         use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs-X produces
-        will be in the directory DIR/jhalfs.
+        will be in the directory DIR/${SCRIPT_ROOT}.
         The current setting for BUILDDIR is "$BUILDDIR"
 
 ${BOLD}  -G, --get-packages${OFF}
@@ -201,20 +201,62 @@
 
 $i:  $PREV
 	@\$(call echo_message, Building)
-	@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >logs/$LOGFILE
+	@./progress_bar.sh \$@ &
+	@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
 EOF
 ) >> $MKFILE.tmp
 }
 
 
 #----------------------------------#
+wrt_remove_existing_dirs() {       #
+#----------------------------------#
+  local PKG_NAME=$1
+(
+cat << EOF
+	@PKG_PATH=\`ls -t \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1\` && \\
+	ROOT=\`tar -tf \$\$PKG_PATH | 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
+	@PKG_PATH=\`ls -t \$(SRC)/${PKG_NAME} | head -n1\` && \\
+	ROOT=\`tar -tf \$\$PKG_PATH | 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)
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
 	chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
 EOF
@@ -226,10 +268,15 @@
 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)
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
 EOF
 ) >> $MKFILE.tmp
@@ -240,16 +287,20 @@
 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)
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
 EOF
 ) >> $MKFILE.tmp
 }
 
-
 #----------------------------------#
 wrt_target_vars() {                # Target vars for hlfs (cross-build method)
 #----------------------------------#
@@ -271,7 +322,7 @@
 (
 cat << EOF
 	@( time { su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
-	echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/$this_script
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
 EOF
 ) >> $MKFILE.tmp
 }
@@ -285,7 +336,7 @@
 (
 cat << EOF
 	@( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
-	echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/$this_script
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
 EOF
 ) >> $MKFILE.tmp
 }
@@ -299,7 +350,7 @@
 (
 cat << EOF
 	@( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
-	echo -e "\nKB: \`du -skx --exclude=jhalfs \`\n" >>logs/$this_script
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script
 EOF
 ) >> $MKFILE.tmp
 }
@@ -313,8 +364,8 @@
   local file=$2
 (
     cat << EOF
-	@( time { \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
-	echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/${this_script}
+	@( time { \$(CHROOT1) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script}
 EOF
 ) >> $MKFILE.tmp
 }
@@ -327,8 +378,8 @@
   local file=$2
 (
 cat << EOF
-	@( time { \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
-	echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/${this_script}
+	@( time { \$(CHROOT2) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
+	echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script}
 EOF
 ) >> $MKFILE.tmp
 }
@@ -363,7 +414,7 @@
   local name=$1
 (
 cat << EOF
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
 	if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
 		rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
@@ -379,7 +430,7 @@
   local name=$1
 (
 cat << EOF
-	@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
+	@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
 	rm -r \$(SRC)/\$\$ROOT && \\
 	if [ -e \$(SRC)/$name-build ]; then \\
 		rm -r \$(SRC)/$name-build; \\

Modified: jhalfs/branches/experimental/common/config
===================================================================
--- jhalfs/branches/experimental/common/config	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/common/config	2006-06-02 17:53:17 UTC (rev 2746)
@@ -88,9 +88,13 @@
 # Don't edit it unless you know what you are doing
 
 #--- Working directories
-JHALFSDIR=$BUILDDIR/jhalfs
+SCRIPT_ROOT=jhalfs
+JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
    LOGDIR=$JHALFSDIR/logs
 
+#--- File listing package contents (from where package sources dir is extracted)
+PKG_LST=unpacked
+
 #--- ICA report log directory
 ICALOGDIR=$LOGDIR/ICA
 

Modified: jhalfs/branches/experimental/common/func_compare.sh
===================================================================
--- jhalfs/branches/experimental/common/func_compare.sh	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/common/func_compare.sh	2006-06-02 17:53:17 UTC (rev 2746)
@@ -43,17 +43,17 @@
 #----------------------------------#
   local ITERATION=$1
   local   PREV_IT=$2
-  local PRUNEPATH="/dev /home /jhalfs /lost+found /media /mnt /opt /proc \
+  local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /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
+    local DEST_TOPDIR=/${SCRIPT_ROOT}
+    local   ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
+    local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
   else
     local    ROOT_DIR=$BUILDDIR
-    local DEST_TOPDIR=$BUILDDIR/jhalfs
+    local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT}
   fi
 
   if [[ "$RUN_ICA" = "1" ]] ; then

Modified: jhalfs/branches/experimental/common/makefile-functions
===================================================================
--- jhalfs/branches/experimental/common/makefile-functions	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/common/makefile-functions	2006-06-02 17:53:17 UTC (rev 2746)
@@ -17,17 +17,17 @@
 
 define unpack
   @cd $(MOUNT_PT)$(SRC) && \
-  tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
+  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
 endef
 
 define unpack2
   @cd $(MOUNT_PT)$(SRC) && \
-  /tools/bin/tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
+  /tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
 endef
 
 define unpack3
   @cd $(SRC) && \
-  tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
+  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
 endef
 
 define echo_report

Copied: jhalfs/branches/experimental/common/progress_bar.sh (from rev 2745, jhalfs/trunk/common/progress_bar.sh)
===================================================================
--- jhalfs/branches/experimental/common/progress_bar.sh	                        (rev 0)
+++ jhalfs/branches/experimental/common/progress_bar.sh	2006-06-02 17:53:17 UTC (rev 2746)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# $Id$
+
+set -e
+
+[[ -z $1 ]] && exit
+
+if [ ! -f $1 ] ; then
+  while fuser -v . 2>&1 | grep make >/dev/null ; do
+    echo -n "."
+    sleep 1
+    [[ -f $1 ]] && exit
+  done
+fi


Property changes on: jhalfs/branches/experimental/common/progress_bar.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Author Date Revision Id

Modified: jhalfs/branches/experimental/master.sh
===================================================================
--- jhalfs/branches/experimental/master.sh	2006-06-02 12:17:58 UTC (rev 2745)
+++ jhalfs/branches/experimental/master.sh	2006-06-02 17:53:17 UTC (rev 2746)
@@ -136,7 +136,7 @@
           ;;
         * )
           BUILDDIR=$1
-          JHALFSDIR=$BUILDDIR/jhalfs
+          JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
           LOGDIR=$JHALFSDIR/logs
           MKFILE=$JHALFSDIR/Makefile
           ;;
@@ -481,7 +481,7 @@
 #
 #
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
-  cp $COMMON_DIR/makefile-functions $JHALFSDIR/
+  cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
   [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
   if [[ "$COMPARE" != "0" ]] ; then
     mkdir -p $JHALFSDIR/extras




More information about the alfs-log mailing list