From c131228cbc0a1f2cb676550b6c11c346220a1c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Wed, 24 Feb 2021 13:25:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BD=D0=B5=20=D0=B1?= =?UTF-8?q?=D1=8B=D0=BB=D0=BE=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=B2=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B8=D1=8F=D1=85=20=D0=B8=D0=BB=D0=B8=20/et?= =?UTF-8?q?c/portage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/update/update.py | 11 +++++++++++ pym/update/utils/cl_update.py | 22 +++++++++++++++++++--- pym/update/variables/update.py | 16 +++++++++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/pym/update/update.py b/pym/update/update.py index 3226657..c9e178c 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -51,6 +51,7 @@ from calculate.lib.utils.portage import (ReposConf, EmergeLog, EmergeLogNamedTask, VDB_PATH, PackageInformation, + PortageState, get_packages_files_directory, get_manifest_files_directory, get_remove_list) @@ -1723,3 +1724,13 @@ class Update(MethodsInterface): except IOError as e: self.printWARNING(str(e)) return True + + def save_portage_state_hash(self): + """ + Сохранить состояние + """ + ini = SystemIni(self.clVars) + ps = PortageState() + new_portage_state_hash = ps.get_state() + ini.setVar('system', {'portage_hash': new_portage_state_hash}) + return True diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index 8286e4e..05304ee 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -265,12 +265,24 @@ class ClUpdateAction(Action): 'method': 'Update.premerge("-uDN","@world")', 'condition': lambda Get: ( Get('cl_update_sync_only_set') == 'off' and - Get('cl_update_pretend_set') == 'on') + Get('cl_update_pretend_set') == 'on') and \ + (Get('cl_update_world') != "update" or + Get('cl_update_outdate_set') == 'on' or + Get('cl_update_settings_changes_set') == 'on' or + Get('cl_update_binhost_recheck_set') == 'on' or + Get('cl_update_force_fix_set') == 'on' or + Get('update.cl_update_package_cache_set') == 'on') }], }, {'name': 'update', - 'condition': lambda Get:Get('cl_update_pretend_set') == 'off', - }, + 'condition': lambda Get:Get('cl_update_pretend_set') == 'off' and \ + (Get('cl_update_world') != "update" or + Get('cl_update_outdate_set') == 'on' or + Get('cl_update_settings_changes_set') == 'on' or + Get('cl_update_binhost_recheck_set') == 'on' or + Get('cl_update_force_fix_set') == 'on' or + Get('update.cl_update_package_cache_set') == 'on') + }, {'name': 'update_other', 'condition': lambda Get: ( Get('cl_update_pretend_set') == 'off' and Get('cl_update_sync_only_set') == 'off') @@ -413,6 +425,10 @@ class ClUpdateAction(Action): 'depend': Tasks.failed_all("check_schedule") }, # сообщение удачного завершения при обновлении ревизии + {'name': 'update:save_portage_hash', + 'method': 'Update.save_portage_state_hash()', + }, + # сообщение удачного завершения при обновлении ревизии {'name': 'success_rev', 'message': __("System update finished!"), 'condition': lambda Get: (Get('cl_update_rev_set') == 'on' and diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index 8d5906f..497c7e5 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -33,7 +33,7 @@ from calculate.lib.configparser import ConfigParser from calculate.lib.cl_lang import setLocalTranslate from calculate.lib.utils.text import simplify_profiles, _u8 from calculate.lib.utils.git import Git, GitError -from calculate.lib.utils.portage import ReposConf +from calculate.lib.utils.portage import ReposConf, PortageState from ..profile import (RepositoryStorageSet, DEFAULT_BRANCH, LocalStorage, ProfileRepository, CacheStorage) @@ -378,6 +378,20 @@ class VariableClUpdateLastTimestamp(ReadonlyVariable): return ini.getVar('system', 'last_update') or "0" +class VariableClUpdateSettingsChangesSet(Variable): + """ + Определить были ли изменения в /etc/portage, /var/log/emerge.log + """ + type = Variable.Types.Boolean + + def get(self): + ini = SystemIni(self.parent) + old_portage_state_hash = ini.getVar('system', 'portage_hash') or "" + ps = PortageState() + new_portage_state_hash = ps.get_state() + return "on" if new_portage_state_hash != old_portage_state_hash else "off" + + class VariableClUpdateBranchName(Variable): """ Список доступных репозиторием