diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-13 15:19:54 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-03-13 15:19:54 +0000 |
commit | 42b2a27da193ecc409b811c530e1faf3f1e342c8 (patch) | |
tree | c913cbfc8e3ee2e1084f193d26a561278c374851 /morphlib/builder.py | |
parent | 981c3c5c40bc5a566b56034b35713b9090867105 (diff) | |
download | morph-42b2a27da193ecc409b811c530e1faf3f1e342c8.tar.gz |
morphlib.builder.Builder: fix sharing env
Previous change would share the same environment between all Builders
this may not have broken anything yet, but this change in behaviour
was unintentional.
The relevant cache keys are not altered by Builders and they are set
at the time the Builder is created, so the build string can be cached
rather than generated every time a cache key is needed
Diffstat (limited to 'morphlib/builder.py')
-rw-r--r-- | morphlib/builder.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index a0805e06..c35d0c41 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -542,7 +542,11 @@ class Builder(object): # pragma: no cover self.source_manager = source_manager self.factory = factory self.indent = 0 - self.env = app.clean_env() + # create build environment string in advance + env_names = ("USER", "USERNAME", "LOGNAME", + "TOOLCHAIN_TARGET", "BOOTSTRAP") + env = app.clean_env() + self.build_env = ''.join(k + env[k] for k in env_names) def msg(self, text): spaces = ' ' * self.indent @@ -660,7 +664,8 @@ class Builder(object): # pragma: no cover (str(blob), type(blob))) builder = klass(blob, self.factory, self.app.settings, self.cachedir, - self.get_cache_id(blob), self.tempdir, self.env) + self.get_cache_id(blob), self.tempdir, + self.app.clean_env()) builder.real_msg = self.msg builder.dump_memory_profile = self.dump_memory_profile @@ -697,14 +702,12 @@ class Builder(object): # pragma: no cover raise NotImplementedError('unknown morph kind %s' % blob.morph.kind) - build_env = ("USER", "USERNAME", "LOGNAME", - "TOOLCHAIN_TARGET", "BOOTSTRAP") dict_key = { 'name': blob.morph.name, 'arch': morphlib.util.arch(), 'ref': blob.morph.treeish.sha1, 'kids': ''.join(self.cachedir.key(k) for k in kids), - 'env': ''.join(k + self.env[k] for k in build_env), + 'env': self.build_env, } return dict_key |