|
|
|
@ -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',
|
|
|
|
|