from buildbot.steps.source.git import Git
from buildbot.steps.shell import ShellCommand
from buildbot.steps.shell import SetProperty
+from buildbot.steps.shell import SetPropertyFromCommand
from buildbot.steps.transfer import FileUpload
from buildbot.steps.transfer import FileDownload
from buildbot.steps.master import MasterShellCommand
else:
return "/"
+def GetCCache(props):
+ if props.hasProperty("ccache_command") and "ccache" in props["ccache_command"]:
+ return props["ccache_command"] + " "
+ else:
+ return ""
+
def GetNextBuild(builder, requests):
for r in requests:
if r.properties and r.properties.hasProperty("tag"):
return r
return requests[0]
-def MakeEnv(overrides=None):
+def MakeEnv(overrides=None, tryccache=False):
+ if tryccache:
+ envcc = Interpolate("%(kw:ccache)s%(kw:cc)s", ccache=GetCCache, cc=GetCC)
+ envcxx = Interpolate("%(kw:ccache)s%(kw:cxx)s", ccache=GetCCache, cxx=GetCXX)
+ else:
+ envcc = Interpolate("%(kw:cc)s", cc=GetCC)
+ envcxx = Interpolate("%(kw:cxx)s", cxx=GetCXX)
env = {
- 'CC': WithProperties("%(cc)s", cc=GetCC),
- 'CXX': WithProperties("%(cxx)s", cxx=GetCXX),
- 'CCACHE_BASEDIR': WithProperties("%(cwd)s", cwd=GetCwd)
+ 'CC': envcc,
+ 'CXX': envcxx,
+ 'CCACHE_BASEDIR': Interpolate("%(kw:cwd)s", cwd=GetCwd)
}
if overrides is not None:
env.update(overrides)
command = ["../findbin.pl", "g++", cc_version[0], cc_version[1]],
haltOnFailure = True))
+ # see if ccache is available
+ factory.addStep(SetPropertyFromCommand(
+ property = "ccache_command",
+ command = ["which", "ccache"],
+ description = "Testing for ccache command",
+ haltOnFailure = False,
+ flunkOnFailure = False,
+ warnOnFailure = False,
+ ))
+
# expire tree if needed
if tree_expire > 0:
factory.addStep(FileDownload(
name = "dltar",
description = "Building and installing GNU tar",
command = ["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "tools/tar/compile", "V=s"],
- env = MakeEnv(),
+ env = MakeEnv(tryccache=True),
haltOnFailure = True
))
name = "tools",
description = "Building and installing tools",
command = ["make", WithProperties("-j%(jobs)d", jobs=GetNumJobs), "tools/install", "V=s"],
- env = MakeEnv(),
+ env = MakeEnv(tryccache=True),
haltOnFailure = True
))