From c08c778e08d0efacb858d0989564c014bcb4b6cc Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 30 Dec 2023 10:38:36 +0100 Subject: Fix retrieving repository (tainted, nonfree) from mgarepo rpmlog --- mga-advisor.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/mga-advisor.py b/mga-advisor.py index 8d44ad0..e6d04f0 100644 --- a/mga-advisor.py +++ b/mga-advisor.py @@ -122,7 +122,7 @@ class Widget(QWidget): for source in sources: suffix = ".mga" + source["mga_release"] if source["repo"] in ("tainted", "nonfree"): - suffix += "." + repo + suffix += "." + source["repo"] self.ui.list_src.addItem( " ".join((source["mga_release"], source["repo"], @@ -297,22 +297,25 @@ class Widget(QWidget): repo = "" p = run(cmd + [f"{mga_release}/{package}"], capture_output=True, text=True) if p.returncode == 0: + # example to parse : * Tue Aug 15 2023 squidf 116.0.5845.96-1.mga9.tainted line1 = p.stdout.split('\n')[0] - analyze = re.search(r"(\w*[\.\d]+)-([\.\d]+)", line1) + analyze = re.search(r"^\*.*\s(\w*[\.\d]+)-([\.\d]+)", line1) if analyze is not None: version = analyze.group(1) release = analyze.group(2)[:-1] - repo = "core" - if "tainted" in line1: - repo = "tainted" - elif "nonfree" in line1: - repo = "nonfree" source["mga_release"] = str(mga_release) source['package'] = package - source["repo"] = repo source["version"] = version source["release"] = release - sources.append(source) + for line in p.stdout.split('\n'): + analyze = re.search(r"^\*.*\s(\w*[\.\d]+)-([\.\d]+).mga\d*(.*)", line) + if analyze is not None: + if analyze.group(3): + source["repo"] = analyze.group(3)[1:] + else: + source["repo"] = "core" + sources.append(source) + break return sources -- cgit v1.2.1