[Lunar-commits] <lunar> Overhaul BUILD file processing.

Auke Kok sofar at foo-projects.org
Wed Jun 15 06:08:29 CEST 2011


commit b009e472ff93ea4e95fbd390f45ae34e37e79971
Author: Auke Kok <sofar at foo-projects.org>
Date:   Tue Jun 14 21:08:29 2011 -0700

    Overhaul BUILD file processing.
    
    *1*
    BUILD procedural change - makes C_FIFO usage in BUILD obsolete. We can
    do this in the run_build() file globally for each and every BUILD file
    anyway, so there's no reason to even do this at all.
    
    We'll need to clean up moonbase entirely, but this will save us 3k occurrences
    plus trimmable whitespace = well over 100k on the size of moonbase. Plus
    it's easier to write.
    
    *2*
    Enable shopt -s execfail for all BUILD scripts too. We're seeing too many
    undetected errors, and really should stop using && as a measure to trap
    errors. Instead, with this change, we can remove all the '&&'s and in the
    few occasions (not many) where errors need to be ignored, we can '|| :'
    them instead, which is easy to review and check.
---
 var/lib/lunar/functions/build.lunar |   36 +++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/var/lib/lunar/functions/build.lunar b/var/lib/lunar/functions/build.lunar
index c743d90..acf718b 100644
--- a/var/lib/lunar/functions/build.lunar
+++ b/var/lib/lunar/functions/build.lunar
@@ -186,7 +186,7 @@ default_config() {
               --infodir=$MODULE_PREFIX/share/info \
               --mandir=$MODULE_PREFIX/share/man   \
               $OPTS
-} > $C_FIFO 2>&1
+}
 
 
 default_game_config() {
@@ -201,7 +201,7 @@ default_game_config() {
               --infodir=$MODULE_PREFIX/share/info  \
               --mandir=$MODULE_PREFIX/share/man    \
               $OPTS
-} > $C_FIFO 2>&1
+}
 
 
 default_cvs_config() {
@@ -216,7 +216,7 @@ default_cvs_config() {
                 --infodir=$MODULE_PREFIX/share/info \
                 --mandir=$MODULE_PREFIX/share/man   \
                 $OPTS
-} > $C_FIFO 2>&1
+}
 
 
 default_cmake_config() {
@@ -229,7 +229,7 @@ default_cmake_config() {
   cmake -DCMAKE_INSTALL_PREFIX=$MODULE_PREFIX  \
         -DCMAKE_BUILD_TYPE=RELEASE             \
         $OPTS $SOURCE_DIRECTORY
-} > $C_FIFO 2>&1
+}
 
 
 default_make() {
@@ -238,7 +238,7 @@ default_make() {
   make                               &&
   prepare_install                    &&
   make install
-} > $C_FIFO 2>&1
+}
 
 
 default_game_build() {
@@ -246,7 +246,7 @@ default_game_build() {
   verbose_msg "running \"default_game_build\""
   default_game_config  &&
   default_make
-} > $C_FIFO 2>&1
+}
 
 
 default_cmake_build() {
@@ -254,21 +254,22 @@ default_cmake_build() {
   verbose_msg "running \"default_cmake_build\""
   default_cmake_config &&
   default_make
-} > $C_FIFO 2>&1
+}
+
 
 default_build() {
   debug_msg "default_build ($@)"
   verbose_msg "running \"default_build\""
   default_config  &&
   default_make
-} > $C_FIFO 2>&1
+}
 
 
 default_cvs_build() {
   debug_msg "default_cvs_build ($@)"
   default_cvs_config  &&
   default_make
-} > $C_FIFO 2>&1
+}
 
 
 default_cpan_pre_build() {
@@ -299,7 +300,7 @@ default_cpan_build() {
 	install $CPAN_MODULE
 	quit" | /usr/bin/cpan || exit 1
   rm_source_dir $SOURCE_DIRECTORY
-} > $C_FIFO 2>&1
+}
 
 
 default_post_build() {
@@ -408,12 +409,15 @@ run_build()  {
   if [[ "${USE_WRAPPERS:-yes}" == "yes" ]]; then
     export PATH=/var/lib/lunar/compilers:$PATH
   fi
-  if has_module_file $MODULE BUILD ; then
-    run_module_file $MODULE BUILD
-  else
-    default_build
-  fi
-
+  (
+    # fix errors, don't avoid them. This makes all errors fatal
+    shopt -s execfail
+    if has_module_file $MODULE BUILD ; then
+      run_module_file $MODULE BUILD
+    else
+      default_build
+    fi
+  ) > $C_FIFO 2>&1
 }
 
 


More information about the Lunar-commits mailing list