diff --git a/pym/update/update.py b/pym/update/update.py index e221ad0..5b34c45 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -1173,7 +1173,8 @@ class Update(MethodsInterface): hosts = self.clVars.Get("update.cl_update_binhost_host") if not hosts: self.clVars.Delete('cl_update_binhost', location="system") - raise UpdateError(_("Update server is unavailable")) + raise UpdateError(_("Failed to find the server with " + "appropriate updates")) if write_binhost: if hosts[0] != self.clVars.Get('update.cl_update_binhost'): self.refresh_binhost = True @@ -1181,9 +1182,7 @@ class Update(MethodsInterface): new_ts = self.clVars.Get("update.cl_update_binhost_timestamp") if new_ts: new_ts = new_ts[0] - old_ts = self.clVars.Get("update.cl_update_last_timestamp") - if new_ts.isdigit() and (not old_ts.isdigit() or - int(new_ts) > int(old_ts)): + if new_ts.isdigit(): ini = SystemIni(self.clVars) ini.setVar('update', {'last_update': new_ts}) if self.clVars.Get('cl_action') == 'sync': @@ -1226,10 +1225,12 @@ class Update(MethodsInterface): self.clVars.Set(varname, new_value, force=True) if not changes: self.clVars.Delete('cl_update_binhost', location="system") - raise UpdateError(_("Update server is unavailable")) + raise UpdateError(_("Failed to find the server with " + "appropriate updates")) except DataVarsError: self.clVars.Delete('cl_update_binhost', location="system") - raise UpdateError(_("Update server is unavailable")) + raise UpdateError(_("Failed to find the server with " + "appropriate updates")) return True def drop_binhosts(self, dv): diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index 808c5fa..38b345c 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -304,6 +304,11 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable): binhost_list = self.Get('cl_update_binhost_list') else: binhost_list = self.Get('cl_update_binhost_unstable_list') + if (self.GetBool('cl_update_binhost_stable_opt_set') and + not self.GetBool('cl_update_binhost_stable_set')): + stabilization = True + else: + stabilization = False binhosts_data = Binhosts( self.GetInteger('cl_update_binhost_timeout'), self.Get('cl_update_binhost_revision_path'), @@ -318,8 +323,8 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable): ts, t, good, downgrade = binhosts_data.get_timestamp(binhost) # условие актуальности текущего сервера if ts and good and not downgrade: - data = binhosts_data.check_binhost(binhost) - if data: + status, data = binhosts_data.check_binhost(binhost) + if status == binhosts_data.BinhostStatus.Success: return [[binhost, data, ts, str(t)]] logger = self.get_logger(stub=binhosts_data.is_cache()) @@ -328,28 +333,38 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable): date=time.ctime(), ts=last_ts)) for host, ts, t, good, downgrade in binhosts_data.get_sorted(): if ret_val is None: - data = binhosts_data.check_binhost(host) + status, data = binhosts_data.check_binhost(host) else: - data = "" + status, data = binhosts_data.BinhostStatus.UnknownError, "" if not good: if ts == "0": - reason = "FAILED" + reason = "FAILED (Wrong binhost)" + data = "" t = 0 else: reason = "OUTDATED" elif downgrade: reason = "SKIP" elif not data and ret_val is None: - reason = "UPDATING" + errors = { + binhosts_data.BinhostStatus.Updating: "UPDATING", + binhosts_data.BinhostStatus.BadEnv: + "FAILED (Bad env)", + binhosts_data.BinhostStatus.EnvNotFound: + "FAILED (Env not found)", + } + reason = errors.get(status, "FAILED (Unknown)") else: reason = "" + if ret_val is None and data and ( + not downgrade or stabilization): + ret_val = [[host, data, ts, str(t)]] + host = "-> %s" % host logger.info("{host:<60} {speed:<7} {timestamp:<10} {reason}".format( host=host, speed=float(t) / 1000.0, timestamp=ts, reason=reason)) - if ret_val is None and data and not downgrade: - ret_val = [[host, data, ts, str(t)]] return ret_val or [[]] @@ -475,7 +490,7 @@ class VariableClUpdateSyncOverlayRep(ReadonlyVariable): def get(self): return filter(lambda x: x not in ("portage", "gentoo"), - self.Get('cl_update_sync_rep')) + self.Get('cl_update_sync_rep')) class VariableClUpdateOutdateSet(ReadonlyVariable): @@ -1510,6 +1525,7 @@ class VariableClUpdateBinhostList(Variable): type = "list" value = ["ftp://ftp.calculate-linux.ru/calculate"] + class VariableClUpdateBinhostUnstableList(Variable): """ Список хостов с бинарными обновлениями @@ -1517,6 +1533,7 @@ class VariableClUpdateBinhostUnstableList(Variable): type = "list" value = ["ftp://ftp.calculate-linux.ru/testing"] + class VariableClUpdateBinhostStableSet(Variable): """ Удлять лишние файлы из репозиториев (например созданные пользователем) @@ -1524,6 +1541,7 @@ class VariableClUpdateBinhostStableSet(Variable): type = "bool" value = "on" + class VariableClUpdateBinhostStableOptSet(Variable): """ Удлять лишние файлы из репозиториев (например созданные пользователем) @@ -1554,10 +1572,7 @@ class VariableClUpdateBinhostRevisionPath(Variable): """ type = "list" value = [ - "grp/default/ini.env", - "grp/kde/ini.env", - "grp/server/ini.env", - "grp/x/ini.env" + "grp/ini.env" ] @@ -1608,6 +1623,7 @@ class VariableClUpdateEixRepositories(ReadonlyVariable): """ Отображаемый список обновляемых репозиториев eix """ + def get(self): return ", ".join( x.capitalize() for x in chain( diff --git a/pym/update/wsdl_update.py b/pym/update/wsdl_update.py index be82b51..4d08f69 100644 --- a/pym/update/wsdl_update.py +++ b/pym/update/wsdl_update.py @@ -68,6 +68,7 @@ class Wsdl(WsdlBase): 'cl_update_binhost_stable_opt_set', 'cl_update_binhost_recheck_set', ), + expert=( 'cl_update_sync_only_set', 'cl_update_other_set',