pkgin searches for packages such as 'emacs' can return multiple matches,
the first of which is not guaranteed to match. So, iterate through
found packages until we have an appropriate match. Should we *not* find
a match, then return False indicating match failure.
When no repositories are defined in zypper, the return code
of "zypper repos" is 6. Handle that case and don't fail
if zypper_repository has to deal with an empty repo list.
Fixes https://github.com/ansible/ansible-modules-extras/issues/795
This fully implements all expected functionality of the dnf module.
Group removal may behave oddly due to hiccups in tagging groups as being
installed.
A pkg_types option could be added to specify the group package types.
disable_gpg_check was configured backwards, so it was toggled. Typos in
enablerepo/disablerepo are removed. fill_sack() calls are relocated to
occur after repo decisions. The "changed" key is now set for new
installations.
The `--noreplace` argument to `emerge` is generally coupled with
`--newuse` or `--changed-use`, and can be used instruct Portage to
rebuild a package only if necessary. Simply checking to see if the
package is already installed using `equery` is not sufficient to
determine if any changes would be made, so that step is skipped when
the `noreplace` module argument is specified. The module then falls back
to parsing the output from `emerge` to determine if anything changed. In
check mode, `emerge` is called with `--pretend`, so it produces
different output, and the parsing fails to correctly infer that a change
would be made.
This commit adds another regular expression to check when running in
check mode that matches the pretend output from `emerge`.
Signed-off-by: Dustin C. Hatch <dustin@hatch.name>
When running in check mode, the *portage* module always reports that no
changes were made, even if the requested packages do not exist on the
system. This is because it was erroneously expecting `emerge --pretend`
to produce the same output as `emerge` by itself would, and attempts to
parse it. This is not correct, for several reasons. Most specifically,
the string for which it is searching does not exist in the pretend
output. Additionally, `emerge --pretend` always prints the requested
packages, whether they are already installed or not; in the former case,
it shows them as reinstalls.
This commit adjusts the behavior to rely on `equery` alone when running
in check mode. If `equery` reports at least one package is not
installed, then nothing else is done: the system will definitely be
changed.
Signed-off-by: Dustin C. Hatch <dustin@hatch.name>
- Backport config file handling from the DNF module rewrite #527
(Current config handling does not work with dnf and leads to
tracebacks when run as an unprivileged user).
- Make a mandatory requirement on yum-utils (for /usr/bin/repoquery)
because none of the fallback code works for dnf (it's unported yum API
code).
Both of these issues will be fixed better in the dnf rewrite when it is
feature complete.
Fixes#471
The documentation for the `state` field is not very clear.
It says possible values are "installed, uninstalled" and default value is "present"
The examples below alow uses `present` and `absent`.
This patch uses "absent" and "present" instead of "installed" and "uninstalled"
Moreover, this is consistent with other packaging modules, like homebrew itself
package_latest was calling package_present but did not care
about the return code so errors in package_present were hidden
and everthing look ok on the console when zypper update did not fail,
but no packages where installed.