Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cpanm option --with-recommends #9555

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- cpanm - enable usage of option ``--with-recommands`` (https://github.com/ansible-collections/community.general/issues/9554, https://github.com/ansible-collections/community.general/pull/9555).
russoz marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions plugins/modules/cpanm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
- Only install dependencies.
type: bool
default: false
withrecommands:
russoz marked this conversation as resolved.
Show resolved Hide resolved
description:
- Installs dependencies declared as recommends per META spec.
- When these dependencies fail to install, cpanm continues the installation, since they are just recommendation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be telling the user about the 3 options they have. Maybe something like:

Suggested change
- Installs dependencies declared as recommends per META spec.
- When these dependencies fail to install, cpanm continues the installation, since they are just recommendation.
- If V(true), installs dependencies declared as recommends per META spec.
- If V(false), it ensures the dependencies declared as recommends are not installed, overriding any decision made earlier in E(PERL_CPANM_OPT).
- If parameter is not set, C(cpanm) will use its existing defaults.
- When these dependencies fail to install, cpanm continues the installation, since they are just recommendation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I agree. Explicit is better. I'll just use your suggestion.
By the way what's the keyword for the doc about those doc functions : V(true), V(false), C(cpanm) and E(PERL_CPANM_OPT) ?

Copy link
Author

@ZephOne ZephOne Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type: bool
default: false
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
russoz marked this conversation as resolved.
Show resolved Hide resolved
version_added: 10.3.0
version:
description:
- Version specification for the perl module. When O(mode) is V(new), C(cpanm) version operators are accepted.
Expand Down Expand Up @@ -167,6 +174,7 @@ class CPANMinus(ModuleHelper):
mirror=dict(type='str'),
mirror_only=dict(type='bool', default=False),
installdeps=dict(type='bool', default=False),
withrecommands=dict(type='bool', default=False),
russoz marked this conversation as resolved.
Show resolved Hide resolved
executable=dict(type='path'),
mode=dict(type='str', default='new', choices=['compatibility', 'new']),
name_check=dict(type='str')
Expand All @@ -181,6 +189,7 @@ class CPANMinus(ModuleHelper):
mirror=cmd_runner_fmt.as_opt_val('--mirror'),
mirror_only=cmd_runner_fmt.as_bool("--mirror-only"),
installdeps=cmd_runner_fmt.as_bool("--installdeps"),
withrecommands=cmd_runner_fmt.as_bool("--with-recommands"),
russoz marked this conversation as resolved.
Show resolved Hide resolved
pkg_spec=cmd_runner_fmt.as_list(),
cpanm_version=cmd_runner_fmt.as_fixed("--version"),
)
Expand Down
Loading