изменено: 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'): if hosts[0] != self.clVars.Get('update.cl_update_binhost'):
self.refresh_binhost = True self.refresh_binhost = True
self.clVars.Set('cl_update_package_cache_set', 'on') 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', 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") new_ts = self.clVars.Get("update.cl_update_binhost_timestamp")
if new_ts: if new_ts:
new_ts = new_ts[0] 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('update.cl_update_binhost_recheck_set', Variable.On)
self.clVars.Set('cl_update_package_cache_set', Variable.Off, force=True) self.clVars.Set('cl_update_package_cache_set', Variable.Off, force=True)
raise raise
self.clVars.Write('cl_update_binhost', url_binhost.split('/grp/')[0]) # self.clVars.Write('cl_update_binhost', url_binhost.split('/grp/')[0])
self.clVars.Set('update.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'): # if self.clVars.Get('update.cl_update_binhost_choice') \
self.clVars.Write('cl_update_binhost_set', Variable.On) # and self.clVars.Get('update.cl_update_binhost_choice') != 'auto':
# self.clVars.Write('cl_update_binhost_set', Variable.On)
return True return True
class Reason(): class Reason():
@ -1622,16 +1630,24 @@ class Update(MethodsInterface):
def create_binhost_data(self): def create_binhost_data(self):
dv = self.clVars dv = self.clVars
last_ts = dv.Get('cl_update_last_timestamp') 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.Write('cl_update_binhost_set', "off")
dv.Set('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') binhost = dv.Get('cl_update_binhost_choice')
if not binhost.startswith('https://') and not binhost.startswith('ftp://') and not binhost.startswith( if not binhost.startswith('https://') and not binhost.startswith('ftp://') and not binhost.startswith(
'http://'): 'http://'):
binhost = f"https://{binhost}" binhost = f"https://{binhost}"
binhost_list = [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 = dv.Get('cl_update_binhost')
binhost_list = [binhost] binhost_list = [binhost]
else: else:
@ -1800,6 +1816,12 @@ class Update(MethodsInterface):
Binhosts.check_packages_signature( Binhosts.check_packages_signature(
None, pi.get_value(), self.binhosts_data.gpg, None, pi.get_value(), self.binhosts_data.gpg,
sign=packages_sign) 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 return True
except BinhostSignError: except BinhostSignError:
for fn in (packages_fn, packages_sign_fn): for fn in (packages_fn, packages_sign_fn):
@ -1813,7 +1835,9 @@ class Update(MethodsInterface):
_("Current binhost {} has wrong signature").format( _("Current binhost {} has wrong signature").format(
binhost_url)) binhost_url))
self.clVars.Write('cl_update_binhost', 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 return True
def get_migration_mirror_url(self, host, level): 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") & 'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search") &
(~AllTasks.success_one_of("check_current_binhost") | (~AllTasks.success_one_of("check_current_binhost") |
AllTasks.success_all("sync_reps"))), AllTasks.success_all("sync_reps"))),
'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'off' and 'condition': lambda Get: Get('update.cl_update_use_migration_host') == 'off'# or
not Get("update.cl_update_binhost_choice") #(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', {'name': 'interrupt_on_no_leveled_binhost',
'method': Object("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', {'name': 'sync_reps:update_local_info_binhost',
'method': Object('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', {'name': 'sync_reps:update_binhost_list',
'essential': False, 'essential': False,

@ -1732,17 +1732,25 @@ class VariableClUpdateBinhostChoice(Variable):
self.label = _("Packages mirror") self.label = _("Packages mirror")
self.help = _("Url to download binary packages from") 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): 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): class VariableClUpdateNewBinhost(Variable):
def get(self): def get(self):
if self.Get('cl_update_binhost_choice'): if self.Get('cl_update_binhost_choice'):
binhost = self.Get('cl_update_binhost_choice') binhost = self.Get('cl_update_binhost_choice')
if binhost == 'auto': if binhost != 'auto':
return self.Get('cl_update_binhost') return binhost
return binhost
return self.Get('cl_update_binhost') return self.Get('cl_update_binhost')
@ -1839,7 +1847,9 @@ class VariableClUpdatePortageBinhost(ReadonlyVariable):
#value_format = "{update.cl_update_binhost}/grp/{os_arch_machine}" #value_format = "{update.cl_update_binhost}/grp/{os_arch_machine}"
def get(self): 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_choice')}/grp/{self.Get('os_arch_machine')}"
return f"{self.Get('update.cl_update_binhost')}/grp/{self.Get('os_arch_machine')}" return f"{self.Get('update.cl_update_binhost')}/grp/{self.Get('os_arch_machine')}"

Loading…
Cancel
Save