summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-26 18:58:41 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-26 18:58:41 +0100
commitbaf5ee1900551cc4992f66e50e4e6e21f50f57a7 (patch)
tree4ce8f35815025a13db93f41a2f2b9fc7248bdb5b
parentPropagate some log levels from subprocesses. (diff)
downloadaur-runner-baf5ee1900551cc4992f66e50e4e6e21f50f57a7.tar.gz
aur-runner-baf5ee1900551cc4992f66e50e4e6e21f50f57a7.tar.xz
Add possibility of options in package list.
-rwxr-xr-xmain.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/main.py b/main.py
index 122cfd9..2c7fc9f 100755
--- a/main.py
+++ b/main.py
@@ -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: