mirror of https://github.com/ansible/ansible.git
Merge 719b6321bf into 7b4d4ed672
commit
5bf1f609ae
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- apt - add support for installing ``.deb`` files whose dependencies include virtual packages (e.g. ``libglib2.0-0`` on Ubuntu 24.04) by recognizing installed providers such as ``libglib2.0-0t64``. This resolves errors like ``Dependency is not satisfiable`` when installing VS Code and other packages (https://github.com/ansible/ansible/issues/85807).
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Create directory for test .deb
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/virtual-test/DEBIAN
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Create a test .deb file that depends on a virtual package
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
cat > /tmp/virtual-test/DEBIAN/control << EOF
|
||||||
|
Package: virtual-test-pkg
|
||||||
|
Version: 1.0
|
||||||
|
Architecture: all
|
||||||
|
Description: Test package depending on virtual package
|
||||||
|
Depends: mail-transport-agent
|
||||||
|
EOF
|
||||||
|
dpkg-deb --build /tmp/virtual-test /tmp/virtual-test.deb
|
||||||
|
args:
|
||||||
|
creates: /tmp/virtual-test.deb
|
||||||
|
|
||||||
|
- name: Remove any existing MTA providers
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- exim4
|
||||||
|
- postfix
|
||||||
|
- sendmail
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Test the patch - install .deb with virtual package dependency
|
||||||
|
ansible.builtin.apt:
|
||||||
|
deb: /tmp/virtual-test.deb
|
||||||
|
state: present
|
||||||
|
register: patch_test_result
|
||||||
|
|
||||||
|
- name: Debug - Show patch test result
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: patch_test_result
|
||||||
|
|
||||||
|
- name: Check if a virtual package provider was automatically installed
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
dpkg -l | grep -E "^ii" | grep -E "(exim|postfix|sendmail)" && echo "SUCCESS: Virtual package provider was installed" || echo "FAIL: No provider installed"
|
||||||
|
register: provider_check
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Show provider check result
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: provider_check.stdout
|
||||||
|
|
||||||
|
- name: Assert the patch worked
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- patch_test_result is succeeded
|
||||||
|
- "'SUCCESS' in provider_check.stdout"
|
||||||
|
fail_msg: "The patch failed to properly resolve virtual package dependencies when installing .deb files"
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: Clean up test package
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /tmp/virtual-test.deb
|
||||||
|
state: absent
|
||||||
Loading…
Reference in New Issue