|
|
|
@ -1548,7 +1548,7 @@ class Update(MethodsInterface):
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@variable_module("update")
|
|
|
|
|
def _search_best_binhost(self, binhosts_data, stabilization, ignore_level=False):
|
|
|
|
|
def _search_best_binhost(self, binhosts_data, stabilization):
|
|
|
|
|
if not self.clVars.Get('cl_ebuild_phase'):
|
|
|
|
|
logger = self._get_binhost_logger()
|
|
|
|
|
if logger:
|
|
|
|
@ -1558,7 +1558,6 @@ class Update(MethodsInterface):
|
|
|
|
|
retval = []
|
|
|
|
|
skip_check_status = False
|
|
|
|
|
actual_reason = self.Reason.UnknownError
|
|
|
|
|
# highest_level_found = int(self.clVars.Get('update.cl_update_level'))
|
|
|
|
|
for binhost in sorted(binhosts_data.get_binhosts(), reverse=True):
|
|
|
|
|
host = binhost.host
|
|
|
|
|
if not binhost.valid:
|
|
|
|
@ -1580,11 +1579,6 @@ class Update(MethodsInterface):
|
|
|
|
|
else:
|
|
|
|
|
# SUCCESS
|
|
|
|
|
if not binhost.downgraded or stabilization:
|
|
|
|
|
# if not ignore_level and not self.is_binhost_level_valid(binhost):
|
|
|
|
|
# reason = self.Reason.LevelWrong
|
|
|
|
|
# if highest_level_found < binhost.level:
|
|
|
|
|
# highest_level_found = binhost.level
|
|
|
|
|
# else:
|
|
|
|
|
host = "-> %s" % host
|
|
|
|
|
reason = self.Reason.Success
|
|
|
|
|
else:
|
|
|
|
@ -1613,11 +1607,6 @@ class Update(MethodsInterface):
|
|
|
|
|
self.Reason.Skip,
|
|
|
|
|
self.Reason.Updating):
|
|
|
|
|
raise UpdateError(_("Failed to find the server with appropriate updates"))
|
|
|
|
|
# elif actual_reason is self.Reason.LevelWrong:
|
|
|
|
|
# self.clVars.Set('cl_update_max_level_found', highest_level_found)#TODO change to write
|
|
|
|
|
# self.set_migration_mode(True)
|
|
|
|
|
# #TODO add translation
|
|
|
|
|
# raise UpdateError(_("Failed to find the server with appropriate level of updates"))
|
|
|
|
|
else:
|
|
|
|
|
raise UpdateError(_("Failed to find the working server with updates"))
|
|
|
|
|
return retval
|
|
|
|
@ -1642,9 +1631,10 @@ class Update(MethodsInterface):
|
|
|
|
|
if not binhost_url in self.binhosts_data.binhost_list:
|
|
|
|
|
raise UpdateError(_("Current binhost is absent in list of update servers"))
|
|
|
|
|
binhost = self.binhosts_data.get_binhost(binhost_url)
|
|
|
|
|
cur_level_valid = self.check_current_level()
|
|
|
|
|
ignore_level = self.clVars.Get("cl_check_update_level") == Variable.Off
|
|
|
|
|
cur_level_valid = self.check_current_level() if not ignore_level else None
|
|
|
|
|
if binhost.valid and not binhost.outdated and not binhost.downgraded \
|
|
|
|
|
and (not cur_level_valid or self.is_binhost_level_valid(binhost)):
|
|
|
|
|
and (ignore_level or not cur_level_valid or self.is_binhost_level_valid(binhost)):
|
|
|
|
|
if binhost.status == self.binhosts_data.BinhostStatus.Success:
|
|
|
|
|
self.clVars.Set('update.cl_update_binhost_data',
|
|
|
|
|
[[binhost.host, binhost.data,
|
|
|
|
@ -1652,7 +1642,7 @@ class Update(MethodsInterface):
|
|
|
|
|
str(binhost.duration),
|
|
|
|
|
str(binhost.level)]],
|
|
|
|
|
force=True)
|
|
|
|
|
if not cur_level_valid:
|
|
|
|
|
if not ignore_level and not cur_level_valid:
|
|
|
|
|
self.pull_level_from_binhost(binhost)
|
|
|
|
|
self.endTask()
|
|
|
|
|
else:
|
|
|
|
@ -1666,7 +1656,7 @@ class Update(MethodsInterface):
|
|
|
|
|
raise UpdateError(
|
|
|
|
|
_("Binary packages on the current binhost {} "
|
|
|
|
|
"are older than local").format(binhost_url))
|
|
|
|
|
elif not self.is_binhost_level_valid(binhost):
|
|
|
|
|
elif not ignore_level and not self.is_binhost_level_valid(binhost):
|
|
|
|
|
# self.stash_binhost(binhost_url)
|
|
|
|
|
self.set_migration_mode(True)
|
|
|
|
|
#TODO translate
|
|
|
|
@ -1712,25 +1702,26 @@ class Update(MethodsInterface):
|
|
|
|
|
stabilization = True
|
|
|
|
|
else:
|
|
|
|
|
stabilization = False
|
|
|
|
|
current_level_is_valid = self.check_current_level()
|
|
|
|
|
ignore_level = self.clVars.Get("cl_check_update_level") == Variable.Off
|
|
|
|
|
current_level_is_valid = self.check_current_level() if not ignore_level else None
|
|
|
|
|
self.startTask(_("Searching new binhost"))
|
|
|
|
|
retval = self._search_best_binhost(self.binhosts_data,
|
|
|
|
|
stabilization,
|
|
|
|
|
ignore_level = not current_level_is_valid)
|
|
|
|
|
stabilization)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.clVars.Set('update.cl_update_binhost_data',
|
|
|
|
|
retval or Variable.EmptyTable, force=True)
|
|
|
|
|
|
|
|
|
|
best_binhost_level = int(self.clVars.Get("update.cl_update_binhost_level")[0])
|
|
|
|
|
if not ignore_level:
|
|
|
|
|
best_binhost_level = int(self.clVars.Get("update.cl_update_binhost_level")[0])
|
|
|
|
|
|
|
|
|
|
if not current_level_is_valid:
|
|
|
|
|
self._set_update_level(best_binhost_level)
|
|
|
|
|
|
|
|
|
|
elif self.compare_update_level(best_binhost_level) != 0:
|
|
|
|
|
self.set_migration_mode(True)
|
|
|
|
|
#TODO reformulate, add translation
|
|
|
|
|
raise UpdateError(_("Update server's level is higher than local level"))
|
|
|
|
|
if not current_level_is_valid:
|
|
|
|
|
self._set_update_level(best_binhost_level)
|
|
|
|
|
|
|
|
|
|
elif self.compare_update_level(best_binhost_level) != 0:
|
|
|
|
|
self.set_migration_mode(True)
|
|
|
|
|
#TODO reformulate, add translation
|
|
|
|
|
raise UpdateError(_("Update server's level is higher than local level"))
|
|
|
|
|
|
|
|
|
|
self.endTask()
|
|
|
|
|
return True
|
|
|
|
|