From a117948fe015d8af3630495e93f847c7f95b7ed2 Mon Sep 17 00:00:00 2001 From: simonhammes Date: Thu, 31 Oct 2024 19:36:28 +0100 Subject: [PATCH] Fix regex used to parse installed apk packages Fixes #1027 --- pyinfra/facts/apk.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyinfra/facts/apk.py b/pyinfra/facts/apk.py index ea9ffac7c..1267370f3 100644 --- a/pyinfra/facts/apk.py +++ b/pyinfra/facts/apk.py @@ -4,7 +4,9 @@ from .util.packaging import parse_packages -APK_REGEX = r"^([a-zA-Z0-9\-_]+)-([0-9\.]+\-?[a-z0-9]*)\s" +# Source: https://superuser.com/a/1472405 +# Modified to return version and release inside a single group and removed extra capturing groups +APK_REGEX = r"(.+)-([^-]+-r[^-]+) \S+ \{\S+\} \(.+?\)" class ApkPackages(FactBase):