From 950dd4538ee801cc6bf4f39cd9a462452895ca54 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Thu, 26 Jun 2025 11:05:15 +0300 Subject: [PATCH] support provides in aur --- src/ahriman/application/application/application.py | 10 +++++----- src/ahriman/core/alpm/remote/aur.py | 6 ++++-- src/ahriman/core/alpm/remote/official.py | 6 ++++-- src/ahriman/core/alpm/remote/remote.py | 8 +++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/ahriman/application/application/application.py b/src/ahriman/application/application/application.py index f6032a5c..e8c50159 100644 --- a/src/ahriman/application/application/application.py +++ b/src/ahriman/application/application/application.py @@ -133,18 +133,18 @@ class Application(ApplicationPackages, ApplicationRepository): if not process_dependencies or not packages: return packages - def missing_dependencies(source: Iterable[Package]) -> dict[str, str | None]: + def missing_dependencies(sources: Iterable[Package]) -> dict[str, str | None]: # append list of known packages with packages which are in current sources satisfied_packages = known_packages | { single - for package in source - for single in package.packages_full + for source in sources + for single in source.packages_full } return { dependency: package.packager - for package in source - for dependency in package.depends_build + for source in sources + for dependency in source.depends_build if dependency not in satisfied_packages } diff --git a/src/ahriman/core/alpm/remote/aur.py b/src/ahriman/core/alpm/remote/aur.py index d7df1a91..f1c7cd2c 100644 --- a/src/ahriman/core/alpm/remote/aur.py +++ b/src/ahriman/core/alpm/remote/aur.py @@ -133,15 +133,17 @@ class AUR(Remote): except StopIteration: raise UnknownPackageError(package_name) from None - def package_search(self, *keywords: str, pacman: Pacman | None) -> list[AURPackage]: + def package_search(self, *keywords: str, pacman: Pacman | None, search_by: str | None) -> list[AURPackage]: """ search package in AUR web Args: *keywords(str): keywords to search pacman(Pacman | None): alpm wrapper instance, required for official repositories search + search_by(str | None): search by keywords Returns: list[AURPackage]: list of packages which match the criteria """ - return self.aur_request("search", *keywords, by="name-desc") + search_by = search_by or "name-desc" + return self.aur_request("search", *keywords, by=search_by) diff --git a/src/ahriman/core/alpm/remote/official.py b/src/ahriman/core/alpm/remote/official.py index e931b1f9..466f29e4 100644 --- a/src/ahriman/core/alpm/remote/official.py +++ b/src/ahriman/core/alpm/remote/official.py @@ -127,15 +127,17 @@ class Official(Remote): except StopIteration: raise UnknownPackageError(package_name) from None - def package_search(self, *keywords: str, pacman: Pacman | None) -> list[AURPackage]: + def package_search(self, *keywords: str, pacman: Pacman | None, search_by: str | None) -> list[AURPackage]: """ search package in AUR web Args: *keywords(str): keywords to search pacman(Pacman | None): alpm wrapper instance, required for official repositories search + search_by(str | None): search by keywords Returns: list[AURPackage]: list of packages which match the criteria """ - return self.arch_request(*keywords, by="q") + search_by = search_by or "q" + return self.arch_request(*keywords, by=search_by) diff --git a/src/ahriman/core/alpm/remote/remote.py b/src/ahriman/core/alpm/remote/remote.py index 6e11b896..3acb0460 100644 --- a/src/ahriman/core/alpm/remote/remote.py +++ b/src/ahriman/core/alpm/remote/remote.py @@ -114,7 +114,7 @@ class Remote(SyncHttpClient): raise NotImplementedError @classmethod - def search(cls, *keywords: str, pacman: Pacman | None = None) -> list[AURPackage]: + def search(cls, *keywords: str, pacman: Pacman | None = None, search_by: str | None = None) -> list[AURPackage]: """ search package in AUR web @@ -122,11 +122,12 @@ class Remote(SyncHttpClient): *keywords(str): search terms, e.g. "ahriman", "is", "cool" pacman(Pacman | None, optional): alpm wrapper instance, required for official repositories search (Default value = None) + search_by(str | None, optional): search by keywords (Default value = None) Returns: list[AURPackage]: list of packages which match the criteria """ - return cls().package_search(*keywords, pacman=pacman) + return cls().package_search(*keywords, pacman=pacman, search_by=search_by) def package_info(self, package_name: str, *, pacman: Pacman | None) -> AURPackage: """ @@ -144,13 +145,14 @@ class Remote(SyncHttpClient): """ raise NotImplementedError - def package_search(self, *keywords: str, pacman: Pacman | None) -> list[AURPackage]: + def package_search(self, *keywords: str, pacman: Pacman | None, search_by: str | None) -> list[AURPackage]: """ search package in AUR web Args: *keywords(str): keywords to search pacman(Pacman | None): alpm wrapper instance, required for official repositories search + search_by(str | None): search by keywords Returns: list[AURPackage]: list of packages which match the criteria