summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-12-30 10:38:36 +0100
committerPapoteur <papoteur@mageia.org>2023-12-30 10:38:36 +0100
commitc08c778e08d0efacb858d0989564c014bcb4b6cc (patch)
tree25027894c28d5bd5c9505fc7d702dd89e768edd3
parent03e264f1f4aaf59bb3a500ce16c139840580153f (diff)
downloadmga-advisor-c08c778e08d0efacb858d0989564c014bcb4b6cc.tar
mga-advisor-c08c778e08d0efacb858d0989564c014bcb4b6cc.tar.gz
mga-advisor-c08c778e08d0efacb858d0989564c014bcb4b6cc.tar.bz2
mga-advisor-c08c778e08d0efacb858d0989564c014bcb4b6cc.tar.xz
mga-advisor-c08c778e08d0efacb858d0989564c014bcb4b6cc.zip
Fix retrieving repository (tainted, nonfree) from mgarepo rpmlog
-rw-r--r--mga-advisor.py21
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