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))