feat: release v2.0.0 with tab completion, package filtering, db health checks, flatpak and logrotate
Build and Publish Release / Build Packages and Publish (push) Successful in 27s

This commit is contained in:
soda64 committed 2026-10-03 08:31:00 +02:00
1 parent 8d4157b42d
commit 8bec4ed932
27 files changed
+1053 -69

No files matched your search

+37 -4
View File
@@ -1,7 +1,7 @@
import os
import shutil
from pathlib import Path
from typing import List, Optional
from typing import List, Optional, Tuple
from linux_updater.core.runner import CommandRunner
from linux_updater.managers.base import PackageManager
@@ -19,24 +19,32 @@ class PacmanManager(PackageManager):
def refresh_repositories(self) -> CommandResult:
return self.runner.run(["pacman", "-Sy"])
def check_updates(self) -> List[PackageUpdate]:
def check_updates(
self,
exclude: Optional[List[str]] = None,
security_only: bool = False,
) -> List[PackageUpdate]:
# Prefer checkupdates if installed (safe non-root update check)
cmd = ["checkupdates"] if shutil.which("checkupdates") else ["pacman", "-Qu"]
res = self.runner.run(cmd)
import fnmatch
updates: List[PackageUpdate] = []
for line in res.stdout.splitlines():
line = line.strip()
if not line or "->" not in line:
continue
# Format: package old_version -> new_version [repo]
try:
left, right = line.split("->", 1)
left_parts = left.strip().split()
right_parts = right.strip().split()
pkg = left_parts[0]
if exclude and any(fnmatch.fnmatch(pkg, pat) for pat in exclude):
continue
old_ver = left_parts[1] if len(left_parts) > 1 else "unknown"
new_ver = right_parts[0] if right_parts else "unknown"
repo = right_parts[1].strip("[]") if len(right_parts) > 1 else None
@@ -50,22 +58,32 @@ class PacmanManager(PackageManager):
def apply_updates(
self,
packages: Optional[List[str]] = None,
exclude: Optional[List[str]] = None,
security_only: bool = False,
dry_run: bool = False,
non_interactive: bool = False,
) -> CommandResult:
if packages:
import fnmatch
target_pkgs = [p for p in packages if not (exclude and any(fnmatch.fnmatch(p, pat) for pat in exclude))]
if not target_pkgs:
return CommandResult(0, "All specified packages were excluded.", "", True)
cmd = ["pacman", "-S"]
if dry_run:
cmd.append("-p")
else:
cmd.append("--noconfirm")
cmd.extend(packages)
if exclude:
cmd.extend(["--ignore", ",".join(exclude)])
cmd.extend(target_pkgs)
else:
cmd = ["pacman", "-Su"]
if dry_run:
cmd.append("-p")
else:
cmd.append("--noconfirm")
if exclude:
cmd.extend(["--ignore", ",".join(exclude)])
return self.runner.run(cmd, stream=not dry_run)
@@ -112,3 +130,18 @@ class PacmanManager(PackageManager):
def get_lock_files(self) -> List[Path]:
return [Path("/var/lib/pacman/db.lck")]
def verify_db_consistency(self) -> "Tuple[bool, str]":
lock_p = Path("/var/lib/pacman/db.lck")
if lock_p.exists():
return False, f"Stale pacman database lock: {lock_p}"
return True, "Pacman database is consistent."
def repair_db(self) -> CommandResult:
lock_p = Path("/var/lib/pacman/db.lck")
if lock_p.exists():
try:
lock_p.unlink()
except Exception:
pass
return CommandResult(0, "Pacman database checked.", "", True)