Merge pull request #631 from Tatsh-ansible/usepkg-flags

Portage: --usepkg and --usepkgonly flags, --usepkgonly should not imply --getbinpkg
This commit is contained in:
Greg DeKoenigsberg 2015-06-23 13:35:27 -04:00
commit 03bb12c90f

View file

@ -271,14 +271,14 @@ def emerge_packages(module, packages):
'verbose': '--verbose',
'getbinpkg': '--getbinpkg',
'usepkgonly': '--usepkgonly',
'usepkg': '--usepkg',
}
for flag, arg in emerge_flags.iteritems():
if p[flag]:
args.append(arg)
# usepkgonly implies getbinpkg
if p['usepkgonly'] and not p['getbinpkg']:
args.append('--getbinpkg')
if p['usepkg'] and p['usepkgonly']:
module.fail_json(msg='Use only one of usepkg, usepkgonly')
cmd, (rc, out, err) = run_emerge(module, packages, *args)
if rc != 0:
@ -415,6 +415,7 @@ def main():
sync=dict(default=None, choices=['yes', 'web']),
getbinpkg=dict(default=None, choices=['yes']),
usepkgonly=dict(default=None, choices=['yes']),
usepkg=dict(default=None, choices=['yes']),
),
required_one_of=[['package', 'sync', 'depclean']],
mutually_exclusive=[['nodeps', 'onlydeps'], ['quiet', 'verbose']],