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