mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 16:44:16 +02:00
[arch] fix: crashing when no AUR package name is informed to the AUR client
This commit is contained in:
@@ -113,6 +113,7 @@ class AURClient:
|
||||
return self.http_client.get_json(URL_SEARCH + words)
|
||||
|
||||
def get_info(self, names: Iterable[str]) -> Optional[List[dict]]:
|
||||
if names:
|
||||
try:
|
||||
res = self.http_client.get_json(URL_INFO + self._map_names_as_queries(names))
|
||||
except requests.exceptions.ConnectionError:
|
||||
@@ -195,7 +196,7 @@ class AURClient:
|
||||
self.logger.warning('No .SRCINFO found for {}'.format(name))
|
||||
self.logger.info('Checking if {} is based on another package'.format(name))
|
||||
# if was not found, it may be based on another package.
|
||||
infos = self.get_info({name})
|
||||
infos = self.get_info((name,))
|
||||
|
||||
if infos:
|
||||
info = infos[0]
|
||||
|
||||
@@ -264,6 +264,9 @@ class DependenciesAnalyser:
|
||||
aur_search = self.aur_client.search(dep_name)
|
||||
|
||||
if aur_search:
|
||||
aur_results = aur_search.get('results')
|
||||
|
||||
if aur_results:
|
||||
if dep_name == dep_exp:
|
||||
version_required, exp_op = None, None
|
||||
else:
|
||||
@@ -271,8 +274,7 @@ class DependenciesAnalyser:
|
||||
version_required = split_informed_dep[2]
|
||||
exp_op = split_informed_dep[1] if split_informed_dep[1] != '=' else '=='
|
||||
|
||||
for pkgname, pkgdata in self.aur_client.gen_updates_data(
|
||||
(aur_res['Name'] for aur_res in aur_search['results'])):
|
||||
for pkgname, pkgdata in self.aur_client.gen_updates_data((aur_res['Name'] for aur_res in aur_results)):
|
||||
if pkgname == dep_name or (dep_name in pkgdata['p']):
|
||||
try:
|
||||
if not version_required or match_required_version(pkgdata['v'], exp_op,
|
||||
@@ -382,6 +384,7 @@ class DependenciesAnalyser:
|
||||
raise PackageNotFoundException(dep_exp)
|
||||
|
||||
def _fill_aur_updates_data(self, pkgnames: Iterable[str], output_data: dict):
|
||||
if pkgnames:
|
||||
for pkgname, pkgdata in self.aur_client.gen_updates_data(pkgnames):
|
||||
output_data[pkgname] = pkgdata
|
||||
|
||||
@@ -516,6 +519,7 @@ class DependenciesAnalyser:
|
||||
if repo_providers_data:
|
||||
deps_data.update(repo_providers_data)
|
||||
|
||||
if aur_providers_no_data:
|
||||
for pkgname, pkgdata in self.aur_client.gen_updates_data(aur_providers_no_data):
|
||||
deps_data[pkgname] = pkgdata
|
||||
|
||||
|
||||
Reference in New Issue
Block a user