Repository: trafficserver-qa Updated Branches: refs/heads/master e9e451a1b -> f3e71b162
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 Project: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/commit/f3e71b16 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/tree/f3e71b16 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver-qa/diff/f3e71b16 Branch: refs/heads/master Commit: f3e71b162b99493d0123eb1872e2bdfe1e541904 Parents: e9e451a Author: Thomas Jackson <[email protected]> Authored: Mon Apr 11 22:07:53 2016 -0700 Committer: Thomas Jackson <[email protected]> Committed: Mon Apr 11 22:07:53 2016 -0700 ---------------------------------------------------------------------- tsqa/environment.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver-qa/blob/f3e71b16/tsqa/environment.py ---------------------------------------------------------------------- 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,
