config: introduce rust cache
This commit is contained in:
parent
4285cf734c
commit
2ef5f27c6c
4 changed files with 20 additions and 0 deletions
|
@ -142,6 +142,20 @@ class BuildChroot(Chroot):
|
||||||
fail_if_mounted=fail_if_mounted,
|
fail_if_mounted=fail_if_mounted,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def mount_rust(self, user: str = 'kupfer', fail_if_mounted: bool = False) -> list[str]:
|
||||||
|
results = []
|
||||||
|
mount_source_base = config.file.paths.rust # apparently arch-agnostic
|
||||||
|
for rust_dir in ['cargo', 'rustup']:
|
||||||
|
mount_source = os.path.join(mount_source_base, rust_dir)
|
||||||
|
mount_dest = os.path.join(f'/home/{user}' if user != 'root' else '/root', f'.{rust_dir}')
|
||||||
|
makedir(mount_source)
|
||||||
|
results.append(self.mount(
|
||||||
|
absolute_source=mount_source,
|
||||||
|
relative_destination=mount_dest,
|
||||||
|
fail_if_mounted=fail_if_mounted,
|
||||||
|
))
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def get_build_chroot(arch: Arch, add_kupfer_repos: bool = True, **kwargs) -> BuildChroot:
|
def get_build_chroot(arch: Arch, add_kupfer_repos: bool = True, **kwargs) -> BuildChroot:
|
||||||
name = build_chroot_name(arch)
|
name = build_chroot_name(arch)
|
||||||
|
|
|
@ -142,6 +142,7 @@ class PathsSection(DataClass):
|
||||||
jumpdrive: str
|
jumpdrive: str
|
||||||
images: str
|
images: str
|
||||||
ccache: str
|
ccache: str
|
||||||
|
rust: str
|
||||||
|
|
||||||
|
|
||||||
class ProfilesSection(DataClass):
|
class ProfilesSection(DataClass):
|
||||||
|
|
|
@ -43,6 +43,7 @@ CONFIG_DEFAULTS_DICT = {
|
||||||
'jumpdrive': os.path.join('%cache_dir%', 'jumpdrive'),
|
'jumpdrive': os.path.join('%cache_dir%', 'jumpdrive'),
|
||||||
'images': os.path.join('%cache_dir%', 'images'),
|
'images': os.path.join('%cache_dir%', 'images'),
|
||||||
'ccache': os.path.join('%cache_dir%', 'ccache'),
|
'ccache': os.path.join('%cache_dir%', 'ccache'),
|
||||||
|
'rust': os.path.join('%cache_dir%', 'rust'),
|
||||||
},
|
},
|
||||||
'profiles': {
|
'profiles': {
|
||||||
'current': 'default',
|
'current': 'default',
|
||||||
|
|
|
@ -461,6 +461,8 @@ def build_package(
|
||||||
repo_dir = repo_dir if repo_dir else config.get_path('pkgbuilds')
|
repo_dir = repo_dir if repo_dir else config.get_path('pkgbuilds')
|
||||||
foreign_arch = config.runtime.arch != arch
|
foreign_arch = config.runtime.arch != arch
|
||||||
deps = (list(set(package.depends) - set(package.names())))
|
deps = (list(set(package.depends) - set(package.names())))
|
||||||
|
needs_rust = 'rust' in deps
|
||||||
|
build_root: BuildChroot
|
||||||
target_chroot = setup_build_chroot(
|
target_chroot = setup_build_chroot(
|
||||||
arch=arch,
|
arch=arch,
|
||||||
extra_packages=deps,
|
extra_packages=deps,
|
||||||
|
@ -517,6 +519,8 @@ def build_package(
|
||||||
|
|
||||||
if enable_ccache:
|
if enable_ccache:
|
||||||
build_root.mount_ccache(user=build_user)
|
build_root.mount_ccache(user=build_user)
|
||||||
|
if needs_rust:
|
||||||
|
build_root.mount_rust(user=build_user)
|
||||||
setup_git_insecure_paths(build_root)
|
setup_git_insecure_paths(build_root)
|
||||||
makepkg_conf_absolute = os.path.join('/', makepkg_conf_path)
|
makepkg_conf_absolute = os.path.join('/', makepkg_conf_path)
|
||||||
setup_sources(package, build_root, makepkg_conf_path=makepkg_conf_absolute)
|
setup_sources(package, build_root, makepkg_conf_path=makepkg_conf_absolute)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue