изменено: pym/update/update.py

изменено:      pym/update/utils/cl_update.py
	изменено:      pym/update/variables/update.py
master 3.7.2.53
root 1 year ago
parent bbe7d914ce
commit 7644f43bd8

@ -1385,8 +1385,15 @@ class Update(MethodsInterface):
if hosts[0] != self.clVars.Get('update.cl_update_binhost'):
self.refresh_binhost = True
self.clVars.Set('cl_update_package_cache_set', 'on')
if not self.clVars.GetBool('update.cl_update_binhost_set'):
if self.clVars.GetBool('update.cl_update_binhost_recheck_set'):
self.clVars.Write('cl_update_binhost', hosts[0], location="system")
self.clVars.Write('cl_update_binhost_set', Variable.Off, location="system")
elif self.clVars.Get('cl_update_binhost_choice') and self.clVars.Get('cl_update_binhost_choice') != 'auto':
self.clVars.Write('cl_update_binhost', self.clVars.Get('cl_update_binhost_choice'), location="system")
self.clVars.Write('cl_update_binhost_set', Variable.On, location="system")
elif not self.clVars.GetBool('update.cl_update_binhost_set'):
self.clVars.Write('cl_update_binhost', hosts[0], location="system")
self.clVars.Write('cl_update_binhost_set', Variable.Off, location="system")
new_ts = self.clVars.Get("update.cl_update_binhost_timestamp")
if new_ts:
new_ts = new_ts[0]
@ -1573,10 +1580,11 @@ class Update(MethodsInterface):
self.clVars.Set('update.cl_update_binhost_recheck_set', Variable.On)
self.clVars.Set('cl_update_package_cache_set', Variable.Off, force=True)
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)
# 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') \
# and self.clVars.Get('update.cl_update_binhost_choice') != 'auto':
# self.clVars.Write('cl_update_binhost_set', Variable.On)
return True
class Reason():
@ -1622,16 +1630,24 @@ class Update(MethodsInterface):
def create_binhost_data(self):
dv = self.clVars
last_ts = dv.Get('cl_update_last_timestamp')
if not dv.Get('update.cl_update_binhost') and not dv.Get('update.cl_update_binhost_choice'):
if dv.Get('update.cl_update_binhost_choice') == 'auto'\
or 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 dv.Get('update.cl_update_binhost_choice'):
if dv.GetBool('update.cl_update_binhost_recheck_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')
elif dv.Get('update.cl_update_binhost_choice') and dv.Get('update.cl_update_binhost_choice') != 'auto':
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'):
elif dv.Get('update.cl_update_binhost') and dv.GetBool('update.cl_update_binhost_set') \
and dv.Get('update.cl_update_binhost_choice') != 'auto':
binhost = dv.Get('cl_update_binhost')
binhost_list = [binhost]
else:
@ -1800,6 +1816,12 @@ class Update(MethodsInterface):
Binhosts.check_packages_signature(
None, pi.get_value(), self.binhosts_data.gpg,
sign=packages_sign)
if self.clVars.Get('cl_update_binhost_choice') and self.clVars.Get(
'cl_update_binhost_choice') != 'auto':
self.clVars.Write('cl_update_binhost_set', 'on')
self.clVars.Write('cl_update_binhost', self.clVars.Get('cl_update_binhost_choice'))
# else:
# self.clVars.Write('cl_update_binhost', self.)
return True
except BinhostSignError:
for fn in (packages_fn, packages_sign_fn):
@ -1813,7 +1835,9 @@ class Update(MethodsInterface):
_("Current binhost {} has wrong signature").format(
binhost_url))
self.clVars.Write('cl_update_binhost', binhost_url)
self.clVars.Write('cl_update_binhost_set', 'on')
if self.clVars.Get('cl_update_binhost_choice') and self.clVars.Get('cl_update_binhost_choice') != 'auto':
self.clVars.Write('cl_update_binhost_set', 'on')
self.clVars.Write('cl_update_binhost', self.clVars.Get('cl_update_binhost_choice'))
return True
def get_migration_mirror_url(self, host, level):

@ -84,8 +84,9 @@ def get_synchronization_tasks(object_name):
'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search") &
(~AllTasks.success_one_of("check_current_binhost") |
AllTasks.success_all("sync_reps"))),
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'off' and
not Get("update.cl_update_binhost_choice")
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'off'# or
#(not Get("update.cl_update_binhost_recheck_set") and (not Get("update.cl_update_binhost_choice") != 'auto'
#or not Get("update.cl_update_binhost_choice")))
},
{'name': 'interrupt_on_no_leveled_binhost',
'method': Object("interrupt_on_no_leveled_binhost()"),
@ -129,7 +130,9 @@ def get_synchronization_tasks(object_name):
},
{'name': 'sync_reps:update_local_info_binhost',
'method': Object('update_local_info_binhost()'),
'condition': lambda Get: not Get("update.cl_update_binhost_choice")
'condition': lambda Get: Get("update.cl_update_binhost_choice") == 'auto'
or not Get("update.cl_update_binhost_choice")
or Get("update.cl_update_binhost_recheck_set")
},
{'name': 'sync_reps:update_binhost_list',
'essential': False,

@ -1732,17 +1732,25 @@ class VariableClUpdateBinhostChoice(Variable):
self.label = _("Packages mirror")
self.help = _("Url to download binary packages from")
def get(self):
if not self.value:
if self.GetBool("cl_update_binhost_set") and self.Get("cl_update_binhost"):
return self.Get("cl_update_binhost")
return self.value
def choice(self):
return self.Get("cl_update_binhost_list") + ['auto']
if self.GetBool("cl_update_binhost_set") and self.Get("cl_update_binhost"):
if self.Get("cl_update_binhost") not in self.Get("cl_update_binhost_list"):
return ['auto'] + [self.Get("cl_update_binhost")] + self.Get("cl_update_binhost_list")
return ['auto'] + self.Get("cl_update_binhost_list")
class VariableClUpdateNewBinhost(Variable):
def get(self):
if self.Get('cl_update_binhost_choice'):
binhost = self.Get('cl_update_binhost_choice')
if binhost == 'auto':
return self.Get('cl_update_binhost')
return binhost
if binhost != 'auto':
return binhost
return self.Get('cl_update_binhost')
@ -1839,7 +1847,9 @@ class VariableClUpdatePortageBinhost(ReadonlyVariable):
#value_format = "{update.cl_update_binhost}/grp/{os_arch_machine}"
def get(self):
if self.Get('update.cl_update_binhost_choice'):
if not self.Get('update.cl_update_binhost_recheck_set') \
and self.Get('update.cl_update_binhost_choice') \
and self.Get('update.cl_update_binhost_choice') != 'auto':
return f"{self.Get('update.cl_update_binhost_choice')}/grp/{self.Get('os_arch_machine')}"
return f"{self.Get('update.cl_update_binhost')}/grp/{self.Get('os_arch_machine')}"

Loading…
Cancel
Save