diff --git a/pym/update/update.py b/pym/update/update.py index 5b785ba..c2ee1ea 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -259,6 +259,8 @@ class Update(MethodsInterface): def raiseOutdate(self): self.clVars.Set('cl_update_outdate_set', 'on', force=True) + if self.clVars.Get('cl_update_other_set') == 'auto': + self.clVars.Set('cl_update_other_set', 'on') def setAutocheckParams(self, status, interval, update_other, cleanpkg): """ @@ -402,9 +404,9 @@ class Update(MethodsInterface): saved_host = dv.Get('cl_update_rep_hosting') if 'cl_update_rep_hosting' in dv.allVars else '' working_host = '' # проверка необходимости синхронизации других оверлеев - if dv.Get("cl_update_inner_other_set") != 'auto': - dv.Write("cl_update_other_set", dv.Get("cl_update_inner_other_set"), header="update") - dv.Set("cl_update_other_set", dv.Get("cl_update_inner_other_set")) + #if dv.Get("cl_update_other_set") != 'auto': + #dv.Write("cl_update_other_set", dv.Get("cl_update_inner_other_set"), header="update") + #dv.Set("cl_update_other_set", dv.Get("cl_update_inner_other_set")) if 'cl_update_rep_list' in dv.allVars and dv.Get('cl_update_rep_list'): chosen_hosting = dv.Get("cl_update_rep_hosting_choice") if chosen_hosting: @@ -590,6 +592,9 @@ class Update(MethodsInterface): self.stash_cache(rpath, repdirname) rpath_old = f"{rpath}_old" makeDirectory(rpath_old) + old_hash = PortageState() + old_hash.paths = [f'{rpath}'] + old_hash = old_hash.get_state() try: if Git.is_git(rpath): self.addProgress() @@ -617,6 +622,8 @@ class Update(MethodsInterface): finally: removeDir(rpath_old) self.unstash_cache(rpath, repdirname) + new_hash = PortageState() + new_hash.paths = [f'{rpath}'] return True def _regenCache_process(self, progname, repname, cpu_num): diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index a768618..37c6048 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -345,7 +345,9 @@ class ClUpdateAction(Action): '"-uDN","@world")', } ], - 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' + 'condition': lambda Get: (Get('cl_update_sync_only_set') == 'off' and + (Get('update.cl_update_outdate_set') == 'on' or + Get('cl_update_settings_changes_set') == 'on')) }, {'name': 'update_other:update_perl', 'group': __("Updating Perl modules"), @@ -441,7 +443,7 @@ class ClUpdateAction(Action): 'essential': False, 'condition': lambda Get: (Get('cl_update_sync_only_set') == 'off' and \ Get('cl_update_pretend_set') == 'off' and \ - UpdateConditions.check_world_updated_after_tag_save()()) + UpdateConditions.check_world_updated_after_tag_save()()) }, ] + get_synchronization_tasks("Update") + [ {'name': 'system_configuration', @@ -483,10 +485,7 @@ class ClUpdateAction(Action): 'depend': Tasks.failed_all("check_schedule") }, # сообщение удачного завершения при обновлении ревизии - {'name': 'update:save_portage_hash', - 'method': 'Update.save_portage_state_hash()', - 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' - }, + {'name': 'drop_portage_hash', 'method': 'Update.drop_portage_state_hash()', 'depend': Tasks.failed() @@ -507,6 +506,10 @@ class ClUpdateAction(Action): Get('cl_update_pretend_set') == 'off', 'decoration': 'Update.update_task("%s")' % EmergeMark.SaveTag }, + {'name': 'update:save_portage_hash', + 'method': 'Update.save_portage_state_hash()', + 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' + }, {'name': 'clear_migration_host', 'method': 'Update.delete_binhost()', 'depend': (Tasks.hasnot("check_schedule")), diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index d22b98a..5fa4570 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -448,15 +448,36 @@ class VariableClUpdateSettingsChangesSet(Variable): Определить были ли изменения в /etc/portage, /var/log/emerge.log """ type = Variable.Types.Boolean + value = '' def get(self): + if self.value: + return self.value ini = SystemIni(self.parent) old_portage_state_hash = ini.getVar('system', 'portage_hash') or "" ps = PortageState() new_portage_state_hash = ps.get_state() + a = new_portage_state_hash != old_portage_state_hash return "on" if new_portage_state_hash != old_portage_state_hash else "off" +class VariableClUpdateSettingsPortageSet(Variable): + """ + Определить были ли изменения в /etc/portage + """ + type = Variable.Types.Boolean + value = '' + + def get(self): + if self.value: + return self.value + ini = SystemIni(self.parent) + old_portage_state_hash = ini.getVar('system', 'portage_hash') or "" + ps = PortageState() + new_portage_state_hash = ps.get_state() + a = new_portage_state_hash != old_portage_state_hash + return "on" if new_portage_state_hash != old_portage_state_hash else "off" + class VariableClUpdateBranchName(Variable): """ Список доступных репозиторием @@ -532,9 +553,9 @@ class VariableClUpdateOutdateSet(ReadonlyVariable): type = "bool" def get(self): - if (self.Get('cl_update_other_set') == 'on' and - self.Get('cl_update_other_rep_name')): - return "on" + # if (self.Get('cl_update_other_set') == 'on' and + # self.Get('cl_update_other_rep_name')): + # return "on" return "off" @@ -636,37 +657,19 @@ class VariableClUpdateOtherSet(Variable): """ Обновить остальные оверлеи """ - type = "bool" - value = "on" - metavalue = _("Other overlays") + type = "boolauto" + opt = ["-o", "--update-other"] + metavalue = _("ON/OFF/AUTO") + value = Variable.Auto def init(self): self.label = _("Update other overlays") - self.help = _("Update other overlays") + self.help = _("Update other overlays. Updates other overlays while updating default overlays if value is not specified") def get(self): - if self.Get('cl_update_inner_other_set') != 'auto': - return self.Get('cl_update_inner_other_set') return self.value -class VariableClUpdateInnerOtherSet(Variable): - type = "bool3" - value = Variable.Auto - metavalue = 'ON/OFF' - opt = ["-o", "--update-other"] - - def init(self): - self.help = _("update other overlays") - self.label = _("Update other overlays") - - - # def get(self): - # if self.value in ["on", "off"]: - # return True - # return False - - class VariableClUpdateOtherRepData(ReadonlyTableVariable): """ Информация о прочих репозиториях @@ -2046,4 +2049,4 @@ class VariableClUpdateSavedTag(Variable): """ Сохраняемый тэг репозитория calculate """ - type = "int" \ No newline at end of file + type = "int" diff --git a/pym/update/wsdl_update.py b/pym/update/wsdl_update.py index a4d9077..41fc7ff 100644 --- a/pym/update/wsdl_update.py +++ b/pym/update/wsdl_update.py @@ -73,7 +73,7 @@ class Wsdl(WsdlBase): 'cl_update_rep_hosting_choice', ), expert=( - 'cl_update_inner_other_set', + 'cl_update_other_set', 'cl_update_sync_only_set', 'cl_update_pretend_set', 'cl_update_sync_rep', @@ -93,7 +93,6 @@ class Wsdl(WsdlBase): 'cl_update_cleanpkg_set', 'cl_update_branch_data', 'cl_templates_locate', - 'cl_update_inner_other_set', 'cl_verbose_set', 'cl_dispatch_conf'), next_label=_("Run"))]}, #