mirror of https://github.com/Chizi123/Arch-autobuild-repo.git

Joel Grunbaum
21 hours ago 40c68b29c46f28a10cbba0d725afd4f055cb5d5a
More tries at dep res
2 files modified
36 ■■■■■ changed files
src/archrepobuild/aur.py 6 ●●●●● patch | view | raw | blame | history
src/archrepobuild/resolver.py 30 ●●●●● patch | view | raw | blame | history
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", []),
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: