Some ccache bits.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Apr 2019 08:46:14 +0000 (09:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 Apr 2019 08:46:14 +0000 (09:46 +0100)
cdist

diff --git a/cdist b/cdist
index 9d8e146d0610d7b3020def0e1c2676467a516bbe..56e0527d056fd02ff5d4e2452df37d1c2ae21101 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -519,6 +519,8 @@ class DockerTarget(Target):
             opts += '-v %s:%s ' % (m, m)
         if self.privileged:
             opts += '--privileged=true '
+        if self.ccache:
+            opts += "-e CCACHE_DIR=/ccache --volumes-from ccache-%s" % self.image
         self.container = command_and_read('%s run -u %s %s -itd %s /bin/bash' % (config.docker(), getpass.getuser(), opts, self.image)).read().strip()
 
     def command(self, cmd):
@@ -653,6 +655,12 @@ class LinuxTarget(DockerTarget):
         else:
             self.image = '%s-%s-%s' % (self.distro, self.version, self.bits)
 
+    def setup(self):
+        super(LinuxTarget, self).setup()
+        if self.ccache:
+            self.set('CC', '"ccache gcc"')
+            self.set('CXX', '"ccache g++"')
+
     def test(self, tree, test, options):
         self.append_with_colon('PATH', '%s/bin' % self.directory)
         self.append_with_colon('LD_LIBRARY_PATH', '%s/lib' % self.directory)