Add "changed_deps" to portage parameters (#11023)

* Add option for '--changed-deps'

* Add changelog fragment

* Re-add the changed_deps option

* Include link to PR

* Rename fragment properly, and include PR number in name

* Add version string and improve doc description

* Update changelogs/fragments/11023-portage_changed_deps.yml

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

* Refine documentation string further

* Reformat with ruff

* Add a correct changely fragment

* Update plugins/modules/portage.py

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

---------

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Pär Karlsson
2025-11-03 06:12:09 +01:00
committed by GitHub
parent b28ac655fc
commit 6635bd7742
2 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
minor_changes:
- "portage - add a ``changed_deps`` option (https://github.com/ansible-collections/community.general/pull/11023)."

View File

@@ -65,6 +65,14 @@ options:
type: bool
default: false
changed_deps:
description:
- Tells emerge to replace installed packages for which the ebuild dependencies
have changed since the packages were built (C(--changed-deps)).
type: bool
default: false
version_added: 12.0.0
changed_use:
description:
- Include installed packages where USE flags have changed, except when.
@@ -333,10 +341,17 @@ def emerge_packages(module, packages):
"""Run emerge command against given list of atoms."""
p = module.params
if p["noreplace"] and not p["changed_use"] and not p["newuse"] and not (p["update"] or p["state"] == "latest"):
if (
p["noreplace"]
and not p["changed_deps"]
and not p["changed_use"]
and not p["newuse"]
and not (p["update"] or p["state"] == "latest")
):
for package in packages:
if (
p["noreplace"]
and not p["changed_deps"]
and not p["changed_use"]
and not p["newuse"]
and not query_package(module, package, "emerge")
@@ -352,6 +367,7 @@ def emerge_packages(module, packages):
"update": "--update",
"deep": "--deep",
"newuse": "--newuse",
"changed_deps": "--changed-deps",
"changed_use": "--changed-use",
"oneshot": "--oneshot",
"noreplace": "--noreplace",
@@ -542,6 +558,7 @@ def main():
backtrack=dict(type="int"),
deep=dict(default=False, type="bool"),
newuse=dict(default=False, type="bool"),
changed_deps=dict(default=False, type="bool"),
changed_use=dict(default=False, type="bool"),
oneshot=dict(default=False, type="bool"),
noreplace=dict(default=True, type="bool"),