-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
find_conflicting_aur_pkgs.py
35 lines (29 loc) · 1.04 KB
/
find_conflicting_aur_pkgs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pickle # nosec B403
import sys
from pathlib import Path
from pikaur.aur import get_all_aur_packages
PICKLE_FILE = Path("aur_db.dump")
if PICKLE_FILE.exists():
print(f"Opening db dump '{PICKLE_FILE}'...")
with PICKLE_FILE.open("rb") as fobj:
aur_pkgs = pickle.load(fobj) # nosec B301
else:
print("Fetching...")
aur_pkgs = get_all_aur_packages()
print(f"Saving db dump to '{PICKLE_FILE}'...")
with PICKLE_FILE.open("wb") as fobj:
pickle.dump(aur_pkgs, fobj)
print("Filtering...\n")
all_conflicts: dict[str, list[str]] = {}
for pkg in aur_pkgs:
for name in [pkg.name]: # + list(getattr(pkg, "provides", [])):
for conf in getattr(pkg, "conflicts", []):
all_conflicts.setdefault(name, []).append(conf)
# Print all conflicting packages in AUR:
try:
for pkgbase in all_conflicts:
for pkgbase_2, pkgnames_2 in all_conflicts.items():
if pkgbase != pkgbase_2 and pkgbase in pkgnames_2:
print(f"{pkgbase}: {pkgbase_2}")
except BrokenPipeError:
sys.exit()