summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael E Brown <michael_e_brown@dell.com>2007-10-18 12:29:03 -0500
committerMichael E Brown <michael_e_brown@dell.com>2007-10-18 12:29:03 -0500
commitdf52677aa49d314559c3e6961d01ef4da3067ac5 (patch)
treef6c78f66235e61f81eecba64c83d154112b96fa0 /src
parent200e3a13bebbde04c88ee9757212bed858bed35d (diff)
downloadmock-df52677aa49d314559c3e6961d01ef4da3067ac5.tar.gz
mock-df52677aa49d314559c3e6961d01ef4da3067ac5.tar.xz
mock-df52677aa49d314559c3e6961d01ef4da3067ac5.zip
get ccache working
Diffstat (limited to 'src')
-rw-r--r--src/py-libs/backend.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/py-libs/backend.py b/src/py-libs/backend.py
index c247c61..4998872 100644
--- a/src/py-libs/backend.py
+++ b/src/py-libs/backend.py
@@ -332,6 +332,21 @@ class Root(object):
self.umountCmds.append('umount -n %s/tmp/ccache' % self.rootdir)
self.mountCmds.append('mount -n --bind %s %s/tmp/ccache' % (self.ccachePath, self.rootdir))
os.environ['PATH'] = "/tmp/ccache:%s" % (os.environ['PATH'])
+ os.environ['CCACHE_DIR'] = "/tmp/ccache"
+ os.environ['CCACHE_UMASK'] = "002"
+ self._dumpToFile(os.path.join(self.ccachePath, "cc"), '#!/bin/sh\nexec ccache /usr/bin/cc "$@"\n', mode=0555)
+ self._dumpToFile(os.path.join(self.ccachePath, "gcc"), '#!/bin/sh\nexec ccache /usr/bin/gcc "$@"\n', mode=0555)
+ self._dumpToFile(os.path.join(self.ccachePath, "g++"), '#!/bin/sh\nexec ccache /usr/bin/g++ "$@"\n', mode=0555)
+ self._yum('install ccache')
+
+ @traceLog(moduleLog)
+ def _dumpToFile(self, filename, contents, *args, **kargs):
+ fd = open(filename, "w+")
+ fd.write(contents)
+ fd.close()
+ mode = kargs.get("mode", None)
+ if mode is not None:
+ os.chmod(filename, mode)
@traceLog(moduleLog)
def _mountall(self):