| | |
| | | from enum import Enum |
| | | from pathlib import Path |
| | | from concurrent.futures import ProcessPoolExecutor |
| | | from typing import Any |
| | | from typing import Any, TYPE_CHECKING |
| | | if TYPE_CHECKING: |
| | | from archrepobuild.repo import RepoManager |
| | | |
| | | from archrepobuild.aur import AURClient |
| | | from archrepobuild.config import Config, PackageOverride |
| | |
| | | self, |
| | | config: Config, |
| | | aur_client: AURClient, |
| | | repo: RepoManager | None = None, |
| | | ): |
| | | """Initialize builder. |
| | | |
| | | Args: |
| | | config: Application configuration |
| | | aur_client: AUR client for package info |
| | | repo: Optional repository manager for incremental registration |
| | | """ |
| | | self.config = config |
| | | self.aur_client = aur_client |
| | | self.repo = repo |
| | | self.resolver = DependencyResolver(aur_client) |
| | | self._lock_dir = config.repository.build_dir / ".locks" |
| | | self._executor: ProcessPoolExecutor | None = None |
| | |
| | | |
| | | final_results.append(result) |
| | | |
| | | if result.status == BuildStatus.FAILED: |
| | | if result.status == BuildStatus.SUCCESS: |
| | | if self.repo: |
| | | added = self.repo.add_packages(result) |
| | | if added: |
| | | logger.info(f"Added to repository: {', '.join(added)}") |
| | | # Refresh resolver cache to recognize the newly added packages |
| | | self.resolver._refresh_pacman_cache(sync=True) |
| | | elif result.status == BuildStatus.FAILED: |
| | | logger.error(f"Failed to process {pkg_name}, aborting") |
| | | if pkg_name == package: |
| | | return result |