1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add getbinpkgonly (-G) to portage (#1169)

* Add getbinpkgonly (-G) to portage

* version_added for getbinpkgonly

* Format description nicely, add the mutually exclusive nature of the 'pkg' options, and correct usepkgonly

* Changelog fragement

* Formatting

* Update changelogs/fragments/1169-getbinpkgonly.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Remove all exclusiveness, portage makes no such restrictions

Co-authored-by: Mike Williams <mike.williams@sectigo.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Mike Williams 2020-10-26 18:37:56 +00:00 committed by GitHub
parent 19fdfcf0b3
commit 0b13fd2c76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View file

@ -0,0 +1,3 @@
---
minor_changes:
- portage - add ``getbinpkgonly`` option, remove unnecessary note on internal portage behaviour (getbinpkg=yes), and remove the undocumented exclusiveness of the pkg options as portage makes no such restriction (https://github.com/ansible-collections/community.general/pull/1169).

View file

@ -113,15 +113,22 @@ options:
choices: [ "web", "yes", "no" ] choices: [ "web", "yes", "no" ]
type: str type: str
getbinpkgonly:
description:
- Merge only packages specified at C(PORTAGE_BINHOST) in C(make.conf).
type: bool
default: no
version_added: 1.3.0
getbinpkg: getbinpkg:
description: description:
- Prefer packages specified at PORTAGE_BINHOST in make.conf - Prefer packages specified at C(PORTAGE_BINHOST) in C(make.conf).
type: bool type: bool
default: no default: no
usepkgonly: usepkgonly:
description: description:
- Merge only binaries (no compiling). This sets getbinpkg=yes. - Merge only binaries (no compiling).
type: bool type: bool
default: no default: no
@ -310,6 +317,7 @@ def emerge_packages(module, packages):
'onlydeps': '--onlydeps', 'onlydeps': '--onlydeps',
'quiet': '--quiet', 'quiet': '--quiet',
'verbose': '--verbose', 'verbose': '--verbose',
'getbinpkgonly': '--getbinpkgonly',
'getbinpkg': '--getbinpkg', 'getbinpkg': '--getbinpkg',
'usepkgonly': '--usepkgonly', 'usepkgonly': '--usepkgonly',
'usepkg': '--usepkg', 'usepkg': '--usepkg',
@ -324,9 +332,6 @@ def emerge_packages(module, packages):
if p['state'] and p['state'] == 'latest': if p['state'] and p['state'] == 'latest':
args.append("--update") args.append("--update")
if p['usepkg'] and p['usepkgonly']:
module.fail_json(msg='Use only one of usepkg, usepkgonly')
emerge_flags = { emerge_flags = {
'jobs': '--jobs', 'jobs': '--jobs',
'loadavg': '--load-average', 'loadavg': '--load-average',
@ -356,7 +361,7 @@ def emerge_packages(module, packages):
# Check for SSH error with PORTAGE_BINHOST, since rc is still 0 despite # Check for SSH error with PORTAGE_BINHOST, since rc is still 0 despite
# this error # this error
if (p['usepkgonly'] or p['getbinpkg']) \ if (p['usepkgonly'] or p['getbinpkg'] or p['getbinpkgonly']) \
and 'Permission denied (publickey).' in err: and 'Permission denied (publickey).' in err:
module.fail_json( module.fail_json(
cmd=cmd, rc=rc, stdout=out, stderr=err, cmd=cmd, rc=rc, stdout=out, stderr=err,
@ -480,6 +485,7 @@ def main():
quiet=dict(default=False, type='bool'), quiet=dict(default=False, type='bool'),
verbose=dict(default=False, type='bool'), verbose=dict(default=False, type='bool'),
sync=dict(default=None, choices=['yes', 'web', 'no']), sync=dict(default=None, choices=['yes', 'web', 'no']),
getbinpkgonly=dict(default=False, type='bool'),
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'),