From 788cfb624aa7e694b533b5d2722aab0ff4522ce6 Mon Sep 17 00:00:00 2001 From: Minei3oat Date: Thu, 21 Jul 2022 13:58:03 +0200 Subject: [PATCH] Pacman: Fix name of URL packages (#4959) * Strip downloading... of unseen URLs * Added changelog fragment * Added integration tests for reason and reason_for Inspired by the integration tests for url packages * Revert "Added integration tests for reason and reason_for" This reverts commit f60d92f0d7d01b09cb70a4bdae28036423652efd. Accidentally commited to the wrong branch. --- changelogs/fragments/4959-pacman-fix-url-packages-name.yaml | 2 ++ plugins/modules/packaging/os/pacman.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/4959-pacman-fix-url-packages-name.yaml diff --git a/changelogs/fragments/4959-pacman-fix-url-packages-name.yaml b/changelogs/fragments/4959-pacman-fix-url-packages-name.yaml new file mode 100644 index 0000000000..3d912c15d4 --- /dev/null +++ b/changelogs/fragments/4959-pacman-fix-url-packages-name.yaml @@ -0,0 +1,2 @@ +bugfixes: + - pacman - fixed name resolution of URL packages (https://github.com/ansible-collections/community.general/pull/4959). diff --git a/plugins/modules/packaging/os/pacman.py b/plugins/modules/packaging/os/pacman.py index a3e0b2f589..65f6f92747 100644 --- a/plugins/modules/packaging/os/pacman.py +++ b/plugins/modules/packaging/os/pacman.py @@ -613,8 +613,9 @@ class Pacman(object): stderr=stderr, rc=rc, ) - # With Pacman v6.0.1 - libalpm v13.0.1, --upgrade outputs "loading packages..." on stdout. strip that - stdout = stdout.replace("loading packages...\n", "") + # With Pacman v6.0.1 - libalpm v13.0.1, --upgrade outputs " filename_without_extension downloading..." if the URL is unseen. + # In all cases, pacman outputs "loading packages..." on stdout. strip both + stdout = stdout.splitlines()[-1] is_URL = True pkg_name = stdout.strip() pkg_list.append(Package(name=pkg_name, source=pkg, source_is_URL=is_URL))