diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-26 18:58:41 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-26 18:58:41 +0100 |
commit | baf5ee1900551cc4992f66e50e4e6e21f50f57a7 (patch) | |
tree | 4ce8f35815025a13db93f41a2f2b9fc7248bdb5b | |
parent | Propagate some log levels from subprocesses. (diff) | |
download | aur-runner-baf5ee1900551cc4992f66e50e4e6e21f50f57a7.tar.gz aur-runner-baf5ee1900551cc4992f66e50e4e6e21f50f57a7.tar.xz |
Add possibility of options in package list.
-rwxr-xr-x | main.py | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -211,7 +211,20 @@ def main(): logger.fatal('Invalid key packages in package list') sys.exit(1) - pkgs = data.get('packages') + pkgs_ = data.get('packages') + + pkg_names = [] + pkg_options = {} + for pkg in pkgs_: + if type(pkg) == str: + pkg_names.append(pkg) + elif type(pkg) == dict: + pkg_names.append(pkg['name']) + pkg_options[pkg['name']] = pkg.get('options', '').split(' ') + else: + logger.fatal('Package entries must be string or dict, not %s', + type(pkg)) + sys.exit(1) # os.path.join discards earlier components whenever it finds an absolute path cachedir = os.path.join(os.getcwd(), get_conf('cache-dir')) @@ -225,7 +238,7 @@ def main(): path = get_conf('path') - repo_pkgs, aur_pkgs = gather_packages(pkgs) + repo_pkgs, aur_pkgs = gather_packages(pkg_names) if repo_pkgs: logger.info('Installing from the repos: %s', repo_pkgs) @@ -243,7 +256,8 @@ def main(): env = { 'PKGDEST': pkgdest, 'PATH': ':'.join(path), } - subprocess_with_log(['makepkg', *makepkg_args, '--install', *pacman_args], env=env, cwd=cwd) + extra_opts = pkg_options.get(package, []) + subprocess_with_log(['makepkg', *makepkg_args, *extra_opts, '--install', *pacman_args], env=env, cwd=cwd) if __name__ == '__main__': if os.getuid() == 0: |