mirror of
https://github.com/truenas/scale-build.git
synced 2025-12-20 02:49:28 +00:00
Add relevant ccache env when building package
This commit is contained in:
@@ -53,11 +53,13 @@ class BuildPackageMixin:
|
|||||||
self._build_impl()
|
self._build_impl()
|
||||||
|
|
||||||
def _get_build_env(self):
|
def _get_build_env(self):
|
||||||
return {
|
env = {
|
||||||
**os.environ,
|
**os.environ,
|
||||||
**APT_ENV,
|
**APT_ENV,
|
||||||
**self.env,
|
**self.env,
|
||||||
}
|
}
|
||||||
|
env.update(self.ccache_env(env))
|
||||||
|
return env
|
||||||
|
|
||||||
def _build_impl(self):
|
def _build_impl(self):
|
||||||
shutil.copytree(self.source_path, self.source_in_chroot, dirs_exist_ok=True, symlinks=True)
|
shutil.copytree(self.source_path, self.source_in_chroot, dirs_exist_ok=True, symlinks=True)
|
||||||
|
|||||||
@@ -18,3 +18,13 @@ class CCacheMixin:
|
|||||||
@property
|
@property
|
||||||
def ccache_in_chroot(self) -> str:
|
def ccache_in_chroot(self) -> str:
|
||||||
return '/root/.ccache'
|
return '/root/.ccache'
|
||||||
|
|
||||||
|
def ccache_env(self, existing_env: dict) -> dict:
|
||||||
|
if not self.ccache_enabled:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
env = {'CCACHE_DIR': self.ccache_in_chroot}
|
||||||
|
if self.CCACHE_PATH not in existing_env['PATH'].split(':'):
|
||||||
|
env['PATH'] = f'{self.CCACHE_PATH}:{existing_env["PATH"]}'
|
||||||
|
|
||||||
|
return env
|
||||||
|
|||||||
Reference in New Issue
Block a user