Adds latest to portage module (#21918)

pull/20437/merge
William L. Thomson Jr 8 years ago committed by Brian Coca
parent d6b40c935f
commit b7229b0467

@ -45,7 +45,7 @@ options:
- State of the package atom
required: false
default: "present"
choices: [ "present", "installed", "emerged", "absent", "removed", "unmerged" ]
choices: [ "present", "installed", "emerged", "absent", "removed", "unmerged", "latest" ]
update:
description:
@ -196,7 +196,7 @@ EXAMPLES = '''
package: foo
state: absent
# Update package foo to the "best" version
# Update package foo to the "latest" version ( os specific alternative to latest )
- portage:
package: foo
update: yes
@ -298,7 +298,7 @@ def sync_repositories(module, webrsync=False):
def emerge_packages(module, packages):
p = module.params
if not (p['update'] or p['noreplace']):
if not (p['update'] or p['noreplace'] or p['state']=='latest'):
for package in packages:
if not query_package(module, package, 'emerge'):
break
@ -328,6 +328,9 @@ def emerge_packages(module, packages):
if p[flag]:
args.append(arg)
if p['state'] and p['state']=='latest':
args.append("--update")
if p['usepkg'] and p['usepkgonly']:
module.fail_json(msg='Use only one of usepkg, usepkgonly')
@ -449,7 +452,7 @@ def run_emerge(module, packages, *args):
return cmd, module.run_command(cmd)
portage_present_states = ['present', 'emerged', 'installed']
portage_present_states = ['present', 'emerged', 'installed', 'latest']
portage_absent_states = ['absent', 'unmerged', 'removed']

Loading…
Cancel
Save