diff --git a/pym/update/update.py b/pym/update/update.py index ab4b8e5..bd398d6 100644 --- a/pym/update/update.py +++ b/pym/update/update.py @@ -1061,6 +1061,7 @@ class Update(MethodsInterface): def reconfigureProfileVars(self, profile_dv, chroot): """ Синхронизировать репозитории + Настройка переменных для выполнения синхронизации репозиториев """ dv = self.clVars @@ -1082,8 +1083,9 @@ class Update(MethodsInterface): dv.Set(var_name, profile_dv.Get(var_name), force=True) dv.Set('cl_chroot_path', chroot, force=True) except DataVarsError as e: - print str(e) - raise UpdateError(_("Wrong profile")) + error = UpdateError(_("Wrong profile")) + error.addon = e + raise error return True def setProfile(self, profile_shortname): @@ -1250,9 +1252,9 @@ class Update(MethodsInterface): if new_ts.isdigit(): ini = SystemIni(self.clVars) ini.setVar('system', {'last_update': new_ts}) - if self.clVars.Get('cl_action') == 'sync': - value = self.clVars.GetBool('cl_update_binhost_stable_set') - new_value = self.clVars.GetBool('cl_update_binhost_stable_opt_set') + if self.is_update_action(self.clVars.Get("cl_action")): + value = self.clVars.GetBool('update.cl_update_binhost_stable_set') + new_value = self.clVars.GetBool('update.cl_update_binhost_stable_opt_set') if value != new_value: self.clVars.Write( 'cl_update_binhost_stable_set', @@ -1260,6 +1262,9 @@ class Update(MethodsInterface): location="system") return True + def is_update_action(self, action): + return action == 'sync' + def save_with_bdeps(self): oldval = self.clVars.Get('cl_update_with_bdeps_set') newval = self.clVars.Get('cl_update_with_bdeps_opt_set') @@ -1288,41 +1293,45 @@ class Update(MethodsInterface): raise UpdateError( _("Failed to remove cached ini.env of binary repository")) try: - for varname in ('cl_update_package_cache', 'cl_update_package_cache_sign'): + for varname in ('update.cl_update_package_cache', + 'update.cl_update_package_cache_sign'): fn = self.clVars.Get(varname) if path.exists(fn): os.unlink(fn) except OSError: raise UpdateError( _("Failed to remove cached Package index")) + # удалить binhost + binhost_fn = self.inchroot( + self.clVars.Get("update.cl_update_portage_binhost_path")) + if path.exists(binhost_fn): + os.unlink(binhost_fn) return True - def update_binhost_list(self): + def update_binhost_list(self, dv=None): """ Обновить список binhost'ов после обновления до master веток :return: """ changes = False try: - dv = DataVarsUpdate() - dv.importUpdate() - dv.flIniFile() + if dv is None: + dv = DataVarsUpdate() + dv.importUpdate() + dv.flIniFile() for varname in ('update.cl_update_binhost_list', 'update.cl_update_binhost_unstable_list', 'update.cl_update_binhost_timestamp_path', - 'update.cl_update_gpg_keys', - 'cl_update_binhost_revision_path'): + 'update.cl_update_binhost_revision_path'): new_value = dv.Get(varname) old_value = self.clVars.Get(varname) if new_value != old_value: changes = True self.clVars.Set(varname, new_value, force=True) - except DataVarsError: + except DataVarsError as e: raise UpdateError(_("Failed to get values for binhost search")) - if self.is_gpg_changed(): - self.prepare_gpg() - elif not changes: + if not changes: return False self.create_binhost_data() return True @@ -1339,52 +1348,33 @@ class Update(MethodsInterface): dv.Invalidate('update.cl_update_rep_rev') return True - def is_gpg_changed(self): - """ - Проверить изменились ли открытые ключи - """ - gpg_force = self.clVars.Get('cl_update_gpg_force') - if gpg_force == "skip": - return False - gpg_keys = self.clVars.Get('cl_update_gpg_keys') - gpgdata = "" - for keyfn in gpg_keys: - if path.exists(keyfn): - gpgdata += readFile(keyfn) - new_gpgdata_md5 = hashlib.md5(gpgdata).hexdigest() - return all(new_gpgdata_md5 != x for x in self.gpgdata_md5) + def inchroot(self, fn): + return pathJoin(self.clVars.Get("cl_chroot_path"), fn) def prepare_gpg(self): """ Получить объект для проверки подписи, либо получить заглушку """ gpg_force = self.clVars.Get('cl_update_gpg_force') - gpg_keys = self.clVars.Get('cl_update_gpg_keys') + gpg_keys = [self.inchroot(x) + for x in self.clVars.Get('cl_update_gpg_keys')] if gpg_force == "skip": return True gpg = GPG(tempfile.mkdtemp(dir="/var/calculate/tmp/update", prefix="gpg-")) - gpgdata = "" for keyfn in gpg_keys: if path.exists(keyfn): try: key = readFile(keyfn) - gpgdata += key gpg.import_key(key) except GPGError as e: self.printWARNING(_("Failed to load public keys from '%s' " "for signature checking") % keyfn) - self.gpgdata_md5.append(hashlib.md5(gpgdata).hexdigest()) - if len(self.gpgdata_md5) > 1: - self.gpg_changed = True if not gpg.count_public(): if gpg_force == "force": raise UpdateError(_("Public keys for Packages signature checking not found")) else: return True - oldgpg = self.clVars.Get('update.cl_update_gpg') - if oldgpg: - oldgpg.close() self.clVars.Set('update.cl_update_gpg', gpg, force=True) return True @@ -1399,8 +1389,6 @@ class Update(MethodsInterface): pi.write(f) with writeFile("/tmp/Packages.org") as f: f.write(orig_packages) - #pi = PackagesIndex(orig_packages) - #pi.write(f) except (OSError, IOError): raise UpdateError(_("Failed to save Packages")) self.endTask(True) @@ -1428,16 +1416,17 @@ class Update(MethodsInterface): return True class Reason(object): - WrongBinhost = "wrong_binhost" - Outdated = "outdated" - Updating = "updating" - BadEnv = "badenv" - EnvNotFound = "noenv" - UnknownError = "unknown" - BadSign = "badsign" - Skip = "skip" - SkipSlower = "skipslower" - Success = "success" + Success = 0 + BadSign = 1 + Outdated = 2 + Skip = 3 + Updating = 4 + WrongBinhost = 5 + BadEnv = 6 + EnvNotFound = 7 + SkipSlower = 8 + UnknownError = 9 + @staticmethod def humanReadable(reason): @@ -1461,6 +1450,10 @@ class Update(MethodsInterface): "/var/log/calculate/binhost-scan.log"), formatter="%(message)s") + def get_arch_machine(self): + return self.clVars.Get('os_arch_machine') + + @variable_module("update") def create_binhost_data(self): dv = self.clVars last_ts = dv.Get('cl_update_last_timestamp') @@ -1469,14 +1462,16 @@ class Update(MethodsInterface): else: binhost_list = dv.Get('cl_update_binhost_unstable_list') self.binhosts_data = Binhosts( + # значение малозначимо, поэтому берётся из собирающей системы dv.GetInteger('cl_update_binhost_timeout'), dv.Get('cl_update_binhost_revision_path'), dv.Get('cl_update_binhost_timestamp_path'), last_ts, binhost_list, - dv.Get('os_arch_machine'), - gpg=dv.Get('cl_update_gpg')) + self.get_arch_machine(), + gpg=dv.Get('update.cl_update_gpg')) return True + @variable_module("update") def _search_best_binhost(self, binhosts_data, stabilization): if not self.clVars.Get('cl_ebuild_phase'): logger = self._get_binhost_logger() @@ -1486,6 +1481,7 @@ class Update(MethodsInterface): date=time.ctime(), ts=binhosts_data.last_ts)) retval = [] skip_check_status = False + actual_reason = self.Reason.UnknownError for binhost in sorted(binhosts_data.get_binhosts(), reverse=True): host = binhost.host if not binhost.valid: @@ -1520,12 +1516,21 @@ class Update(MethodsInterface): str(binhost.timestamp), str(binhost.duration)]) skip_check_status = True + if reason < actual_reason: + actual_reason = reason logger.info("{host:<60} {speed:<7} {timestamp:<10} {reason}".format( host=host, speed=float(binhost.duration) / 1000.0, timestamp=binhost.timestamp, reason=Update.Reason.humanReadable(reason))) if not retval: - raise UpdateError(_("Failed to find the server with appropriate updates")) + if actual_reason is self.Reason.BadSign: + raise UpdateError(_("Failed to find the reliable server with appropriate updates")) + elif actual_reason in (self.Reason.Outdated, + self.Reason.Skip, + self.Reason.Updating): + raise UpdateError(_("Failed to find the server with appropriate updates")) + else: + raise UpdateError(_("Failed to find the working server with updates")) return retval def check_current_binhost(self, binhost_url): @@ -1555,8 +1560,8 @@ class Update(MethodsInterface): raise UpdateError( _("Current binhost {} was downgraded").format(binhost_url)) if self.binhosts_data.gpg: - packages_fn = self.clVars.Get('cl_update_package_cache') - packages_sign_fn = self.clVars.Get('cl_update_package_cache_sign') + packages_fn = self.clVars.Get('update.cl_update_package_cache') + packages_sign_fn = self.clVars.Get('update.cl_update_package_cache_sign') if path.exists(packages_fn) and path.exists(packages_sign_fn): packages_sign = readFile(packages_sign_fn) pi = PackagesIndex(readFile(packages_fn)) @@ -1565,6 +1570,7 @@ class Update(MethodsInterface): Binhosts.check_packages_signature( None, pi.get_value(), self.binhosts_data.gpg, sign=packages_sign) + return True except BinhostSignError: for fn in (packages_fn, packages_sign_fn): if path.exists(fn): @@ -1572,16 +1578,13 @@ class Update(MethodsInterface): os.unlink(fn) except OSError: pass - raise UpdateError( - _("Current binhost {} has wrong signature").format( - binhost_url)) - else: - if binhost.bad_sign: - raise UpdateError( - _("Current binhost {} has wrong signature").format( - binhost_url)) + if binhost.bad_sign: + raise UpdateError( + _("Current binhost {} has wrong signature").format( + binhost_url)) return True + @variable_module("update") def detect_best_binhost(self): # выполняется переход с серверов unstable обновлней на stable # в этом случае не важно, что бинари могут старее текущих @@ -1600,10 +1603,16 @@ class Update(MethodsInterface): self.endTask() return True - def check_sign_change(self): - if self.gpg_changed: - self.printWARNING(_("Public GPG key was updated")) - self.gpg_changed = False - self.clVars.Set('update.cl_update_outdate_set', Variable.On, force=True) - return True - return False + def update_layman(self, chroot_path): + """ + Обновить базу layman + :param builder_path: + :return: + """ + cmd = "/usr/bin/layman" + cmd_path = self.get_prog_path(cmd) + if not cmd_path: + raise UpdateError(_("Failed to find the %s command") % cmd) + layman = CommandExecutor(cmd_path, ["-f"], logfile=logfile) + layman.execute() + return layman.success() diff --git a/pym/update/utils/cl_update.py b/pym/update/utils/cl_update.py index 5af18d6..7ffb7c3 100644 --- a/pym/update/utils/cl_update.py +++ b/pym/update/utils/cl_update.py @@ -23,7 +23,7 @@ from calculate.lib.utils.files import FilesError, readFile from calculate.update.update import UpdateError from calculate.update.emerge_parser import EmergeError from calculate.lib.utils.git import GitError -from calculate.lib.utils.portage import (EmergeLog, +from calculate.lib.utils.portage import (EmergeLog, isPkgInstalled, EmergeLogNamedTask, PackageList) from calculate.update.update_tasks import EmergeMark @@ -32,6 +32,185 @@ setLocalTranslate('cl_update3', sys.modules[__name__]) __ = getLazyLocalTranslate(_) +def get_synchronization_tasks(object_name): + Object = lambda s: "%s.%s"%(object_name, s) + return [ + + {'name': 'reps_synchronization', + 'group': __("Repositories synchronization"), + 'tasks': [ + # создать объект проверки PGP + {'name': 'prepare_gpg', + 'method': Object("prepare_gpg()"), + }, + # создать объект хранилище серверов обновлений + {'name': 'create_binhost_data', + 'method': Object('create_binhost_data()') + }, + # проверить валиден ли текущий хост + {'name': 'check_current_binhost', + 'message': __("Checking current binhost"), + 'essential': False, + 'method': Object('check_current_binhost(update.cl_update_binhost)'), + 'condition': lambda GetBool, Get: ( + not GetBool('update.cl_update_binhost_recheck_set') and + Get('update.cl_update_sync_rep') and + Get('update.cl_update_binhost')) + }, + {'name': 'not_use_search:failed_base_binhost', + 'error': __("Failed to use base binhost"), + 'depend': AllTasks.failed_all("check_current_binhost") + }, + {'name': 'group_find_binhost', + 'group': '', + 'while': (~AllTasks.has_any("detect_best_binhost") & + ((AllTasks.failed_all("update_packages_cache") + & ~AllTasks.has_any("not_use_search")) | + ~AllTasks.has_any("sync_reps"))) & Tasks.success(), + 'condition': lambda GetBool, Get: (GetBool('update.cl_update_usetag_set') and + Get('update.cl_update_sync_rep')), + 'tasks': [ + # найти лучший сервер обновлений + {'name': 'detect_best_binhost', + 'method': Object('detect_best_binhost()'), + 'essential': False, + 'depend': (Tasks.success() & ~AllTasks.has_any("not_use_search") & + (~AllTasks.success_one_of("check_current_binhost") | + AllTasks.success_all("sync_reps"))), + }, + # запасная синхронизация, в ходе которой ветки обновляются до + # master + {'name': 'sync_reps_fallback', + 'foreach': 'update.cl_update_sync_rep', + 'message': + __("Fallback syncing the {eachvar:capitalize} repository"), + 'method': Object('syncRepositories(eachvar,True)'), + 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"), + }, + # обновление переменных информации из binhost + {'name': 'sync_reps_fallback:update_binhost_list', + 'method': Object('update_binhost_list()'), + 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"), + }, + # найти лучший сервер обновлений + {'name': 'sync_reps_fallback:detect_best_binhost', + 'method': Object('detect_best_binhost()'), + 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"), + }, + {'name': 'sync_reps', + 'foreach': 'update.cl_update_sync_rep', + 'message': __("Checking {eachvar:capitalize} updates"), + 'method': Object('syncRepositories(eachvar)'), + 'condition': lambda Get: Get('update.cl_update_sync_rep'), + 'depend': Tasks.success() & ~AllTasks.success_all("update_packages_cache") + }, + {'name': 'sync_reps:update_local_info_binhost', + 'method': Object('update_local_info_binhost()'), + }, + {'name': 'sync_reps:update_binhost_list', + 'essential': False, + 'method': Object('update_binhost_list()'), + 'condition': lambda GetBool: GetBool('update.cl_update_outdate_set') + }, + {'name': 'sync_reps:update_packages_cache', + 'message': __("Update packages index"), + 'method': Object('download_packages(update.cl_update_portage_binhost,' + 'update.cl_update_package_cache,update.cl_update_package_cache_sign,' + 'update.cl_update_gpg)'), + 'essential': False, + 'condition': lambda Get, GetBool: ( + Get('update.cl_update_package_cache') and ( + Get('update.cl_update_outdate_set') == 'on' or + Get('update.cl_update_package_cache_set') == 'on')) + }, + ], + }, + {'name': 'no_server', + 'error': __("Failed to find the binary updates server"), + 'method': Object("delete_binhost()"), + # method: который должен удалить текущую информацию о сервере обновлений + 'depend': (Tasks.failed() | + Tasks.success() & AllTasks.failed_one_of("update_packages_cache")), + 'condition': lambda GetBool, Get: (GetBool('update.cl_update_usetag_set') and + Get('update.cl_update_sync_rep')), + }, + {'name': 'sync_reps', + 'foreach': 'update.cl_update_sync_rep', + 'message': __("Checking {eachvar:capitalize} updates"), + 'method': Object('syncRepositories(eachvar)'), + 'condition': lambda Get, GetBool: (Get('update.cl_update_sync_rep') and + not GetBool('update.cl_update_usetag_set')), + }, + {'name': 'update_layman', + 'message': __("Layman cache update"), + 'method': "Update.update_layman()", + 'condition': lambda Get: isPkgInstalled( + "app-portage/layman", prefix=Get('cl_chroot_path')), + 'essential': False, + }, + {'name': 'sync_other_reps', + 'foreach': 'update.cl_update_other_rep_name', + 'message': __("Syncing the {eachvar:capitalize} repository"), + 'method': Object('syncLaymanRepository(eachvar)'), + 'condition': lambda Get: Get('update.cl_update_other_set') == 'on' + }, + {'name': 'trim_reps', + 'foreach': 'update.cl_update_sync_rep', + 'message': __("Cleaning the history of the " + "{eachvar:capitalize} repository"), + 'method': Object('trimRepositories(eachvar)'), + 'condition': lambda Get: (Get('update.cl_update_sync_rep') and + Get('update.cl_update_onedepth_set') == 'on') + }, + {'name': 'sync_reps:regen_cache', + 'foreach': 'update.cl_update_sync_overlay_rep', + 'essential': False, + 'method': Object('regenCache(eachvar)'), + 'condition': ( + lambda Get: (Get('update.cl_update_outdate_set') == 'on' and + Get('update.cl_update_egencache_force') != 'skip' or + Get('update.cl_update_egencache_force') == 'force')) + }, + {'name': 'sync_other_reps:regen_other_cache', + 'foreach': 'update.cl_update_other_rep_name', + 'method': Object('regenCache(eachvar)'), + 'essential': False, + }, + {'name': 'eix_update', + 'message': __("Updating the eix cache for " + "{update.cl_update_eix_repositories}"), + 'method': Object('eixUpdate(cl_repository_name)'), + 'condition': ( + lambda Get: (Get('update.cl_update_outdate_set') == 'on' and + Get('update.cl_update_eixupdate_force') != 'skip' or + Get('update.cl_update_eixupdate_force') == 'force')) + }, + {'name': 'update_setup_cache', + 'message': __("Updating the cache of configurable packages"), + 'method': Object('updateSetupCache()'), + 'essential': False, + 'condition': lambda Get: Get('update.cl_update_outdate_set') == 'on' + }, + {'name': 'sync_reps:cleanpkg', + 'message': __("Removing obsolete distfiles and binary packages"), + 'method': Object('Update.cleanpkg()'), + 'condition': ( + lambda Get: Get('update.cl_update_cleanpkg_set') == 'on' and + Get('update.cl_update_outdate_set') == 'on'), + 'essential': False + }, + # сообщение удачного завершения при обновлении репозиториев + {'name': 'success_syncrep', + 'message': __("Synchronization finished"), + 'depend': (Tasks.success() & Tasks.has_any("sync_reps", + "sync_other_reps", + "emerge_metadata", + "eix_update")), + } + ] + }, + ] + class UpdateConditions(object): @staticmethod def was_installed(pkg, task_name): @@ -192,193 +371,8 @@ class ClUpdateAction(Action): {'name': 'check_run', 'method': 'Update.checkRun(cl_update_wait_another_set)' }, - {'name': 'reps_synchronization', - 'group': __("Repositories synchronization"), - 'tasks': [ - # создать объект проверки PGP - {'name': 'prepare_gpg', - 'method': 'Update.prepare_gpg()', - }, - # создать объект хранилище серверов обновлений - {'name': 'create_binhost_data', - 'method': 'Update.create_binhost_data()' - }, - # проверить валиден ли текущий хост - {'name': 'check_current_binhost', - 'message': __("Checking current binhost"), - 'essential': False, - 'method': 'Update.check_current_binhost(cl_update_binhost)', - 'condition': lambda GetBool, Get: ( - not GetBool('cl_update_binhost_recheck_set') and - Get('cl_update_sync_rep') and - Get('cl_update_binhost')) - }, - {'name': 'group_find_binhost', - 'group': '', - 'while': ((~AllTasks.has_any("detect_best_binhost") | - AllTasks.success_all("check_sign_change")) & - (AllTasks.failed_all("update_packages_cache") | - ~AllTasks.has_any("sync_reps"))) & Tasks.success(), - 'condition': lambda GetBool, Get: (GetBool('cl_update_usetag_set') and - Get('cl_update_sync_rep')), - 'tasks': [ - {'name': 'search_again_message', - 'warning': __("Binhost will be searched again"), - 'depend': AllTasks.success_all("check_sign_change") - }, - # найти лучший сервер обновлений - {'name': 'detect_best_binhost', - 'method': 'Update.detect_best_binhost()', - 'essential': False, - 'depend': Tasks.success() & (~AllTasks.success_one_of("check_current_binhost") | - AllTasks.success_all("sync_reps")), - }, - # запасная синхронизация, в ходе которой ветки обновляются до - # master - {'name': 'sync_reps_fallback', - 'foreach': 'cl_update_sync_rep', - 'message': - __("Fallback syncing the {eachvar:capitalize} repository"), - 'method': 'Update.syncRepositories(eachvar,True)', - 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"), - }, - # обновление переменных информации из binhost - {'name': 'sync_reps_fallback:update_binhost_list', - 'method': 'Update.update_binhost_list()', - 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"), - }, - # найти лучший сервер обновлений - {'name': 'sync_reps_fallback:detect_best_binhost', - 'method': 'Update.detect_best_binhost()', - 'depend': Tasks.success() & AllTasks.failed_one_of("detect_best_binhost"), - }, - {'name': 'sync_reps', - 'foreach': 'cl_update_sync_rep', - 'message': __("Checking {eachvar:capitalize} updates"), - 'method': 'Update.syncRepositories(eachvar)', - 'condition': lambda Get: Get('cl_update_sync_rep'), - 'depend': Tasks.success() & ~AllTasks.success_all("update_packages_cache") - }, - {'name': 'sync_reps:update_local_info_binhost', - 'method': 'Update.update_local_info_binhost()', - }, - {'name': 'sync_reps:update_binhost_list', - 'essential': False, - 'method': 'Update.update_binhost_list()', - 'condition': lambda GetBool: GetBool('cl_update_outdate_set') - }, - # проверить изменились ли GPG ключи - {'name': 'check_sign_change', - 'essential': False, - 'method': 'Update.check_sign_change()' - }, - {'name': 'sync_reps:update_packages_cache', - 'message': __("Update packages index"), - 'method': 'Update.download_packages(cl_update_portage_binhost,' - 'cl_update_package_cache,cl_update_package_cache_sign,' - 'cl_update_gpg)', - 'essential': False, - 'condition': lambda Get, GetBool: ( - Get('cl_update_package_cache') and ( - Get('cl_update_outdate_set') == 'on' or - Get('cl_update_package_cache_set') == 'on')) - }, - ], - }, - {'name': 'no_server', - 'error': __("Failed to find the server with appropriate updates"), - 'method': "Update.delete_binhost()", - # method: который должен удалить текущую информацию о сервере обновлений - 'depend': (Tasks.failed() | - Tasks.success() & AllTasks.failed_one_of("update_packages_cache")), - 'condition': lambda GetBool, Get: (GetBool('cl_update_usetag_set') and - Get('cl_update_sync_rep')), - }, - {'name': 'sync_reps', - 'foreach': 'cl_update_sync_rep', - 'message': __("Checking {eachvar:capitalize} updates"), - 'method': 'Update.syncRepositories(eachvar)', - 'condition': lambda Get, GetBool: (Get('cl_update_sync_rep') and - not GetBool('cl_update_usetag_set')), - }, - # TODO:DEBUG - {'name': 'debug', - 'error': "DEBUG:FAILED", - 'depend': Tasks.failed() - }, - {'name': 'debug', - 'error': "DEBUG:ALL OK", - }, - {'name': 'sync_other_reps', - 'foreach': 'cl_update_other_rep_name', - 'message': __("Syncing the {eachvar:capitalize} repository"), - 'method': 'Update.syncLaymanRepository(eachvar)', - 'condition': lambda Get: Get('cl_update_other_set') == 'on' - }, - {'name': 'trim_reps', - 'foreach': 'cl_update_sync_rep', - 'message': __("Cleaning the history of the " - "{eachvar:capitalize} repository"), - 'method': 'Update.trimRepositories(eachvar)', - 'condition': lambda Get: (Get('cl_update_sync_rep') and - Get('cl_update_onedepth_set') == 'on') - }, - {'name': 'sync_reps:regen_cache', - 'foreach': 'cl_update_sync_overlay_rep', - 'essential': False, - 'method': 'Update.regenCache(eachvar)', - 'condition': ( - lambda Get: (Get('cl_update_outdate_set') == 'on' and - Get('cl_update_egencache_force') != 'skip' or - Get('cl_update_egencache_force') == 'force')) - }, - {'name': 'sync_other_reps:regen_other_cache', - 'foreach': 'cl_update_other_rep_name', - 'method': 'Update.regenCache(eachvar)', - 'essential': False, - }, - {'name': 'emerge_metadata', - 'message': __("Metadata transfer"), - 'method': 'Update.emergeMetadata()', - 'condition': ( - lambda Get: (Get('cl_update_outdate_set') == 'on' and - Get('cl_update_metadata_force') != 'skip' or - Get('cl_update_metadata_force') == 'force')) - }, - {'name': 'eix_update', - 'message': __("Updating the eix cache for " - "{cl_update_eix_repositories}"), - 'method': 'Update.eixUpdate(cl_repository_name)', - 'condition': ( - lambda Get: (Get('cl_update_outdate_set') == 'on' and - Get('cl_update_eixupdate_force') != 'skip' or - Get('cl_update_eixupdate_force') == 'force')) - }, - {'name': 'update_setup_cache', - 'message': __("Updating the cache of configurable packages"), - 'method': 'Update.updateSetupCache()', - 'essential': False, - 'condition': lambda Get: Get('cl_update_outdate_set') == 'on' - }, - {'name': 'sync_reps:cleanpkg', - 'message': __("Removing obsolete distfiles and binary packages"), - 'method': 'Update.cleanpkg()', - 'condition': ( - lambda Get: Get('cl_update_cleanpkg_set') == 'on' and - Get('cl_update_outdate_set') == 'on'), - 'essential': False - }, - # сообщение удачного завершения при обновлении репозиториев - {'name': 'success_syncrep', - 'message': __("Synchronization finished"), - 'depend': (Tasks.success() & Tasks.has_any("sync_reps", - "sync_other_reps", - "emerge_metadata", - "eix_update")), - } - ] - }, - {'name': 'reps_synchronization', + ] + get_synchronization_tasks("Update") + [ + {'name': 'system_configuration', 'group': __("System configuration"), 'tasks': [ {'name': 'revision', diff --git a/pym/update/utils/cl_update_profile.py b/pym/update/utils/cl_update_profile.py index 3d99722..35b55c3 100644 --- a/pym/update/utils/cl_update_profile.py +++ b/pym/update/utils/cl_update_profile.py @@ -75,8 +75,6 @@ class ClUpdateProfileAction(Action): 'foreach': 'cl_update_profile_sync_rep', 'message': __("Syncing the {eachvar:capitalize} repository"), 'method': 'Update.syncRepositories(eachvar)', - # TODO: неиспользуемое условие - # 'condition': lambda Get: Get('cl_update_profile_sync_rep') }, {'name': 'sync_reps:regen_cache', 'foreach': 'cl_update_sync_overlay_rep', diff --git a/pym/update/variables/update.py b/pym/update/variables/update.py index 8e9b62e..342b728 100644 --- a/pym/update/variables/update.py +++ b/pym/update/variables/update.py @@ -531,7 +531,7 @@ class VariableClUpdateGpgForce(Variable): Принудительное действие с eix-update """ type = "choice" - value = "auto" + value = "force" opt = ["--check-sign"] syntax = "--{choice}-check-sign" metavalue = "MODE" @@ -1700,9 +1700,10 @@ class VariableClUpdatePackageCacheSet(Variable): def get(self): packages_fn = self.Get('cl_update_package_cache') + gpg = self.Get('cl_update_gpg') packages_asc_fn = self.Get('cl_update_package_cache_sign') if (not path.exists(packages_fn) or - not path.exists(packages_asc_fn)): + gpg and not path.exists(packages_asc_fn)): return "on" pi = PackagesIndex(readFile(packages_fn)) try: @@ -1796,3 +1797,10 @@ class VariableClUpdateUseDowngradeSet(ReadonlyVariable): """ return (self.GetBool("cl_update_binhost_stable_opt_set") and not self.GetBool("cl_update_binhost_stable_opt_set")) + + +class VariableClUpdatePortageBinhostPath(Variable): + """ + Файл в котором хранится параметр portage PORTAGE_BINHOST + """ + value = "/etc/portage/make.conf/binhost"