This is an automated email from the ASF dual-hosted git repository.
jacksontj pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver-qa.git
The following commit(s) were added to refs/heads/master by this push:
new f3e71b1 add `build_dir` parameter to EnvironmentFactory
f3e71b1 is described below
commit f3e71b162b99493d0123eb1872e2bdfe1e541904
Author: Thomas Jackson <[email protected]>
AuthorDate: Mon Apr 11 22:07:53 2016 -0700
add `build_dir` parameter to EnvironmentFactory
This allows us to use a build_dir more than once, to leverage previously
compiled files. This is immensely helpful for iterating on builds locally-- so
we don't have to rebuild the world
---
tsqa/environment.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tsqa/environment.py b/tsqa/environment.py
index 9e81186..c356949 100644
--- a/tsqa/environment.py
+++ b/tsqa/environment.py
@@ -47,7 +47,8 @@ class EnvironmentFactory(object):
source_dir,
env_cache_dir,
default_configure=None,
- default_env=None):
+ default_env=None,
+ build_dir=None):
# if no one made the cache class, make it
if self.class_environment_stash is None:
self.class_environment_stash = tsqa.utils.BuildCache(env_cache_dir)
@@ -66,6 +67,8 @@ class EnvironmentFactory(object):
else:
self.default_env = copy.copy(os.environ)
+ self.build_dir = build_dir
+
def autoreconf(self):
'''
Autoreconf to make the configure script
@@ -150,7 +153,9 @@ class EnvironmentFactory(object):
raise EnvironmentFactory.negative_cache[key]
try:
self.autoreconf()
- builddir = tempfile.mkdtemp()
+ # if we have a build dir configured, lets use thatm otherwise
+ # lets use a tmp one
+ builddir = self.build_dir or tempfile.mkdtemp()
kwargs = {
'cwd': builddir,
@@ -177,7 +182,9 @@ class EnvironmentFactory(object):
# make install
tsqa.utils.run_sync_command(['make', 'install',
'DESTDIR={0}'.format(installdir)], **kwargs)
- shutil.rmtree(builddir) # delete builddir, not useful after
install
+ # if we had to create a tmp dir, we should delete it
+ if self.build_dir is None:
+ shutil.rmtree(builddir)
# stash the env
self.environment_stash[key] = {
'path': installdir,
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].