From 0e21f9060d532770d2ae2a97c46b6dddde61896c Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Thu, 30 Sep 2021 05:05:30 +0200 Subject: [PATCH] small fixes --- cache.py | 2 +- chroot.py | 2 +- distro.py | 4 ++-- image.py | 2 +- packages.py | 7 ++++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cache.py b/cache.py index 10f5487..bc9fc67 100644 --- a/cache.py +++ b/cache.py @@ -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') diff --git a/chroot.py b/chroot.py index 132abbb..a855292 100644 --- a/chroot.py +++ b/chroot.py @@ -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') diff --git a/distro.py b/distro.py index e55c6e3..e7c829f 100644 --- a/distro.py +++ b/distro.py @@ -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 diff --git a/image.py b/image.py index 6c139d6..5c4b607 100644 --- a/image.py +++ b/image.py @@ -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') diff --git a/packages.py b/packages.py index 702c8ec..53f4e18 100644 --- a/packages.py +++ b/packages.py @@ -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