phase1: set CCACHE_BASEDIR
authorJo-Philipp Wich <jo@mein.io>
Mon, 23 Jan 2017 13:24:58 +0000 (14:24 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 23 Jan 2017 13:25:01 +0000 (14:25 +0100)
Add CCACHE_BASEDIR to default environment in order to improve cache hit rate
for the global shared cache.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/master.cfg

index 695973f8e0da85a1adbc182404a7ce53a6e3208b..632294f65c096233622e0c0fae5a7b074b94052f 100644 (file)
@@ -238,10 +238,19 @@ def GetCXX(props):
        else:
                return "g++"
 
+def GetCwd(props):
+       if props.hasProperty("builddir"):
+               return props["builddir"]
+       elif props.hasProperty("workdir"):
+               return props["workdir"]
+       else:
+               return "/"
+
 def MakeEnv(overrides=None):
        env = {
                'CC': WithProperties("%(cc)s", cc=GetCC),
-               'CXX': WithProperties("%(cxx)s", cxx=GetCXX)
+               'CXX': WithProperties("%(cxx)s", cxx=GetCXX),
+               'CCACHE_BASEDIR': WithProperties("%(cwd)s", cwd=GetCwd)
        }
        if overrides is not None:
                env.update(overrides)