]> xn--ix-yja.es Git - alex.git/commitdiff
Initial add
authoralex <alex@pdp7.net>
Fri, 11 Jul 2025 07:11:54 +0000 (09:11 +0200)
committeralexpdp7 <alex@corcoles.net>
Fri, 11 Jul 2025 07:13:00 +0000 (09:13 +0200)
personal_infra/hack_dnf_problems.py [new file with mode: 0755]

diff --git a/personal_infra/hack_dnf_problems.py b/personal_infra/hack_dnf_problems.py
new file mode 100755 (executable)
index 0000000..a88f1b5
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/python3
+
+import itertools
+import shlex
+import subprocess
+
+def _(*args):
+    print(shlex.join(args))
+    subprocess.run(args, check=True)
+
+def clean():
+    _("rpm", "--rebuilddb")
+    _("dnf", "clean", "all")
+
+def update_disabled(repos):
+    args = ["dnf", "update", "-y"] + list(itertools.chain(*[("--disablerepo", r) for r in repos]))
+    _(*args)
+
+def update_enabled(repos):
+    args = ["dnf", "update", "-y", "--disablerepo=*"] + list(itertools.chain(*[("--enablerepo", r) for r in repos]))
+    _(*args)
+
+clean()
+
+problematic_repos = ["copr:copr.fedorainfracloud.org:mlampe:emacs-30", "okay", "extras"]
+
+update_disabled(problematic_repos)
+
+failed = []
+
+for r in problematic_repos:
+    try:
+        update_enabled([r])
+    except Exception as e:
+        failed.append(r)
+        print(f"fail {r}: {e}")
+
+print(f"failed {failed}")