Open kisp opened 1 year ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @indrajitr @tchernomax click here for bot help
The whole base-devel group is not installed. The following output is generated when running pacman -S with the same package list as before with the pacman ansible module. All packages of the base-devel group are missing, so there is no old version shown for them:
pacman --query --groups
will output the group name of some installed packages even though the base-devel group and its other package are not installed
base-devel binutils
base-devel gcc
base-devel libtool
...
The pacman module uses this command as its source of truth: https://github.com/ansible-collections/community.general/blob/main/plugins/modules/pacman.py#L716-L729
I cannot find a single command that will list all the groups without this problem, but this could be fixed by adding a verification in the loop. Which is running pacman --query {group}
.
Unless someone know a better way to list all installed groups in one go, I'm happy to submit a PR adding this extra command in the loop.
cc @jraby click here for bot help
I tried to reproduce this here without much success, the test case provided indeed doesn't work, but unless I'm missing something obvious, make
doesn't seem to be part of the base-devel
group:
$ pacman -Sgg base-devel
base-devel binutils
base-devel gcc
base-devel libtool
(it doesn't seem to be part of a group either, by looking at pacman -Sgg | grep make
)
If, instead of make
, we use gcc
, it seems to work properly:
---
- name: Test playbook
hosts: localhost
vars:
ansible_python_interpreter: /usr/bin/python3
tasks:
- name: Ensure group member is not installed
community.general.pacman:
state: absent
force: true
name:
- gcc
- name: Install group
community.general.pacman:
state: present
name:
- base-devel
- name: Run cmd
ansible.builtin.command:
cmd: gcc --version
register: output
- name: Show output
ansible.builtin.debug:
msg: "{{ output.stdout }}"
PLAY [Test playbook] ***********************************************************************************************************************************************************************************************
TASK [Gathering Facts] *********************************************************************************************************************************************************************************************
ok: [localhost]
TASK [Ensure group member is not installed] ************************************************************************************************************************************************************************
--- before
+++ after
@@ -1 +0,0 @@
-gcc-12.2.1-2
changed: [localhost]
TASK [Install group] ***********************************************************************************************************************************************************************************************
--- before
+++ after
@@ -0,0 +1 @@
+gcc-12.2.1-2
changed: [localhost]
TASK [Run cmd] *****************************************************************************************************************************************************************************************************
changed: [localhost]
TASK [Show output] *************************************************************************************************************************************************************************************************
ok: [localhost] => {
"msg": "gcc (GCC) 12.2.1 20230201\nCopyright (C) 2022 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions. There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
}
PLAY RECAP *********************************************************************************************************************************************************************************************************
localhost : ok=5 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
@kisp can you confirm this behavior?
Of course I find the problem minutes after sending the above...
make
is a dependency of the base-devel
package group, but it isn't a member of the group.
The current logic of the module doesn't account for dependencies of groups, it simply adds all group members to the list of package to install.
I don't recall exactly why I implemented group expansion that way, instead of letting pacman do it, possibly to generate diffs of package to install/remove.
I haven't looked closely at the code in a while, so take this with a grain of salt, but I think the module should let pacman handle the groups and their dependencies, otherwise we'd end up reimplementing even more of pacman in the module, it doesn't sound right.
Just as a generic comment: the tricky part is usually getting diff and check mode to work. These might have been reasons to implement it as it is now.
If there's a way to tell pacman "Tell me what exactly would happen if I try to install / remove this package, but don't do it" it's probably best to use that instead.
This is related to the recent switch to the base-devel meta package.
There seems to be a new (meta) package named base-devel
which contains all other packages as dependencies, while at the same time there is also the old base-devel
package group, which still contains binutils
, gcc
and libtool
.
I've brought this issue up in the Arch Linux forum.
$ pacman --query --groups | grep base-devel
$ pacman -Sgg base-devel
Both are now empty, so there is only the new meta package installing base-devel
. I think this should now work fine.
Summary
When I use
community.general.pacman
to install the groupbase-devel
, I expect that all member packages will be installed. As an example,make
is a member package, but for some reason it does not get installed.Issue Type
Bug Report
Component Name
pacman
Ansible Version
Community.general Version
I believe that upgrading the local ansible_collections to
community.general 6.5.0
does not change the observed behaviour (but I can double check that again if desired).Configuration
OS / Environment
Arch Linux
Steps to Reproduce
Expected Results
I expect
make
to be available after installingbase-devel
.Actual Results
Code of Conduct