Skip to content

Commit

Permalink
Merge pull request #87 from getsolus/ccache-basedir
Browse files Browse the repository at this point in the history
ccache: Set CCACHE_BASEDIR to improve hit rates
  • Loading branch information
ReillyBrogan authored Jun 28, 2024
2 parents d383f0c + 1c30b03 commit 1646c62
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ypkg2/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ def init_default_exports(self):
if self.context.build.ccache and self.spec.pkg_ccache:
self.define_export("RUSTC_WRAPPER", "/usr/bin/sccache")

# Source archives often have the version string as part of the file name which results in the version string
# being part of the workdir path. Since ccache uses the file path as part of the cache key this can result in
# very low cache hit rates when upgrading versions if the build references files via absolute paths. Luckily
# ccache allows us to set the base_dir to avoid this problem which we can set as an environmental variable.
# Ref: https://ccache.dev/manual/4.10.html#_compiling_in_different_directories
if self.context.build.ccache and self.spec.pkg_ccache:
self.define_export("CCACHE_BASEDIR", "%workdir%")

if not console_ui.allow_colors:
self.define_export("TERM", "dumb")

Expand Down

0 comments on commit 1646c62

Please # to comment.