From ac4cf20de9cff454953b4fed05d9108ae3fbf20b Mon Sep 17 00:00:00 2001 From: root Date: Thu, 15 Dec 2022 18:57:58 +0300 Subject: [PATCH] =?UTF-8?q?TG-86=20cl-update:=20Feature:=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=85=D1=8D=D1=88?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82?= =?UTF-8?q?=D0=B0=20world.=20=D0=9F=D1=80=D0=B8=20=D0=BD=D0=B5=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=D0=BF=D0=B0=D0=B4=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=81=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B5=D0=B4=D1=8B=D0=B4=D1=83=D1=89=D0=B8=D0=BC=20?= =?UTF-8?q?=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20-=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D1=8F=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=83=D1=81=D1=82=D0=B0=D1=80=D0=B5=D0=B2=D1=88=D0=B8=D1=85=20?= =?UTF-8?q?=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/update/update.py | 15 +++++++++++++++ pym/update/utils/cl_update.py | 10 +++++++++- pym/update/variables/update.py | 19 +++++++++++++++++++ setup.py | 2 +- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/pym/update/update.py b/pym/update/update.py index b13d047..9090b52 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -2040,6 +2040,21 @@ class Update(MethodsInterface): ini.delVar('system', 'portage_hash') return True + def save_world_state_hash(self): + ini = SystemIni(self.clVars) + ps = PortageState() + ps.paths = ['/var/lib/portage/world'] + new_world_state_hash = ps.get_state() + ini.setVar('system', {'world_hash': new_world_state_hash}) + + def drop_world_state_hash(self): + """ + Сбросить состояние + """ + ini = SystemIni(self.clVars) + ini.delVar('system', 'world_hash') + return True + def drop_packages_cache(self): packages_fn = self.clVars.Get('update.cl_update_package_cache') packages_sign_fn = self.clVars.Get('update.cl_update_package_cache_sign') diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index cd848d8..abe6192 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -272,7 +272,8 @@ class UpdateConditions(): task = EmergeLog(EmergeLogNamedTask(task_name)) return (bool(PackageList(task.list)[pkg]) or Get('cl_update_force_depclean_set') == 'on' - or Get('cl_update_outdated_kernel_set') == 'on') + or Get('cl_update_outdated_kernel_set') == 'on' + or Get('cl_update_world_hash_set') == 'on') return func @staticmethod @@ -501,6 +502,9 @@ class ClUpdateAction(Action): 'method': 'Update.drop_portage_state_hash()', 'depend': Tasks.failed() }, + {'name': 'drop_world_hash', + 'method': 'Update.drop_world_state_hash()', + 'depend': Tasks.failed()}, {'name': 'update:set_current_level', 'method': 'Update.update_increment_current_level()', 'depend': (Tasks.success() & Tasks.hasnot("interrupt") & @@ -521,6 +525,10 @@ class ClUpdateAction(Action): 'method': 'Update.save_portage_state_hash()', 'condition': lambda Get: Get('cl_update_sync_only_set') == 'off' }, + {'name': 'update:save_world_hash', + 'method': 'Update.save_world_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 282d669..d8ae0d1 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -2091,3 +2091,22 @@ class VariableClUpdateSavedTag(Variable): class VariableClUpdateSaveCurBinhost(Variable): value = " " + + +class VariableClUpdateWorldHashSet(Variable): + """ + Хэш world для проверки изменений + """ + type = Variable.Types.Boolean + value = "" + + def get(self): + if self.value: + return self.value + ini = SystemIni(self.parent) + old_world_state_hash = ini.getVar('system', 'world_hash') or "" + #меняем путь сборки хэша на world файл + ps = PortageState() + ps.paths = ['/var/lib/portage/world'] + new_world_state_hash = ps.get_state() + return "on" if new_world_state_hash != old_world_state_hash else "off" diff --git a/setup.py b/setup.py index 7467304..fd57928 100755 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ # limitations under the License. __app__ = "calculate-update" -__version__ = "3.2.2" #TODO bump version +__version__ = "3.7.3" #TODO bump version import os from glob import glob