From 1d0a97560b050c6ac5c5d3a3fa4512e000193d05 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sun, 4 Sep 2022 06:41:06 +0200 Subject: [PATCH] chroot.mount_pacman_cache(): use /var/cache/pacman/pkg to avoid problems while pacstrapping, adjust pacman.conf generator --- chroot/abstract.py | 9 +++++---- generator.py | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/chroot/abstract.py b/chroot/abstract.py index eb33346..8cf0902 100644 --- a/chroot/abstract.py +++ b/chroot/abstract.py @@ -256,12 +256,13 @@ class Chroot(AbstractChroot): ) def mount_pacman_cache(self, fail_if_mounted: bool = False) -> str: - arch_cache = os.path.join(config.get_path('pacman'), self.arch) - rel_target = os.path.join(CHROOT_PATHS['pacman'].lstrip('/'), self.arch) - makedir(arch_cache) + shared_cache = os.path.join(config.get_path('pacman'), self.arch) + rel_target = 'var/cache/pacman/pkg' + makedir(shared_cache) root_makedir(self.get_path(rel_target)) + print(self.get_path(rel_target)) return self.mount( - arch_cache, + shared_cache, rel_target, fail_if_mounted=fail_if_mounted, ) diff --git a/generator.py b/generator.py index 0200583..1ee867a 100644 --- a/generator.py +++ b/generator.py @@ -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 @@ -196,7 +196,7 @@ def generate_pacman_conf_body( check_space: 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''' # # /etc/pacman.conf @@ -211,7 +211,7 @@ def generate_pacman_conf_body( # If you wish to use different paths, uncomment and update the paths. #RootDir = / #DBPath = /var/lib/pacman/ -CacheDir = {pacman_cache}/{arch} +CacheDir = {pacman_cache} #LogFile = /var/log/pacman.log #GPGDir = /etc/pacman.d/gnupg/ #HookDir = /etc/pacman.d/hooks/