From 684a072ebabef55978fe5231a51d547dd7d3bdeb Mon Sep 17 00:00:00 2001 From: Hamilton Turner Date: Sun, 6 Jul 2014 06:58:35 -0400 Subject: [PATCH] Enable framework-specific install directories and environment This commit is my proof-of concept, only the 'go' test works right now. You can look at go/ to see the changes required on a per-framework basis - essentially I've modified go/setup.py to move the declaration of the environment into go/bash_profile.sh Each framework now gets a personal /installs directory, and can declare any needed environment variables in /bash_profile.sh, such as modifications to the PATH. The FwBm code now provides an FWROOT environment variable to *all* shell scripts (instead of ~/Frameworks being assumed). Also, an IROOT environment variable is provided to any framework-specific files (e.g. install.sh and bash_profile.sh) for the location of the install directory for that framework. See go/bash_profile.sh to see me using both IROOT and FWROOT. By using IROOT, the strategy for installation is still controlled by python code and the frameworks just reference IROOT and FWROOT in their scripts. These variables are a nice step towards solving #448 The new function replace_environ in setup_util.py goes a long way towards addressing #899 - as you can see I've removed all the changes to the ~/.bash_profile from prerequisites.sh (and this commit serves as proof that everything still works) and most of the changes from config/benchmark_profile --- go/bash_profile.sh | 5 ++--- toolset/benchmark/framework_test.py | 1 - toolset/run-tests.py | 2 +- toolset/setup/linux/installer.py | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/go/bash_profile.sh b/go/bash_profile.sh index aece91be42de..5dbfbca47e23 100644 --- a/go/bash_profile.sh +++ b/go/bash_profile.sh @@ -1,7 +1,6 @@ -# Set the root of our go installation -export GOROOT=${IROOT}/go +# IROOT=${FWROOT}/go/installs -# Where to find the go executable +export GOROOT=${IROOT}/go export PATH="$GOROOT/bin:$PATH" export GOPATH=${FWROOT}/go diff --git a/toolset/benchmark/framework_test.py b/toolset/benchmark/framework_test.py index 66637c0da1c2..b9a19e7aac22 100644 --- a/toolset/benchmark/framework_test.py +++ b/toolset/benchmark/framework_test.py @@ -296,7 +296,6 @@ def start(self, out, err): set_iroot="export IROOT=%s" % self.install_root setup_util.replace_environ(config=profile, command=set_iroot) - return self.setup_module.start(self.benchmarker, out, err) ############################################################ # End start diff --git a/toolset/run-tests.py b/toolset/run-tests.py index 85655deaba81..2225b3d52e00 100755 --- a/toolset/run-tests.py +++ b/toolset/run-tests.py @@ -31,7 +31,7 @@ def main(argv=None): fwroot = setup_util.get_fwroot() if not fwroot: fwroot = os.getcwd() - setup_util.replace_environ(config='config/benchmark_profile', root=fwroot) + setup_util.replace_environ(config='config/benchmark_profile', root=os.getcwd()) print "FWROOT is %s"%setup_util.get_fwroot() conf_parser = argparse.ArgumentParser( diff --git a/toolset/setup/linux/installer.py b/toolset/setup/linux/installer.py index d6ae98c54bb8..87f328310cfe 100644 --- a/toolset/setup/linux/installer.py +++ b/toolset/setup/linux/installer.py @@ -68,6 +68,7 @@ def __install_server_software(self): if self.strategy is 'pertest': test_install_dir="%s/pertest/%s" % (test_install_dir, test_name) test_rel_install_dir=setup_util.path_relative_to_root(test_install_dir) + if not os.path.exists(test_install_dir): os.makedirs(test_install_dir) @@ -338,6 +339,20 @@ def __bash_from_string(self, command): # End __bash_from_string ############################################################ + ############################################################ + # __path_relative_to_root + # Returns path minus the FWROOT prefix. Useful for clean + # presentation of paths + # e.g. /foo/bar/benchmarks/go/bash_profile.sh + # v.s. FWROOT/go/bash_profile.sh + ############################################################ + def __path_relative_to_root(self, path): + # Requires bash shell parameter expansion + return subprocess.check_output("D=%s && printf ${D#%s}"%(path, self.root), shell=True, executable='/bin/bash') + ############################################################ + # End __path_relative_to_root + ############################################################ + ############################################################ # __download # Downloads a file from a URI.