mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
config: introduce rust cache
This commit is contained in:
parent
47e74fb415
commit
a3ec35bcd6
4 changed files with 20 additions and 0 deletions
|
@ -142,6 +142,20 @@ class BuildChroot(Chroot):
|
|||
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:
|
||||
name = build_chroot_name(arch)
|
||||
|
|
|
@ -142,6 +142,7 @@ class PathsSection(DataClass):
|
|||
jumpdrive: str
|
||||
images: str
|
||||
ccache: str
|
||||
rust: str
|
||||
|
||||
|
||||
class ProfilesSection(DataClass):
|
||||
|
|
|
@ -43,6 +43,7 @@ CONFIG_DEFAULTS_DICT = {
|
|||
'jumpdrive': os.path.join('%cache_dir%', 'jumpdrive'),
|
||||
'images': os.path.join('%cache_dir%', 'images'),
|
||||
'ccache': os.path.join('%cache_dir%', 'ccache'),
|
||||
'rust': os.path.join('%cache_dir%', 'rust'),
|
||||
},
|
||||
'profiles': {
|
||||
'current': 'default',
|
||||
|
|
|
@ -461,6 +461,8 @@ def build_package(
|
|||
repo_dir = repo_dir if repo_dir else config.get_path('pkgbuilds')
|
||||
foreign_arch = config.runtime.arch != arch
|
||||
deps = (list(set(package.depends) - set(package.names())))
|
||||
needs_rust = 'rust' in deps
|
||||
build_root: BuildChroot
|
||||
target_chroot = setup_build_chroot(
|
||||
arch=arch,
|
||||
extra_packages=deps,
|
||||
|
@ -517,6 +519,8 @@ def build_package(
|
|||
|
||||
if enable_ccache:
|
||||
build_root.mount_ccache(user=build_user)
|
||||
if needs_rust:
|
||||
build_root.mount_rust(user=build_user)
|
||||
setup_git_insecure_paths(build_root)
|
||||
makepkg_conf_absolute = os.path.join('/', makepkg_conf_path)
|
||||
setup_sources(package, build_root, makepkg_conf_path=makepkg_conf_absolute)
|
||||
|
|
Loading…
Add table
Reference in a new issue