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

Loading…
Cancel
Save