mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Portage module improvements (#3520)
* packaging/os/portage.py: Added portage parameter --keep-going * packaging/os/portage.py: Added portage parameter --load-avg [FLOAT] * packaging/os/portage.py: Added portage parameter --jobs[=INT] * packaging/os/portage.py: Added myself to Authors
This commit is contained in:
parent
380ce0c3a7
commit
e95641f371
1 changed files with 44 additions and 1 deletions
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# (c) 2016, William L Thomson Jr
|
||||||
# (c) 2013, Yap Sok Ann
|
# (c) 2013, Yap Sok Ann
|
||||||
# Written by Yap Sok Ann <sokann@gmail.com>
|
# Written by Yap Sok Ann <sokann@gmail.com>
|
||||||
|
# Modified by William L. Thomson Jr. <wlt@o-sinc.com>
|
||||||
# Based on apt module written by Matthew Williams <matthew@flowroute.com>
|
# Based on apt module written by Matthew Williams <matthew@flowroute.com>
|
||||||
#
|
#
|
||||||
# This module is free software: you can redistribute it and/or modify
|
# This module is free software: you can redistribute it and/or modify
|
||||||
|
@ -146,8 +148,36 @@ options:
|
||||||
default: False
|
default: False
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
|
|
||||||
|
keepgoing:
|
||||||
|
description:
|
||||||
|
- Continue as much as possible after an error.
|
||||||
|
required: false
|
||||||
|
default: False
|
||||||
|
choices: [ "yes", "no" ]
|
||||||
|
version_added: 2.3
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
description:
|
||||||
|
- Specifies the number of packages to build simultaneously.
|
||||||
|
required: false
|
||||||
|
default: None
|
||||||
|
type: int
|
||||||
|
version_added: 2.3
|
||||||
|
|
||||||
|
loadavg:
|
||||||
|
description:
|
||||||
|
- Specifies that no new builds should be started if there are
|
||||||
|
- other builds running and the load average is at least LOAD
|
||||||
|
required: false
|
||||||
|
default: None
|
||||||
|
type: float
|
||||||
|
version_added: 2.3
|
||||||
|
|
||||||
requirements: [ gentoolkit ]
|
requirements: [ gentoolkit ]
|
||||||
author: Yap Sok Ann, Andrew Udvare
|
author:
|
||||||
|
- "William L Thomson Jr (@wltjr)"
|
||||||
|
- "Yap Sok Ann (@sayap)"
|
||||||
|
- "Andrew Udvare"
|
||||||
notes: []
|
notes: []
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -270,6 +300,7 @@ def emerge_packages(module, packages):
|
||||||
'getbinpkg': '--getbinpkg',
|
'getbinpkg': '--getbinpkg',
|
||||||
'usepkgonly': '--usepkgonly',
|
'usepkgonly': '--usepkgonly',
|
||||||
'usepkg': '--usepkg',
|
'usepkg': '--usepkg',
|
||||||
|
'keepgoing': '--keep-going',
|
||||||
}
|
}
|
||||||
for flag, arg in emerge_flags.iteritems():
|
for flag, arg in emerge_flags.iteritems():
|
||||||
if p[flag]:
|
if p[flag]:
|
||||||
|
@ -278,6 +309,15 @@ def emerge_packages(module, packages):
|
||||||
if p['usepkg'] and p['usepkgonly']:
|
if p['usepkg'] and p['usepkgonly']:
|
||||||
module.fail_json(msg='Use only one of usepkg, usepkgonly')
|
module.fail_json(msg='Use only one of usepkg, usepkgonly')
|
||||||
|
|
||||||
|
emerge_flags = {
|
||||||
|
'jobs': '--jobs=',
|
||||||
|
'loadavg': '--load-average ',
|
||||||
|
}
|
||||||
|
|
||||||
|
for flag, arg in emerge_flags.iteritems():
|
||||||
|
if p[flag] is not None:
|
||||||
|
args.append(arg + str(p[flag]))
|
||||||
|
|
||||||
cmd, (rc, out, err) = run_emerge(module, packages, *args)
|
cmd, (rc, out, err) = run_emerge(module, packages, *args)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
|
@ -414,6 +454,9 @@ def main():
|
||||||
getbinpkg=dict(default=False, type='bool'),
|
getbinpkg=dict(default=False, type='bool'),
|
||||||
usepkgonly=dict(default=False, type='bool'),
|
usepkgonly=dict(default=False, type='bool'),
|
||||||
usepkg=dict(default=False, type='bool'),
|
usepkg=dict(default=False, type='bool'),
|
||||||
|
keepgoing=dict(default=False, type='bool'),
|
||||||
|
jobs=dict(default=None, type='int'),
|
||||||
|
loadavg=dict(default=None, type='float'),
|
||||||
),
|
),
|
||||||
required_one_of=[['package', 'sync', 'depclean']],
|
required_one_of=[['package', 'sync', 'depclean']],
|
||||||
mutually_exclusive=[['nodeps', 'onlydeps'], ['quiet', 'verbose']],
|
mutually_exclusive=[['nodeps', 'onlydeps'], ['quiet', 'verbose']],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue