Skip to content

Commit 6635bd7

Browse files
feinorghrussozfelixfontein
authored
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 <[email protected]> * Refine documentation string further * Reformat with ruff * Add a correct changely fragment * Update plugins/modules/portage.py Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Alexei Znamensky <[email protected]> Co-authored-by: Felix Fontein <[email protected]>
1 parent b28ac65 commit 6635bd7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- "portage - add a ``changed_deps`` option (https://github.com/ansible-collections/community.general/pull/11023)."

plugins/modules/portage.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
type: bool
6666
default: false
6767
68+
changed_deps:
69+
description:
70+
- Tells emerge to replace installed packages for which the ebuild dependencies
71+
have changed since the packages were built (C(--changed-deps)).
72+
type: bool
73+
default: false
74+
version_added: 12.0.0
75+
6876
changed_use:
6977
description:
7078
- Include installed packages where USE flags have changed, except when.
@@ -333,10 +341,17 @@ def emerge_packages(module, packages):
333341
"""Run emerge command against given list of atoms."""
334342
p = module.params
335343

336-
if p["noreplace"] and not p["changed_use"] and not p["newuse"] and not (p["update"] or p["state"] == "latest"):
344+
if (
345+
p["noreplace"]
346+
and not p["changed_deps"]
347+
and not p["changed_use"]
348+
and not p["newuse"]
349+
and not (p["update"] or p["state"] == "latest")
350+
):
337351
for package in packages:
338352
if (
339353
p["noreplace"]
354+
and not p["changed_deps"]
340355
and not p["changed_use"]
341356
and not p["newuse"]
342357
and not query_package(module, package, "emerge")
@@ -352,6 +367,7 @@ def emerge_packages(module, packages):
352367
"update": "--update",
353368
"deep": "--deep",
354369
"newuse": "--newuse",
370+
"changed_deps": "--changed-deps",
355371
"changed_use": "--changed-use",
356372
"oneshot": "--oneshot",
357373
"noreplace": "--noreplace",
@@ -542,6 +558,7 @@ def main():
542558
backtrack=dict(type="int"),
543559
deep=dict(default=False, type="bool"),
544560
newuse=dict(default=False, type="bool"),
561+
changed_deps=dict(default=False, type="bool"),
545562
changed_use=dict(default=False, type="bool"),
546563
oneshot=dict(default=False, type="bool"),
547564
noreplace=dict(default=True, type="bool"),

0 commit comments

Comments
 (0)