Fix 3315 - package loading (#3317)

This commit is contained in:
Daniel Girtler 2025-03-31 16:44:53 +11:00 committed by GitHub
parent bab3653144
commit f837387d49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ from urllib.response import addinfourl
from ..exceptions import PackageError, SysCallError
from ..models.packages import AvailablePackage, LocalPackage, PackageSearch, PackageSearchResult, Repository
from ..output import debug
from ..pacman import Pacman
BASE_URL_PKG_SEARCH = 'https://archlinux.org/packages/search/json/'
@ -125,7 +126,12 @@ def list_available_packages(
current_package: list[str] = []
filtered_repos = [name for repo in repositories for name in repo.get_repository_list()]
for line in Pacman.run('-Sy --info'):
try:
Pacman.run("-Sy")
except Exception as e:
debug(f'Failed to sync Arch Linux package database: {e}')
for line in Pacman.run('-S --info'):
dec_line = line.decode().strip()
current_package.append(dec_line)