From 40c68b29c46f28a10cbba0d725afd4f055cb5d5a Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Fri, 20 Feb 2026 03:52:01 +0000
Subject: [PATCH] More tries at dep res
---
src/archrepobuild/aur.py | 6 ++++--
src/archrepobuild/resolver.py | 30 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/src/archrepobuild/aur.py b/src/archrepobuild/aur.py
index a2ca289..33643a5 100644
--- a/src/archrepobuild/aur.py
+++ b/src/archrepobuild/aur.py
@@ -38,6 +38,7 @@
out_of_date: datetime | None
first_submitted: datetime
last_modified: datetime
+ package_base: str
depends: list[str] = field(default_factory=list)
makedepends: list[str] = field(default_factory=list)
checkdepends: list[str] = field(default_factory=list)
@@ -50,8 +51,8 @@
@property
def git_url(self) -> str:
- """Get the git clone URL for this package."""
- return f"{AUR_GIT_URL}/{self.name}.git"
+ """Get the git clone URL for this package (using PackageBase)."""
+ return f"{AUR_GIT_URL}/{self.package_base}.git"
@property
def aur_url(self) -> str:
@@ -81,6 +82,7 @@
),
first_submitted=datetime.fromtimestamp(data["FirstSubmitted"]),
last_modified=datetime.fromtimestamp(data["LastModified"]),
+ package_base=data.get("PackageBase", data["Name"]),
depends=data.get("Depends", []),
makedepends=data.get("MakeDepends", []),
checkdepends=data.get("CheckDepends", []),
diff --git a/src/archrepobuild/resolver.py b/src/archrepobuild/resolver.py
index 027e550..70d9f3b 100644
--- a/src/archrepobuild/resolver.py
+++ b/src/archrepobuild/resolver.py
@@ -126,6 +126,36 @@
continue
if base_name in pkgs:
return repo
+
+ # Fallback: check provides via pacman -Sp
+ try:
+ # Use pacman -Sp --noconfirm to see if pacman can resolve it
+ result = subprocess.run(
+ ["pacman", "-Sp", "--noconfirm", base_name],
+ capture_output=True,
+ text=True,
+ )
+ if result.returncode == 0:
+ # Successfully resolved. Find what it resolved to.
+ # Output looks like: file:///var/cache/pacman/pkg/name-version...
+ output = result.stdout.strip().split("\n")[-1]
+ if output:
+ filename = output.split("/")[-1]
+ # The package name is before the version
+ import re
+ match = re.search(r"^(.*?)-[0-9].*", filename)
+ if match:
+ resolved_name = match.group(1)
+ # Now check which repo this resolved_name belongs to
+ # We already have resolved_name in our cache if it's in a repo
+ for repo, pkgs in self._pacman_cache.items():
+ if not include_all and repo not in OFFICIAL_REPOS:
+ continue
+ if resolved_name in pkgs:
+ return repo
+ except Exception as e:
+ logger.debug(f"Failed to resolve provides for {base_name}: {e}")
+
return None
def is_installed(self, name: str) -> bool:
--
Gitblit v1.10.0