Skip to content

Commit

Permalink
Add hashdir option to ccache plugin
Browse files Browse the repository at this point in the history
Setting it to false allows ccache to be shared across different package NEVRs, but the debuginfo files may contain incorrect information in exchange:
https://ccache.dev/manual/4.10.html#config_hash_dir
  • Loading branch information
belegdol committed Jul 12, 2024
1 parent f9c2691 commit 054c609
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/Plugin-CCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The ccache plugin is enabled by default and has the following values built-in:
config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G'
config_opts['plugin_conf']['ccache_opts']['compress'] = None
config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/ccache/u%(chrootuid)s/"
config_opts['plugin_conf']['ccache_opts']['hashdir'] = True

To turn on ccache compression, use the following in a config file:

Expand Down
1 change: 1 addition & 0 deletions mock/docs/site-defaults.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G'
# config_opts['plugin_conf']['ccache_opts']['compress'] = None
# config_opts['plugin_conf']['ccache_opts']['dir'] = "{{cache_topdir}}/{{root}}/ccache/u{{chrootuid}}/"
# config_opts['plugin_conf']['ccache_opts']['hashdir'] = True
# config_opts['plugin_conf']['yum_cache_enable'] = True
# config_opts['plugin_conf']['yum_cache_opts'] = {}
# config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30
Expand Down
3 changes: 2 additions & 1 deletion mock/py/mockbuild/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def setup_default_config_opts():
'ccache_opts': {
'max_cache_size': "4G",
'compress': None,
'dir': "{{cache_topdir}}/{{root}}/ccache/u{{chrootuid}}/"},
'dir': "{{cache_topdir}}/{{root}}/ccache/u{{chrootuid}}/",
'hashdir': True},
'yum_cache_enable': True,
'yum_cache_opts': {
'max_age_days': 30,
Expand Down
4 changes: 4 additions & 0 deletions mock/py/mockbuild/plugins/ccache.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def _ccachePreInitHook(self):
envupd = {"CCACHE_DIR": "/var/tmp/ccache", "CCACHE_UMASK": "002"}
if self.ccache_opts.get('compress') is not None:
envupd["CCACHE_COMPRESS"] = str(self.ccache_opts['compress'])
if self.ccache_opts.get('hashdir'):
envupd["CCACHE_HASHDIR"] = "1"
else:
envupd["CCACHE_NOHASHDIR"] = "1"
self.buildroot.env.update(envupd)

file_util.mkdirIfAbsent(self.buildroot.make_chroot_path('/var/tmp/ccache'))
Expand Down
7 changes: 7 additions & 0 deletions releng/release-notes-next/hashdir.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A new option `hashdir` has been [added][PR#1399] to the ccache plugin. Setting
it to false the build working directory from the hash used to distinguish two
compilations when generating debuginfo. While this allows the compiler cache
to be shared across different package NEVRs, it might cause the debuginfo to be
incorrect.
The option can be used for issue bisecting if running the debugger is
unnecessary. ([issue#1395][])

0 comments on commit 054c609

Please sign in to comment.