Browse Source

Use FWROOT in bash_functions for cleaner output

Hamilton Turner 11 years ago
parent
commit
26916efc84
3 changed files with 29 additions and 16 deletions
  1. 1 0
      toolset/run-tests.py
  2. 16 12
      toolset/setup/linux/bash_functions.sh
  3. 12 4
      toolset/setup/linux/installer.py

+ 1 - 0
toolset/run-tests.py

@@ -32,6 +32,7 @@ def main(argv=None):
     if not fwroot: 
     if not fwroot: 
         fwroot = os.getcwd()
         fwroot = os.getcwd()
     setup_util.replace_environ(config='config/benchmark_profile', root=fwroot)
     setup_util.replace_environ(config='config/benchmark_profile', root=fwroot)
+    print "FWROOT is %s"%setup_util.get_fwroot()
 
 
     conf_parser = argparse.ArgumentParser(
     conf_parser = argparse.ArgumentParser(
         description=__doc__,
         description=__doc__,

+ 16 - 12
toolset/setup/linux/bash_functions.sh

@@ -56,18 +56,22 @@ fw_depends() {
     echo Searching for $depend
     echo Searching for $depend
     trap 'fw_traperror $depend $? $LINENO "$BASH_COMMAND" $(printf ":%s" ${FUNCNAME[@]}) $(printf ":%s" ${BASH_SOURCE[@]}) $(printf ":%s" ${BASH_LINENO[@]})'  ERR
     trap 'fw_traperror $depend $? $LINENO "$BASH_COMMAND" $(printf ":%s" ${FUNCNAME[@]}) $(printf ":%s" ${BASH_SOURCE[@]}) $(printf ":%s" ${BASH_LINENO[@]})'  ERR
     retcode=0
     retcode=0
-    if [ -f ../toolset/setup/linux/systools/${depend}.sh ]; then
-      echo Installing system tool: $depend 
-      . ../toolset/setup/linux/systools/${depend}.sh
-    elif [ -f ../toolset/setup/linux/languages/${depend}.sh ]; then
-      echo Installing language: $depend 
-      . ../toolset/setup/linux/languages/${depend}.sh
-    elif [ -f ../toolset/setup/linux/webservers/${depend}.sh ]; then
-      echo Installing webserver: $depend 
-      . ../toolset/setup/linux/webservers/${depend}.sh
-    elif [ -f ../toolset/setup/linux/frameworks/${depend}.sh ]; then
-      echo Installing framework: $depend
-      . ../toolset/setup/linux/frameworks/${depend}.sh
+
+    wd=$(pwd)
+    relative_wd=\$FWROOT${wd#$FWROOT}
+
+    if [ -f $FWROOT/toolset/setup/linux/systools/${depend}.sh ]; then
+      echo Installing system tool: $depend in $relative_wd
+      . $FWROOT/toolset/setup/linux/systools/${depend}.sh
+    elif [ -f $FWROOT/toolset/setup/linux/languages/${depend}.sh ]; then
+      echo Installing language: $depend in $relative_wd
+      . $FWROOT/toolset/setup/linux/languages/${depend}.sh
+    elif [ -f $FWROOT/toolset/setup/linux/webservers/${depend}.sh ]; then
+      echo Installing webserver: $depend in $relative_wd
+      . $FWROOT/toolset/setup/linux/webservers/${depend}.sh
+    elif [ -f $FWROOT/toolset/setup/linux/frameworks/${depend}.sh ]; then
+      echo Installing framework: $depend in $relative_wd
+      . $FWROOT/toolset/setup/linux/frameworks/${depend}.sh
     else
     else
       echo WARN: No installer found for $depend
       echo WARN: No installer found for $depend
       continue
       continue

+ 12 - 4
toolset/setup/linux/installer.py

@@ -82,9 +82,17 @@ class Installer:
             test_rel_install_file = "$FWROOT%s" % setup_util.path_relative_to_root(test_install_file)
             test_rel_install_file = "$FWROOT%s" % setup_util.path_relative_to_root(test_install_file)
 
 
             # Then run test installer file
             # Then run test installer file
-            # Give all installers FWROOT, IROOT, and bash_functions
-            self.__run_command("IROOT=$FWROOT%s . %s && . %s" % 
-              (test_rel_install_dir, bash_functions_path, test_rel_install_file),
+            # Give all installers a number of variables
+            # FWROOT - Path of the FwBm root
+            # IROOT  - Path of this test's install directory
+            # TROOT  - Path to this test's directory 
+            self.__run_command('''
+              export TROOT=$FWROOT%s && 
+              export IROOT=$FWROOT%s && 
+              . %s && 
+              . %s''' % 
+              (test_rel_dir, test_rel_install_dir, 
+                bash_functions_path, test_rel_install_file),
                 cwd=test_install_dir)
                 cwd=test_install_dir)
 
 
     self.__run_command("sudo apt-get -y autoremove");    
     self.__run_command("sudo apt-get -y autoremove");    
@@ -287,7 +295,7 @@ EOF
       command = "yes yes | " + command
       command = "yes yes | " + command
         
         
     rel_cwd = setup_util.path_relative_to_root(cwd)
     rel_cwd = setup_util.path_relative_to_root(cwd)
-    print("INSTALL: %s (cwd=%s)" % (command, rel_cwd))
+    print("INSTALL: %s (cwd=$FWROOT%s)" % (command, rel_cwd))
 
 
     while attempt <= max_attempts:
     while attempt <= max_attempts:
       error_message = ""
       error_message = ""