config: introduce pacman.check_space, use it in chroot.write_pacman_conf()

This commit is contained in:
InsanePrawn 2022-08-10 15:28:17 +02:00
parent 97c1bd1f74
commit fe6fd7dfb5
3 changed files with 5 additions and 2 deletions

View file

@ -287,7 +287,9 @@ class Chroot(AbstractChroot):
f.write(makepkg_cross_conf) f.write(makepkg_cross_conf)
return makepkg_conf_path_relative return makepkg_conf_path_relative
def write_pacman_conf(self, check_space: bool = False): def write_pacman_conf(self, check_space: Optional[bool] = None):
if check_space is None:
check_space = config.file['pacman']['check_space']
os.makedirs(self.get_path('/etc'), exist_ok=True) os.makedirs(self.get_path('/etc'), exist_ok=True)
conf_text = get_base_distro(self.arch).get_pacman_conf(self.extra_repos, check_space=check_space) conf_text = get_base_distro(self.arch).get_pacman_conf(self.extra_repos, check_space=check_space)
with open(self.get_path('etc/pacman.conf'), 'w') as file: with open(self.get_path('etc/pacman.conf'), 'w') as file:

View file

@ -21,7 +21,7 @@ class BaseChroot(Chroot):
for dir in glob(os.path.join(self.path, '*')): for dir in glob(os.path.join(self.path, '*')):
rmtree(dir) rmtree(dir)
self.write_pacman_conf(check_space=True) self.write_pacman_conf()
self.mount_pacman_cache() self.mount_pacman_cache()
logging.info(f'Pacstrapping chroot {self.name}: {", ".join(self.base_packages)}') logging.info(f'Pacstrapping chroot {self.name}: {", ".join(self.base_packages)}')

View file

@ -57,6 +57,7 @@ CONFIG_DEFAULTS: dict = {
}, },
'pacman': { 'pacman': {
'parallel_downloads': 4, 'parallel_downloads': 4,
'check_space': True,
'repo_branch': DEFAULT_PACKAGE_BRANCH, 'repo_branch': DEFAULT_PACKAGE_BRANCH,
}, },
'paths': { 'paths': {