if self.data.builder_id:
return self.backend.builders.get_by_id(self.data.builder_id)
+ @property
+ def ccache_enabled(self):
+ """
+ Should the ccache be enabled for this build?
+ """
+ # Enable the cache for scratch builds
+ if self.build.owner:
+ return True
+
+ # Enable the cache for test builds
+ if self.test:
+ return True
+
+ # Otherwise disable the ccache
+ return False
+
+ @property
+ def ccache_path(self):
+ """
+ Returns the path to a private ccache
+ """
+ # Return nothing if the ccache should not be used
+ if not self.ccache_enabled:
+ return
+
+ # Include the name of the package and the architecture
+ path = os.path.join(
+ self.build.pkg.name,
+ self.arch,
+ )
+
+ if self.build.owner:
+ path = os.path.join(
+ "~%s" % self.build.owner.name,
+ path,
+ )
+
+ return path
+
@property
def arch(self):
return self.data.arch