small fixes

This commit is contained in:
InsanePrawn 2021-09-30 05:05:30 +02:00
parent 81f22e67ae
commit 0e21f9060d
5 changed files with 9 additions and 8 deletions

View file

@ -5,7 +5,7 @@ from config import config
from wrapper import enforce_wrap
import logging
PATHS = ['chroots', 'pacman', 'jumpdrive']
PATHS = ['chroots', 'pacman', 'jumpdrive', 'packages']
@click.group(name='cache')

View file

@ -101,7 +101,7 @@ def create_chroot_user(
if password:
install_script += f'echo "{user}:{password}" | chpasswd'
else:
install_script += 'passwd'
install_script += 'echo "Set user password:" && passwd'
result = run_chroot_cmd(install_script, chroot_name=chroot_name, chroot_base_path=chroot_base_path)
if result.returncode != 0:
raise Exception('Failed to setup user')

View file

@ -97,7 +97,7 @@ class Distro:
extras = [Repo(name, url_template=info.url_template, arch=self.arch, options=info.options, scan=False) for name, info in extra_repos.items()]
return '\n'.join(repo.config_snippet() for repo in (list(self.repos.values()) + extras))
def get_pacman_conf(self, extra_repos: dict[str, RepoInfo] = []):
def get_pacman_conf(self, extra_repos: dict[str, RepoInfo] = [], check_space=False):
header = f'''
#
# /etc/pacman.conf
@ -133,7 +133,7 @@ Architecture = {self.arch}
#UseSyslog
Color
#NoProgressBar
CheckSpace
{'' if check_space else '#'}CheckSpace
VerbosePkgLists
ParallelDownloads = 8

View file

@ -173,7 +173,7 @@ def cmd_build():
)
create_chroot_user(chroot_name, user=profile['username'], password=profile['password'])
if post_cmds:
result = run_chroot_cmd(' && '.join(post_cmds, chroot_name))
result = run_chroot_cmd(' && '.join(post_cmds), chroot_name)
if result.returncode != 0:
raise Exception('Error running post_cmds')

View file

@ -119,7 +119,7 @@ def check_prebuilts(dir: str = None):
def discover_packages(dir: str = None) -> dict[str, Package]:
dir = dir if dir else config.get_paths('pkgbuilds')
dir = dir if dir else config.get_path('pkgbuilds')
packages = {}
paths = []
@ -287,8 +287,9 @@ def check_package_version_built(package: Package) -> bool:
for line in result.stdout.decode('utf-8').split('\n'):
if line != "":
file = os.path.basename(line)
if not os.path.exists(os.path.join(config.get_path('packages'), package.repo, file)):
file = os.path.join(config.get_path('packages'), package.repo, os.path.basename(line))
logging.debug(f'Checking if {file} is built')
if not os.path.exists(file):
built = False
return built