cl-update: Fix: detect_best_binhost logic. Add tmp solution for

bad update level bug.
master 3.7.2.52
root 1 year ago
parent 5e2a3f16ca
commit bbe7d914ce

@ -1575,6 +1575,8 @@ class Update(MethodsInterface):
raise
self.clVars.Write('cl_update_binhost', url_binhost.split('/grp/')[0])
self.clVars.Set('update.cl_update_binhost', url_binhost.split('/grp/')[0])
if self.clVars.Get('update.cl_update_binhost_choice'):
self.clVars.Write('cl_update_binhost_set', Variable.On)
return True
class Reason():
@ -1623,23 +1625,20 @@ class Update(MethodsInterface):
if not dv.Get('update.cl_update_binhost') and not dv.Get('update.cl_update_binhost_choice'):
dv.Write('cl_update_binhost_set', "off")
dv.Set('cl_update_binhost_set', 'off')
if (not dv.Get('update.cl_update_binhost_choice') and not dv.GetBool('update.cl_update_binhost_set')) \
or dv.Get('update.cl_update_binhost_choice') == 'auto' \
or (dv.Get('update.cl_update_binhost') and not dv.GetBool('update.cl_update_binhost_set')):
if dv.Get('cl_update_binhost_stable_opt_set'):
binhost_list = dv.Get('cl_update_binhost_list')
else:
binhost_list = dv.Get('cl_update_binhost_unstable_list')
dv.Write('cl_update_binhost_set', "off")
else:
# if dv.Get('cl_update_binhost_choice'):
# dv.Write('cl_update_binhost', dv.Get('cl_update_binhost_choice'))
# dv.Write('cl_update_binhost_set', "on")
if dv.Get('update.cl_update_binhost_choice'):
binhost = dv.Get('cl_update_binhost_choice')
if not binhost.startswith('https://') and not binhost.startswith('ftp://') and not binhost.startswith(
'http://'):
binhost = f"https://{binhost}"
binhost_list = [binhost]
elif dv.Get('update.cl_update_binhost') and dv.GetBool('update.cl_update_binhost_set'):
binhost = dv.Get('cl_update_binhost')
binhost_list = [binhost]
else:
if dv.Get('cl_update_binhost_stable_opt_set'):
binhost_list = dv.Get('cl_update_binhost_list')
else:
binhost_list = dv.Get('cl_update_binhost_unstable_list')
self.binhosts_data = Binhosts(
# значение малозначимо, поэтому берётся из собирающей системы
@ -1654,12 +1653,6 @@ class Update(MethodsInterface):
@variable_module("update")
def _search_best_binhost(self, binhosts_data, stabilization, ignore_level=False):
try:
if self.clVars.Get("cl_update_binhost_choice"):
self.clVars.Set('update.cl_update_binhost', self.clVars.Get("cl_update_binhost_choice"))
return self.clVars.Get("cl_update_binhost_choice")
except:
pass
if not self.clVars.Get('cl_ebuild_phase'):
logger = self._get_binhost_logger()
if logger:
@ -1857,11 +1850,14 @@ class Update(MethodsInterface):
self._set_update_level(best_binhost_level)
else:
cmpr = self.compare_update_level(best_binhost_level)
if cmpr > 0:
if cmpr is None:
self.printWARNING("Failed to find working binhost. As a temporary solution you can use "
"'cl-update --mirror-update https://mirror.calculate-linux.org/migrate' command")
elif cmpr > 0:
self.set_migration_mode(True)
raise UpdateError(_("Current level: {} Binhost level: {}").\
format(self.clVars.Get("update.cl_update_level"), best_binhost_level))
if cmpr < 0:
elif cmpr < 0:
self.delete_binhost()
raise UpdateError(_("Failed to find binhost with level equal or higher than local level"))
self.endTask()

@ -1742,9 +1742,6 @@ class VariableClUpdateNewBinhost(Variable):
binhost = self.Get('cl_update_binhost_choice')
if binhost == 'auto':
return self.Get('cl_update_binhost')
elif not binhost.startswith('https://') and not binhost.startswith('ftp://') and not binhost.startswith(
'http://'):
binhost = f"https://{binhost}"
return binhost
return self.Get('cl_update_binhost')

Loading…
Cancel
Save