>Mike N wrote:
> Implementing a feature where the use of TMPFS ram filesystem would try to
> re-compile a pkg without TMPFS if compilation failed in out-of-disk-space
> error (because of too small TMPFS ram storage). This way nightly batch
> builds could use TMPFS space, but still those "too big packages" would
> compile through normal disk space.

>>Rene wrote:
>> it's a nice idea to implement something like this, but I guess getting
>> As a quick conceptual test you could start not worrying about the
>> real error, but build any failed package a second time without
>> TMPFS, this might be just a couple of lines of code.
>>     
>

Here is a patch file which modifies Build-Pkg script to do following
additional trick:

If target configuration enabled the use of TMPFS ram filesystem and the
first compilation attempt failed then script will automagically re-try the
pkg compilation per package.

The attached patch does recursive call to Build-Pkg command to re-run the
same command, but the second call instructs the script to ignore the TMPFS
feature.

The preliminary test run showed quite a good speed improvement (I used only
200M TMPFS to make sure some packages would fail in out-of-storage-space
errors, just to see that re-try trick works).

-Mike N

------------------------
--- Build-Pkg-orig      2009-03-25 04:34:39.424686896 +0200
+++ Build-Pkg   2009-03-25 09:38:36.671282460 +0200
@@ -39,6 +39,9 @@
 stagelevel=9
 this_is_the_2nd_run=0
 
+# Control recursive call to Build-Pkg and use of TMPFS filesystem
(0=normal, 1=use tmpfs if enabled, 2=dont use tmpfs even when enabled) 
+tmpfsusage=0
+
 #
 # ----  Functions
 #
@@ -80,6 +83,7 @@
                -id)      options="$options $1 $2" ; id="$2"       ; shift ;;
                -noclearsrc) options="$options $1" ; clear_src=0   ;;
                -norebuild)  options="$options $1" ; norebuild=1   ;;
+               -tmpfsusage) options="$options $1 $2" ; tmpfsusage=$2; shift ;;
                -*) help_msg ; exit 1 ;;
                *)  break ;;
        esac
@@ -133,6 +137,23 @@
     done
     exit 0
 fi
+
+# If TMPFS is enabled, try to compile it normally at first. If it fails
then re-try without TMPFS ram filesystem 
+if [ "$SDECFG_SRC_TMPFS" = 1 -a $tmpfsusage = 0 ]; then
+    pkg="${1%=*}" 
+    echo "TMPFS enabled. The first attempt to build $pkg using TMPFS RAM
filesystem"
+    
+    if ! ./scripts/Build-Pkg $options -tmpfsusage 1 $pkg; then
+       echo "TMPFS enabled. Failed to build $pkg. Trying again without
TMPFS RAM filesystem"
+    
+       if ! ./scripts/Build-Pkg $options -tmpfsusage 2 $pkg && \
+          [ $stagelevel -le $SDECFG_CONTINUE_ON_ERROR_AFTER ]; then
+               exit 1
+       fi
+    fi   
+    exit 0
+fi
+
 pkg="${1%=*}" ; xpkg="${1#*=}"
 builddir="$base/src.$pkg.$config.$id"
 
@@ -476,7 +497,7 @@
 
 if [ $clear_src = 1 ] ; then
        mkdir -p $builddir; chmod 700 $builddir
-       if [ "$SDECFG_SRC_TMPFS" = 1 ]; then
+       if [ "$SDECFG_SRC_TMPFS" = 1 -a $tmpfsusage = 1 ]; then
                mount -t tmpfs -o $SDECFG_SRC_TMPFS_OPT none $builddir
        fi
 else

-- 
View this message in context: 
http://www.nabble.com/TMPFS-out-of-disk-space-workaround-feature-suggestion-tp22688139p22746268.html
Sent from the T2 mailing list archive at Nabble.com.



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[email protected] with a subject of: unsubscribe t2

Reply via email to