diff options
Diffstat (limited to 'mga-advisor.py')
-rw-r--r-- | mga-advisor.py | 21 |
1 files 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 <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 |