From 9f19ade3cb557d037d9f5cc7eee8b68059b4bdf2 Mon Sep 17 00:00:00 2001 From: zhangxingrong Date: Tue, 9 Jul 2024 14:30:02 +0800 Subject: [PATCH] playbooks-Avoid-using-potentially-broken-DNF5 --- ...-Avoid-using-potentially-broken-DNF5.patch | 106 ++++++++++++++++++ toolbox.spec | 7 +- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 0002-playbooks-Avoid-using-potentially-broken-DNF5.patch diff --git a/0002-playbooks-Avoid-using-potentially-broken-DNF5.patch b/0002-playbooks-Avoid-using-potentially-broken-DNF5.patch new file mode 100644 index 0000000..f4e09e3 --- /dev/null +++ b/0002-playbooks-Avoid-using-potentially-broken-DNF5.patch @@ -0,0 +1,106 @@ +From ef98adbb7a9d48a68f89abf34d763ab302d1cdda Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Tue, 11 Jun 2024 19:26:50 +0200 +Subject: [PATCH] playbooks: Avoid using potentially broken DNF5 + +The Zuul executor got updated from Ansible 2.13.7 to 2.15.10, which now +has support for DNF5 [1] and the previous DNF5 Change [2] for Fedora 39 +is now aiming at Fedora 41 (and Rawhide) [3]. Unfortunately, Ansible's +'dnf5' module is still under development and doesn't seem to match the +state of DNF5 in Fedora Rawhide, which causes: + TASK [Install RPM packages] + fedora-rawhide | ERROR + fedora-rawhide | { + fedora-rawhide | "failures": [], + fedora-rawhide | "msg": "Could not import the libdnf5 python module + using /usr/bin/python3 (3.12.3 (main, Apr 17 2024, 00:00:00) [GCC + 14.0.1 20240411 (Red Hat 14.0.1-0)]). Please install + python3-libdnf5 package or ensure you have specified the correct + ansible_python_interpreter. (attempted + ['/usr/libexec/platform-python', '/usr/bin/python3', + '/usr/bin/python2', '/usr/bin/python'])" + fedora-rawhide | } + +Trying to explicitly install python3-libdnf5, as suggested above, using +Ansible's 'command' module before using the 'package' module to install +the Toolbx dependencies, still ends up with: + TASK [Install RPM packages] + fedora-rawhide | MODULE FAILURE: + fedora-rawhide | Traceback (most recent call last): + fedora-rawhide | File "", line 107, in + fedora-rawhide | File "", line 99, in _ansiballz_main + fedora-rawhide | File "", line 47, in invoke_module + fedora-rawhide | File "", line 226, in run_module + fedora-rawhide | File "", line 98, in _run_module_code + fedora-rawhide | File "", line 88, in _run_code + fedora-rawhide | File "/tmp/ansible_ansible.legacy.dnf5_payload_kecazv78/ansible_ansible.legacy.dnf5_payload.zip/ansible/modules/dnf5.py", + line 708, in + fedora-rawhide | File "/tmp/ansible_ansible.legacy.dnf5_payload_kecazv78/ansible_ansible.legacy.dnf5_payload.zip/ansible/modules/dnf5.py", + line 704, in main + fedora-rawhide | File "/tmp/ansible_ansible.legacy.dnf5_payload_kecazv78/ansible_ansible.legacy.dnf5_payload.zip/ansible/modules/dnf5.py", + line 487, in run + fedora-rawhide | AttributeError: 'Base' object has no attribute + +Therefore, force the use of DNF4 when an Ansible job is being attempted +more than once [4]. + +[1] Ansible commit a81b787a05100986 + https://github.com/ansible/ansible/commit/a81b787a05100986 + https://github.com/ansible/ansible/issues/78898 + +[2] https://fedoraproject.org/wiki/Changes/ReplaceDnfWithDnf5 + +[3] https://fedoraproject.org/wiki/Changes/SwitchToDnf5 + +[4] https://zuul-ci.org/docs/zuul/latest/job-content.html#var-zuul.attempts + +https://github.com/containers/toolbox/pull/1509 + +--- + playbooks/dependencies-fedora-restricted.yaml | 3 +++ + playbooks/dependencies-fedora.yaml | 1 + + 2 files changed, 4 insertions(+) + +diff --git a/playbooks/dependencies-fedora-restricted.yaml b/playbooks/dependencies-fedora-restricted.yaml +index 2567e0c..a8823f9 100644 +--- a/playbooks/dependencies-fedora-restricted.yaml ++++ b/playbooks/dependencies-fedora-restricted.yaml +@@ -45,6 +45,7 @@ + - udisks2 + state: present + update_cache: "{{ true if zuul.attempts > 1 else false }}" ++ use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}" + + - name: Ensure that podman(1) is absent + become: yes +@@ -53,6 +54,7 @@ + - podman + state: absent + update_cache: "{{ true if zuul.attempts > 1 else false }}" ++ use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}" + + - name: Ensure that skopeo(1) is absent + become: yes +@@ -61,6 +63,7 @@ + - skopeo + state: absent + update_cache: "{{ true if zuul.attempts > 1 else false }}" ++ use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}" + + - name: Download Go modules + command: go mod download -x +diff --git a/playbooks/dependencies-fedora.yaml b/playbooks/dependencies-fedora.yaml +index 194f4e6..4470901 100644 +--- a/playbooks/dependencies-fedora.yaml ++++ b/playbooks/dependencies-fedora.yaml +@@ -37,6 +37,7 @@ + - skopeo + - systemd + - udisks2 ++ use: "{{ 'dnf' if zuul.attempts > 1 else 'auto' }}" + + - name: Download Go modules + command: go mod download -x +-- +2.43.0 + diff --git a/toolbox.spec b/toolbox.spec index 53f6c1f..2545948 100644 --- a/toolbox.spec +++ b/toolbox.spec @@ -5,7 +5,7 @@ Version: 0.0.99.5 %global goipath github.com/containers/%{name} -Release: 4 +Release: 5 Summary: Tool for interactive command line environments on Linux License: Apache-2.0 @@ -14,6 +14,7 @@ URL: https://github.com/containers/toolbox Source0: toolbox-0.0.99.5-vendored.tar.xz Source1: https://github.com/cpuguy83/go-md2man/archive/v1.0.10.tar.gz Patch0: 0001-toolbox-0.0.99.5-add-support-for-loongarch64.patch +Patch1: 0002-playbooks-Avoid-using-potentially-broken-DNF5.patch BuildRequires: golang >= 1.20 meson >= 0.58.0 BuildRequires: pkgconfig(bash-completion) systemd @@ -46,6 +47,7 @@ The toolbox-tests package contains system tests for toolbox. %prep %setup -q %patch0 -p1 +%patch1 -p1 GOBUILDDIR="$(pwd)/_build" GOSOURCEDIR="$(pwd)" @@ -107,6 +109,9 @@ fi %{_datadir}/%{name} %changelog +* Tue Jul 9 2024 zhangxingrong- - 0.0.99.5-5 +- playbooks: Avoid using potentially broken DNF5 + * Tue Apr 23 2024 Pengda Dou - 0.0.99.5-4 - add support for loongarch64 -- Gitee