@ -15,23 +15,251 @@
# limitations under the License.
# limitations under the License.
import sys
import sys
from calculate . core . server . func import Action , Tasks
from calculate . core . server . func import Action , Tasks , AllTasks
from calculate . lib . cl_lang import setLocalTranslate , getLazyLocalTranslate
from calculate . lib . cl_lang import setLocalTranslate , getLazyLocalTranslate
from calculate . lib . cl_template import TemplatesError
from calculate . lib . cl_template import TemplatesError
from calculate . lib . utils . files import FilesError
from calculate . lib . utils . binhosts import BinhostError
from calculate . update . update import UpdateError
from calculate . lib . utils . files import FilesError , readFile
from calculate . update . emerge_parser import EmergeError
from . . update import UpdateError
from . . emerge_parser import EmergeError
from calculate . lib . utils . git import GitError
from calculate . lib . utils . git import GitError
from calculate . lib . utils . portage import ( EmergeLog ,
from calculate . lib . utils . portage import ( EmergeLog , isPkgInstalled ,
EmergeLogNamedTask , PackageList )
EmergeLogNamedTask , PackageList )
from calculate .update . update_tasks import EmergeMark
from .. update_tasks import EmergeMark
_ = lambda x : x
_ = lambda x : x
setLocalTranslate ( ' cl_update3 ' , sys . modules [ __name__ ] )
setLocalTranslate ( ' cl_update3 ' , sys . modules [ __name__ ] )
__ = getLazyLocalTranslate ( _ )
__ = getLazyLocalTranslate ( _ )
class UpdateConditions ( object ) :
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 ' : ' perform_migration_system_pre_check ' ,
' method ' : Object ( ' perform_migration_system_pre_check() ' ) ,
' condition ' : lambda Get , GetBool : ( Get ( ' cl_update_ignore_level ' ) == ' off ' )
} ,
# проверить валиден ли текущий хост
{ ' 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
not Get ( ' update.cl_update_binhost_choice ' ) and
Get ( ' update.cl_update_binhost_choice ' ) != ' auto ' and
Get ( ' update.cl_update_sync_rep ' ) and
Get ( ' update.cl_update_binhost ' ) and
Get ( ' update.cl_update_use_migration_host ' ) == ' off ' )
} ,
{ ' name ' : ' drop_packeges_cache ' ,
' method ' : ' Update.drop_packages_cache() ' ,
' depend ' : AllTasks . failed_all ( " check_current_binhost " )
} ,
{ ' name ' : ' not_use_search:failed_base_binhost ' ,
' error ' : __ ( " Failed to use base binhost " ) ,
' method ' : Object ( " delete_binhost() " ) ,
' depend ' : AllTasks . failed_all ( " check_current_binhost " )
} ,
{ ' name ' : ' check_chosen_binhost ' ,
' message ' : _ ( " Checking chosen binhost " ) ,
' method ' : Object ( ' check_chosen_binhost(update.cl_update_binhost_choice) ' ) ,
' essential ' : False ,
' condition ' : lambda GetBool , Get : (
not GetBool ( ' update.cl_update_binhost_recheck_set ' ) and
Get ( ' update.cl_update_binhost_choice ' ) and
Get ( ' update.cl_update_binhost_choice ' ) != ' auto ' ) ,
' depend ' : AllTasks . hasnot ( " check_current_binhost " ) } ,
{ ' name ' : ' failed_check_chosen_binhost ' ,
' method ' : Object ( ' check_if_migration() ' ) ,
' depend ' : AllTasks . failed_all ( " check_chosen_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 ( f ' detect_best_binhost( { object_name . lower ( ) } .cl_update_ignore_level) ' ) ,
' essential ' : False ,
' depend ' : ( Tasks . success ( ) & ~ AllTasks . has_any ( " not_use_search " ) &
( AllTasks . failed_one_of ( " check_current_binhost " ) |
AllTasks . failed_one_of ( " check_chosen_binhost " ) |
( AllTasks . hasnot ( " check_current_binhost " ) &
AllTasks . hasnot ( " check_chosen_binhost " ) ) |
AllTasks . success_all ( " sync_reps " ) ) ) ,
' condition ' : lambda Get : Get ( ' update.cl_update_use_migration_host ' ) == ' off ' ,
} ,
{ ' name ' : ' interrupt_on_no_leveled_binhost ' ,
' method ' : Object ( " interrupt_on_no_leveled_binhost() " ) ,
' essential ' : True ,
' depend ' : ( Tasks . success ( ) & ~ AllTasks . has_any ( " not_use_search " ) &
( ~ AllTasks . success_one_of ( " check_current_binhost " ) ) &
AllTasks . failed_all ( " detect_best_binhost " ) ) ,
' condition ' : lambda Get : Get ( ' update.cl_update_use_migration_host ' ) == ' off '
} ,
{ ' name ' : ' set_migration_binhost ' ,
' method ' : Object ( ' set_migration_host() ' ) ,
' depend ' : ( Tasks . success ( ) & ~ AllTasks . has_any ( " not_use_search " ) |
AllTasks . success_all ( " sync_reps " ) ) ,
' condition ' : lambda Get : Get ( ' update.cl_update_use_migration_host ' ) == ' on '
} ,
# запасная синхронизация, в ходе которой ветки обновляются до
# 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() ' ) ,
' condition ' : lambda Get : Get ( " update.cl_update_binhost_choice " ) == ' auto '
or not Get ( " update.cl_update_binhost_choice " )
or Get ( " update.cl_update_binhost_recheck_set " ) ,
' depend ' : AllTasks . hasnot ( ' check_chosen_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) ' ) ,
' 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 . has_any ( " failed_base_binhost " ) & ( 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_rep_list ' ,
' message ' : __ ( " Repository cache update " ) ,
' method ' : Object ( ' update_rep_list() ' ) ,
' condition ' : lambda Get : ( isPkgInstalled (
" app-eselect/eselect-repository " , prefix = Get ( ' cl_chroot_path ' ) ) and
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 ( ' syncOtherRepository(eachvar) ' ) ,
' condition ' : lambda GetBool : ( GetBool ( ' update.cl_update_other_set ' ) or
not GetBool ( ' update.cl_update_other_git_exists ' ) )
} ,
{ ' 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 ( ' 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 ( ) :
@staticmethod
@staticmethod
def was_installed ( pkg , task_name ) :
def was_installed ( pkg , task_name ) :
def func ( ) :
def func ( ) :
@ -44,9 +272,26 @@ class UpdateConditions(object):
def func ( Get ) :
def func ( Get ) :
task = EmergeLog ( EmergeLogNamedTask ( task_name ) )
task = EmergeLog ( EmergeLogNamedTask ( task_name ) )
return ( bool ( PackageList ( task . list ) [ pkg ] )
return ( bool ( PackageList ( task . list ) [ pkg ] )
or Get ( ' cl_update_outdated_kernel_set ' ) == ' on ' )
or Get ( ' cl_update_force_depclean_set ' ) == ' on '
or Get ( ' cl_update_outdated_kernel_set ' ) == ' on '
or Get ( ' cl_update_world_hash_set ' ) == ' on ' )
return func
return func
@staticmethod
def force_preserved ( Get ) :
pfile = " /var/lib/portage/preserved_libs_registry "
content = readFile ( pfile ) . strip ( )
if not content or content [ 1 : - 1 ] . strip ( ) == ' ' :
return False
else :
return True
@staticmethod
def check_world_updated_after_tag_save ( ) :
def func ( ) :
task = EmergeLog ( EmergeLogNamedTask ( EmergeMark . SaveTag ) )
return task . did_update_world_happen ( )
return func
class ClUpdateAction ( Action ) :
class ClUpdateAction ( Action ) :
"""
"""
@ -54,7 +299,7 @@ class ClUpdateAction(Action):
"""
"""
# ошибки, которые отображаются без подробностей
# ошибки, которые отображаются без подробностей
native_error = ( FilesError , UpdateError ,
native_error = ( FilesError , UpdateError ,
TemplatesError ,
TemplatesError , BinhostError ,
GitError , EmergeError )
GitError , EmergeError )
successMessage = None
successMessage = None
@ -62,19 +307,44 @@ class ClUpdateAction(Action):
interruptMessage = __ ( " Update manually interrupted " )
interruptMessage = __ ( " Update manually interrupted " )
emerge_tasks = [
emerge_tasks = [
{ ' name ' : ' save_bdeps_val ' ,
' method ' : ' Update.save_with_bdeps() ' ,
' essential ' : False
} ,
{ ' name ' : ' update_fastlogin_domain ' ,
' method ' : " Update.update_fastlogin_domain_path() "
} ,
{ ' name ' : ' drop_portage_hash_on_sync ' ,
' method ' : ' Update.drop_portage_state_hash() ' ,
' condition ' : lambda Get : Get ( ' cl_update_outdate_set ' ) == ' on '
} ,
{ ' name ' : ' premerge_group ' ,
{ ' name ' : ' premerge_group ' ,
' group ' : __ ( " Checking for updates " ) ,
' group ' : __ ( " Checking for updates " ) ,
' tasks ' : [
' tasks ' : [
{ ' name ' : ' premerge ' ,
{ ' name ' : ' premerge ' ,
' message ' : __ ( " Calculating dependencies " ) ,
' message ' : __ ( " Calculating dependencies " ) ,
' method ' : ' Update.premerge( " -uDN " , " --with-bdeps=y " , " @world " ) ' ,
' method ' : ' Update.premerge( " -uDN " , " @world " ) ' ,
' condition ' : lambda Get : Get ( ' cl_update_sync_only_set ' ) == ' off '
' condition ' : lambda Get : (
Get ( ' cl_update_sync_only_set ' ) == ' off ' and
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 ' : ' premerge:update ' ,
{ ' name ' : ' update ' ,
' condition ' : lambda Get : Get ( ' cl_update_pretend_set ' ) == ' off ' ,
' condition ' : lambda Get : Get ( ' cl_update_pretend_set ' ) == ' off ' and \
' depend ' : Tasks . result ( " premerge " , eq = ' yes ' )
( 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 ( ' cl_update_available_set ' ) == ' on ' or
Get ( ' update.cl_update_package_cache_set ' ) == ' on ' )
} ,
{ ' name ' : ' update_other ' ,
{ ' name ' : ' update_other ' ,
' condition ' : lambda Get : ( Get ( ' cl_update_pretend_set ' ) == ' off ' and
' condition ' : lambda Get : ( Get ( ' cl_update_pretend_set ' ) == ' off ' and
Get ( ' cl_update_sync_only_set ' ) == ' off ' )
Get ( ' cl_update_sync_only_set ' ) == ' off ' )
@ -82,16 +352,20 @@ class ClUpdateAction(Action):
{ ' name ' : ' update:update_world ' ,
{ ' name ' : ' update:update_world ' ,
' group ' : __ ( " Updating packages " ) ,
' group ' : __ ( " Updating packages " ) ,
' tasks ' : [
' tasks ' : [
{ ' name ' : ' update :update _world' ,
{ ' name ' : ' update _world' ,
' message ' : __ ( " Calculating dependencies " ) ,
' message ' : __ ( " Calculating dependencies " ) ,
' method ' : ' Update.emerge( " " , " -uDN " , " --with-bdeps=y " , " @world " ) ' ,
' method ' : ' Update.emerge_ask(cl_update_pretend_set, '
' " -uDN " , " @world " ) ' ,
}
}
]
] ,
' 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:update_perl ' ,
{ ' name ' : ' update _other :update_perl' ,
' group ' : __ ( " Updating Perl " ) ,
' group ' : __ ( " Updating Perl modules " ) ,
' tasks ' : [
' tasks ' : [
{ ' name ' : ' update :perl_cleaner' ,
{ ' name ' : ' update _other :perl_cleaner' ,
' message ' : __ ( ' Find & rebuild packages and Perl header files '
' message ' : __ ( ' Find & rebuild packages and Perl header files '
' broken due to a perl upgrade ' ) ,
' broken due to a perl upgrade ' ) ,
' method ' : ' Update.emergelike( " perl-cleaner " , " all " ) ' ,
' method ' : ' Update.emergelike( " perl-cleaner " , " all " ) ' ,
@ -120,7 +394,7 @@ class ClUpdateAction(Action):
' message ' : __ ( ' Updating Kernel modules ' ) ,
' message ' : __ ( ' Updating Kernel modules ' ) ,
' method ' : ' Update.emerge( " " , " @module-rebuild " ) ' ,
' method ' : ' Update.emerge( " " , " @module-rebuild " ) ' ,
' condition ' : UpdateConditions . was_installed (
' condition ' : UpdateConditions . was_installed (
' sys-kernel/ .*source ' , EmergeMark . KernelModules ) ,
' sys-kernel/ (calculate-sources|gentoo-kernel|vanilla-kernel) ' , EmergeMark . KernelModules ) ,
' decoration ' : ' Update.update_task( " %s " ) ' %
' decoration ' : ' Update.update_task( " %s " ) ' %
EmergeMark . KernelModules
EmergeMark . KernelModules
} ,
} ,
@ -135,16 +409,17 @@ class ClUpdateAction(Action):
{ ' name ' : ' update_other:preserved_rebuild ' ,
{ ' name ' : ' update_other:preserved_rebuild ' ,
' message ' : __ ( ' Updating preserved libraries ' ) ,
' message ' : __ ( ' Updating preserved libraries ' ) ,
' method ' : ' Update.emerge( " " , " @preserved-rebuild " ) ' ,
' method ' : ' Update.emerge( " " , " @preserved-rebuild " ) ' ,
' condition ' : UpdateConditions . was_installed (
' condition ' : lambda Get : ( UpdateConditions . was_installed (
' .* ' , EmergeMark . PreservedLibs ) ,
' .* ' , EmergeMark . PreservedLibs ) ( ) or
UpdateConditions . force_preserved ( Get ) ) ,
' decoration ' : ' Update.update_task( " %s " ) ' %
' decoration ' : ' Update.update_task( " %s " ) ' %
EmergeMark . PreservedLibs
EmergeMark . PreservedLibs
} ,
} ,
{ ' name ' : ' update_other:revdev_rebuild ' ,
{ ' name ' : ' update_other:revdev_rebuild ' ,
' message ' : __ ( ' Checking reverse dependencies ' ) ,
' message ' : __ ( ' Checking reverse dependencies ' ) ,
' method ' : ' Update.revdep_rebuild( " revdep-rebuild " ) ' ,
' method ' : ' Update.revdep_rebuild( " revdep-rebuild " ) ' ,
' condition ' : lambda Get : ( Get (
' condition ' : lambda Get : ( Get (
' cl_update_ skip_rb_set' ) == ' off ' and
' cl_update_ revdep_rebuild_set' ) == ' on ' and
UpdateConditions . was_installed (
UpdateConditions . was_installed (
' .* ' , EmergeMark . RevdepRebuild ) ( ) ) ,
' .* ' , EmergeMark . RevdepRebuild ) ( ) ) ,
' decoration ' : ' Update.update_task( " %s " ) ' %
' decoration ' : ' Update.update_task( " %s " ) ' %
@ -158,8 +433,10 @@ class ClUpdateAction(Action):
} ,
} ,
]
]
} ,
} ,
{ ' name ' : ' update:set_upto_date_cache ' ,
{ ' name ' : ' set_upto_date_cache ' ,
' method ' : ' Update.setUpToDateCache() '
' method ' : ' Update.setUpToDateCache() ' ,
' condition ' : lambda Get : Get ( ' cl_update_sync_only_set ' ) == ' off ' and \
Get ( ' cl_update_pretend_set ' ) == ' off '
}
}
]
]
@ -174,124 +451,47 @@ class ClUpdateAction(Action):
{ ' name ' : ' check_run ' ,
{ ' name ' : ' check_run ' ,
' method ' : ' Update.checkRun(cl_update_wait_another_set) '
' method ' : ' Update.checkRun(cl_update_wait_another_set) '
} ,
} ,
{ ' name ' : ' reps_synchronization ' ,
{ ' name ' : ' check_if_world_was_updated ' ,
' group ' : __ ( " Repositories synchronization " ) ,
' method ' : ' Update.update_set_current_saved_tag() ' ,
' tasks ' : [
' essential ' : False ,
# запасная синхронизация, в ходе которой ветки обновляются до
' condition ' : lambda Get : ( Get ( ' cl_update_sync_only_set ' ) == ' off ' and \
# master
Get ( ' cl_update_pretend_set ' ) == ' off ' and \
{ ' name ' : ' sync_reps_fallback ' ,
UpdateConditions . check_world_updated_after_tag_save ( ) ( ) )
' foreach ' : ' cl_update_sync_rep ' ,
' message ' :
__ ( " Fallback syncing the { eachvar:capitalize} repository " ) ,
' method ' : ' Update.syncRepositories(eachvar) ' ,
' condition ' : lambda Get : ( " getbinpkg " in Get ( ' cl_features ' ) and
not Get ( ' cl_update_binhost_data ' ) [ 0 ] )
} ,
# обновление переменных информации из binhost
{ ' name ' : ' update_binhost_list ' ,
' method ' : ' Update.update_binhost_list() ' ,
' condition ' : lambda Get : ( " getbinpkg " in Get ( ' cl_features ' ) and
not Get ( ' cl_update_binhost_data ' ) [ 0 ] )
} ,
{ ' name ' : ' sync_reps ' ,
' foreach ' : ' cl_update_sync_rep ' ,
' message ' : __ ( " Syncing the { eachvar:capitalize} repository " ) ,
' method ' : ' Update.syncRepositories(eachvar) ' ,
' condition ' : lambda Get : Get ( ' cl_update_sync_rep ' )
} ,
{ ' name ' : ' check_binhost ' ,
' method ' : ' Update.check_binhost() ' ,
' condition ' : lambda Get : " getbinpkg " in Get ( ' cl_features ' )
} ,
{ ' 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 " ) ,
' group ' : __ ( " System configuration " ) ,
' tasks ' : [
' tasks ' : [
{ ' name ' : ' binhost_changed ' ,
' method ' : ' Update.message_binhost_changed() '
} ,
{ ' name ' : ' revision ' ,
{ ' name ' : ' revision ' ,
' message ' : __ ( " Fixing the settings " ) ,
' message ' : __ ( " Fixing the settings " ) ,
' method ' : ' Update.applyTemplates(install.cl_source, '
' method ' : ' Update.applyTemplates(install.cl_source, '
' cl_template_clt_set,True,None,False) ' ,
' cl_template_clt_set,True,None,False) ' ,
' condition ' : lambda Get : Get ( ' cl_templates_locate ' )
' condition ' : lambda Get , GetBool : ( Get ( ' cl_templates_locate ' ) and
} ,
( Get ( ' cl_update_world ' ) != " update " or
GetBool ( ' cl_update_outdate_set ' ) or
GetBool ( ' cl_update_binhost_recheck_set ' ) or
GetBool ( ' cl_update_force_fix_set ' ) or
GetBool ( ' update.cl_update_package_cache_set ' ) ) )
} ,
{ ' name ' : ' dispatch_conf ' ,
{ ' name ' : ' dispatch_conf ' ,
' message ' : __ ( " Updating configuration files " ) ,
' message ' : __ ( " Updating configuration files " ) ,
' method ' : ' Update.dispatchConf() ' ,
' method ' : ' Update.dispatchConf() ' ,
' condition ' : lambda Get : ( Get ( ' cl_dispatch_conf ' ) != ' skip ' and
' condition ' : lambda Get , GetBool : ( Get ( ' cl_dispatch_conf ' ) != ' skip ' and
Get ( ' cl_update_pretend_set ' ) == ' off ' )
Get ( ' cl_update_pretend_set ' ) == ' off ' and
} ,
( GetBool ( ' cl_update_outdate_set ' ) or
{ ' name ' : ' binhost_changed ' ,
GetBool ( ' cl_update_binhost_recheck_set ' ) or
' method ' : ' Update.message_binhost_changed() '
GetBool ( ' cl_update_force_fix_set ' ) or
} ,
GetBool ( ' update.cl_update_package_cache_set ' ) ) )
} ,
]
]
}
}
] + emerge_tasks + [
] + emerge_tasks + [
{ ' name ' : ' check success configure ' ,
' method ' : ' Update.check_success_configure() ' ,
} ,
{ ' name ' : ' failed ' ,
{ ' name ' : ' failed ' ,
' error ' : __ ( " Update failed " ) ,
' error ' : __ ( " Update failed " ) ,
' depend ' : ( Tasks . failed ( ) & Tasks . hasnot ( " interrupt " ) &
' depend ' : ( Tasks . failed ( ) & Tasks . hasnot ( " interrupt " ) &
@ -301,10 +501,56 @@ class ClUpdateAction(Action):
' depend ' : Tasks . failed_all ( " check_schedule " )
' depend ' : Tasks . failed_all ( " check_schedule " )
} ,
} ,
# сообщение удачного завершения при обновлении ревизии
# сообщение удачного завершения при обновлении ревизии
{ ' name ' : ' drop_portage_hash ' ,
' 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 " ) &
Tasks . success_all ( " update " ) & Tasks . hasnot ( " check_schedule " ) ) ,
' condition ' : lambda Get : Get ( ' cl_update_sync_only_set ' ) == ' off ' and
Get ( ' cl_update_pretend_set ' ) == ' off ' and
Get ( ' update.cl_update_use_migration_host ' ) == ' on '
} ,
{ ' name ' : ' update_world:set_latest_tag ' ,
' method ' : ' Update.update_set_current_saved_tag() ' ,
' depend ' : ( Tasks . success ( ) & Tasks . hasnot ( " interrupt " ) &
Tasks . success_all ( " update " ) & Tasks . hasnot ( " check_schedule " ) ) ,
' condition ' : lambda Get : Get ( ' cl_update_sync_only_set ' ) == ' off ' and
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 ' : ' 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 " ) ) ,
' condition ' : lambda Get : Get ( ' update.cl_update_use_migration_host ' ) == ' on '
} ,
# сообщение удачного завершения при обновлении ревизии
{ ' name ' : ' success_rev ' ,
{ ' name ' : ' success_rev ' ,
' message ' : __ ( " System update finished! " ) ,
' message ' : __ ( " System update finished! " ) ,
' condition ' : lambda Get : ( Get ( ' cl_update_rev_set ' ) == ' on ' and
' condition ' : lambda Get : ( Get ( ' cl_update_rev_set ' ) == ' on ' and
Get ( ' cl_update_pretend_set ' ) == ' off ' )
Get ( ' cl_update_pretend_set ' ) == ' off ' and
Get ( ' cl_update_sync_only_set ' ) == ' off ' )
} ,
# сообщение удачного завершения при обновлении ревизии
{ ' name ' : ' success_sync_only ' ,
' message ' : __ ( " System sync finished! " ) ,
' condition ' : lambda Get : ( Get ( ' cl_update_rev_set ' ) == ' on ' and
Get ( ' cl_update_pretend_set ' ) == ' off ' and
Get ( ' cl_update_sync_only_set ' ) == ' on ' )
} ,
} ,
# сообщение удачного завершения при пересоздании world
# сообщение удачного завершения при пересоздании world
{ ' name ' : ' success_world ' ,
{ ' name ' : ' success_world ' ,