mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-10 11:04:15 +02:00
[aur] reading all transitive dependencies of the selected optional dependencies before their installation
This commit is contained in:
@@ -32,9 +32,16 @@ class DependenciesAnalyser:
|
||||
|
||||
output.append((name, ''))
|
||||
|
||||
def get_missing_dependencies(self, names: Set[str], mirror: str = None) -> List[Tuple[str, str]]:
|
||||
def get_missing_packages(self, names: Set[str], mirror: str = None, in_analysis: Set[str] = None) -> List[Tuple[str, str]]:
|
||||
"""
|
||||
:param names:
|
||||
:param mirror:
|
||||
:param in_analysis: global set storing all names in analysis to avoid repeated recursion
|
||||
:return:
|
||||
"""
|
||||
global_in_analysis = in_analysis if in_analysis else set()
|
||||
|
||||
missing_names = pacman.check_missing(names)
|
||||
missing_names = pacman.check_missing({n for n in names if n not in in_analysis})
|
||||
|
||||
if missing_names:
|
||||
missing_root = []
|
||||
@@ -52,44 +59,50 @@ class DependenciesAnalyser:
|
||||
threads.clear()
|
||||
|
||||
# checking if there is any unknown dependency:
|
||||
for dep in missing_root:
|
||||
if not dep[1]:
|
||||
for rdep in missing_root:
|
||||
if not rdep[1]:
|
||||
return missing_root
|
||||
else:
|
||||
global_in_analysis.add(rdep[0])
|
||||
else:
|
||||
for missing in missing_names:
|
||||
missing_root.append((missing, mirror))
|
||||
global_in_analysis.add(missing)
|
||||
|
||||
missing_sub = []
|
||||
for dep in missing_root:
|
||||
subdeps = self.aur_client.get_all_dependencies(dep[0]) if dep[1] == 'aur' else pacman.read_dependencies(dep[0])
|
||||
for rdep in missing_root:
|
||||
subdeps = self.aur_client.get_all_dependencies(rdep[0]) if rdep[1] == 'aur' else pacman.read_dependencies(rdep[0])
|
||||
subdeps_not_analysis = {sd for sd in subdeps if sd not in global_in_analysis}
|
||||
|
||||
if subdeps:
|
||||
missing_subdeps = self.get_missing_dependencies(subdeps)
|
||||
if subdeps_not_analysis:
|
||||
missing_subdeps = self.get_missing_packages(subdeps_not_analysis, in_analysis=global_in_analysis)
|
||||
|
||||
# checking if there is any unknown:
|
||||
if missing_subdeps:
|
||||
for subdep in missing_subdeps:
|
||||
if not subdep[0]:
|
||||
missing_sub.extend(missing_subdeps)
|
||||
break
|
||||
|
||||
missing_sub.extend(missing_subdeps)
|
||||
return [*missing_subdeps, *missing_root]
|
||||
|
||||
if subdep[0] not in missing_names:
|
||||
missing_sub.append(subdep)
|
||||
return [*missing_sub, *missing_root]
|
||||
|
||||
def get_missing_dependencies_from(self, names: Set[str], mirror: str) -> List[Tuple[str, str]]:
|
||||
def get_missing_subdeps_of(self, names: Set[str], mirror: str) -> List[Tuple[str, str]]:
|
||||
missing = []
|
||||
for dep in names:
|
||||
subdeps = self.aur_client.get_all_dependencies(dep) if mirror == 'aur' else pacman.read_dependencies(dep)
|
||||
already_added = {*names}
|
||||
in_analyses = {*names}
|
||||
|
||||
for name in names:
|
||||
subdeps = self.aur_client.get_all_dependencies(name) if mirror == 'aur' else pacman.read_dependencies(name)
|
||||
|
||||
if subdeps:
|
||||
missing_subdeps = self.get_missing_dependencies(subdeps)
|
||||
missing_subdeps = self.get_missing_packages(subdeps, in_analysis=in_analyses)
|
||||
|
||||
if missing_subdeps:
|
||||
missing.extend(missing_subdeps)
|
||||
|
||||
for subdep in missing_subdeps: # checking if there is any unknown:
|
||||
if subdep[0] not in already_added:
|
||||
missing.append(subdep)
|
||||
|
||||
if not subdep[0]:
|
||||
return missing
|
||||
|
||||
return missing
|
||||
|
||||
Reference in New Issue
Block a user