MockModuleBuilder: Share root cache between threads

The different build threads all are using the same basic build root
contents, so there's no reason to use separate caches - point the
root cache plugin for mock to a single location. (There's locking
inside Mock for updating the root cache.)
This commit is contained in:
Owen W. Taylor
2020-11-16 11:32:49 -05:00
committed by breilly
parent f09d7cfe7f
commit 48c4c75d73

View File

@@ -6,6 +6,7 @@ import os
import pipes
import re
import subprocess
from textwrap import dedent
import threading
import dnf
@@ -483,6 +484,11 @@ class MockModuleBuilder(GenericBuilder):
config = config.replace("$enabled_modules", str(self.enabled_modules))
config = config.replace("$releasever", str(self.releasever))
config += dedent("""\
config_opts.setdefault('plugin_conf', {})
config_opts['plugin_conf'].setdefault('root_cache_opts', {})
config_opts['plugin_conf']['root_cache_opts']['dir'] = "{{cache_topdir}}/%s/root_cache/"
""") % self.tag_name
mock_cfg_path = os.path.join(self.configdir, "mock.cfg")
if update_main or not os.path.exists(mock_cfg_path):