From 08831e193f392354caeab6571d6cdd859c619bd2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2020 21:08:04 +0100 Subject: [PATCH] Add getbinpkgonly (-G) to portage (#1169) (#1182) * 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 * Remove all exclusiveness, portage makes no such restrictions Co-authored-by: Mike Williams Co-authored-by: Felix Fontein (cherry picked from commit 0b13fd2c7684ef53ff94a6fcb70753dddf2e98d9) Co-authored-by: Mike Williams <7595658+gaima8@users.noreply.github.com> --- changelogs/fragments/1169-getbinpkgonly.yaml | 3 +++ plugins/modules/packaging/os/portage.py | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/1169-getbinpkgonly.yaml diff --git a/changelogs/fragments/1169-getbinpkgonly.yaml b/changelogs/fragments/1169-getbinpkgonly.yaml new file mode 100644 index 0000000000..b94dc6f224 --- /dev/null +++ b/changelogs/fragments/1169-getbinpkgonly.yaml @@ -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). diff --git a/plugins/modules/packaging/os/portage.py b/plugins/modules/packaging/os/portage.py index 5275e5184c..1f0fdc682a 100644 --- a/plugins/modules/packaging/os/portage.py +++ b/plugins/modules/packaging/os/portage.py @@ -113,15 +113,22 @@ options: choices: [ "web", "yes", "no" ] 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: description: - - Prefer packages specified at PORTAGE_BINHOST in make.conf + - Prefer packages specified at C(PORTAGE_BINHOST) in C(make.conf). type: bool default: no usepkgonly: description: - - Merge only binaries (no compiling). This sets getbinpkg=yes. + - Merge only binaries (no compiling). type: bool default: no @@ -310,6 +317,7 @@ def emerge_packages(module, packages): 'onlydeps': '--onlydeps', 'quiet': '--quiet', 'verbose': '--verbose', + 'getbinpkgonly': '--getbinpkgonly', 'getbinpkg': '--getbinpkg', 'usepkgonly': '--usepkgonly', 'usepkg': '--usepkg', @@ -324,9 +332,6 @@ def emerge_packages(module, packages): 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') - emerge_flags = { 'jobs': '--jobs', '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 # this error - if (p['usepkgonly'] or p['getbinpkg']) \ + if (p['usepkgonly'] or p['getbinpkg'] or p['getbinpkgonly']) \ and 'Permission denied (publickey).' in err: module.fail_json( cmd=cmd, rc=rc, stdout=out, stderr=err, @@ -480,6 +485,7 @@ def main(): quiet=dict(default=False, type='bool'), verbose=dict(default=False, type='bool'), sync=dict(default=None, choices=['yes', 'web', 'no']), + getbinpkgonly=dict(default=False, type='bool'), getbinpkg=dict(default=False, type='bool'), usepkgonly=dict(default=False, type='bool'), usepkg=dict(default=False, type='bool'),