chroot.mount_pacman_cache(): use /var/cache/pacman/pkg to avoid problems while pacstrapping, adjust pacman.conf generator

This commit is contained in:
InsanePrawn 2022-09-04 06:41:06 +02:00
parent 6c269080d6
commit 1d0a97560b
2 changed files with 8 additions and 7 deletions

View file

@ -256,12 +256,13 @@ class Chroot(AbstractChroot):
) )
def mount_pacman_cache(self, fail_if_mounted: bool = False) -> str: def mount_pacman_cache(self, fail_if_mounted: bool = False) -> str:
arch_cache = os.path.join(config.get_path('pacman'), self.arch) shared_cache = os.path.join(config.get_path('pacman'), self.arch)
rel_target = os.path.join(CHROOT_PATHS['pacman'].lstrip('/'), self.arch) rel_target = 'var/cache/pacman/pkg'
makedir(arch_cache) makedir(shared_cache)
root_makedir(self.get_path(rel_target)) root_makedir(self.get_path(rel_target))
print(self.get_path(rel_target))
return self.mount( return self.mount(
arch_cache, shared_cache,
rel_target, rel_target,
fail_if_mounted=fail_if_mounted, fail_if_mounted=fail_if_mounted,
) )

View file

@ -1,4 +1,4 @@
from constants import Arch, GCC_HOSTSPECS, CFLAGS_GENERAL, CFLAGS_ARCHES, COMPILE_ARCHES, CHROOT_PATHS from constants import Arch, CFLAGS_ARCHES, CFLAGS_GENERAL, COMPILE_ARCHES, GCC_HOSTSPECS
from config import config from config import config
@ -196,7 +196,7 @@ def generate_pacman_conf_body(
check_space: bool = True, check_space: bool = True,
in_chroot: bool = True, in_chroot: bool = True,
): ):
pacman_cache = config.get_path('pacman') if not in_chroot else CHROOT_PATHS['pacman'] pacman_cache = f"{config.get_path('pacman')}/{arch}" if not in_chroot else '/var/cache/pacman/pkg'
return f''' return f'''
# #
# /etc/pacman.conf # /etc/pacman.conf
@ -211,7 +211,7 @@ def generate_pacman_conf_body(
# If you wish to use different paths, uncomment and update the paths. # If you wish to use different paths, uncomment and update the paths.
#RootDir = / #RootDir = /
#DBPath = /var/lib/pacman/ #DBPath = /var/lib/pacman/
CacheDir = {pacman_cache}/{arch} CacheDir = {pacman_cache}
#LogFile = /var/log/pacman.log #LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/ #GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/ #HookDir = /etc/pacman.d/hooks/