| | |
| | | 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) |
| | |
| | | |
| | | @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: |
| | |
| | | ), |
| | | 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", []), |
| | |
| | | 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: |