Browse Source

Изменён поряток выполнения emerge -uDN world

tags/3.5.1_beta5
parent
commit
d89445dd5c
2 changed files with 47 additions and 52 deletions
  1. +38
    -46
      pym/update/update.py
  2. +9
    -6
      pym/update/utils/cl_update.py

+ 38
- 46
pym/update/update.py View File

@@ -765,31 +765,6 @@ class Update(MethodsInterface):
_("Listing packages for removal")))
self._display_pretty_package_list(pkglist, remove_list=True)

def getCacheOnWorld(self, params, packages, check=False):
"""
Получить список обновляемых пакетов @world из кэша
"""
if "@world" in packages:
elog = EmergeLog(EmergeLogNamedTask(EmergeMark.Premerge))
if check and (elog.list or elog.remove_list):
self.emerge_cache.drop_cache(
"Some packages was installed or removed")
return params, packages
installed_pkgs = elog.list
new_packages = self.emerge_cache.get_cached_package_list()
if new_packages is not None:
return "-1O", ["=%s" % x for x in new_packages
if not str(x) in installed_pkgs]
return params, packages

def updateCache(self, pkg_list):
"""
Обновить кэш. Оставить отметку в emerge.log о том, выполнено действие
premerge
"""
self.emerge_cache.set_cache(pkg_list)
elog = EmergeLog(EmergeLogNamedTask(EmergeMark.Premerge))
elog.mark_end_task(),

def mark_schedule(self):
"""
@@ -805,26 +780,12 @@ class Update(MethodsInterface):
Вывести информацию об обновлении
"""
deo = self.clVars.Get('cl_emerge_default_opts')
param, packages = self.getCacheOnWorld(param, packages, check=True)
param = [param, "-pv"]

if not packages:
self.printSUCCESS(_("Installed packages are up to date"))
self.set_need_update(False)
return True
with EmergeParser(EmergeCommand(list(packages), emerge_default_opts=deo,
extra_params=param)) as emerge:
try:
emerge.run()
if "@world" in packages:
if emerge.install_packages.remove_list:
self.emerge_cache.drop_cache(
"List has packages for remove")
elif emerge.install_packages.block_packages:
self.emerge_cache.drop_cache(
"List has block packages")
else:
self.updateCache(emerge.install_packages.list)
if not emerge.install_packages.list:
self.printSUCCESS(_("The system is up to date"))
self.set_need_update(False)
@@ -835,7 +796,6 @@ class Update(MethodsInterface):
self._display_error(emerge.skipped_packages)
except EmergeError:
self.set_need_update(False)
self.emerge_cache.drop_cache("Emerge error")
self._display_install_package(emerge, emergelike=True)
self._display_error(emerge.prepare_error)
raise
@@ -870,7 +830,7 @@ class Update(MethodsInterface):
"""
Установить кэш - "нет пакетов для обновления"
"""
self.updateCache(PackageList([]))
#self.updateCache(PackageList([]))
return True

def _startEmerging(self, emerge):
@@ -896,7 +856,6 @@ class Update(MethodsInterface):
try:
emerge.run()
except EmergeError:
self.emerge_cache.drop_cache("Emerge error")
if emerge.emerging_error:
self._display_error(emerge.emerging_error.log)
else:
@@ -917,9 +876,6 @@ class Update(MethodsInterface):
packages = [param]
extra_params = None
else:
param, packages = self.getCacheOnWorld(param, packages)
if not packages:
return True
extra_params = [param]

command = EmergeCommand(list(packages), emerge_default_opts=deo,
@@ -935,7 +891,43 @@ class Update(MethodsInterface):
if not emerge.install_packages.list:
return True
except EmergeError:
self.emerge_cache.drop_cache("Emerge error")
self._display_error(emerge.prepare_error)
raise
self._startEmerging(emerge)
return True

def emerge_ask(self, pretend, *params):
"""
Вывести информацию об обновлении
"""
deo = self.get_default_emerge_opts()
param = [x for x in params if x.startswith("-")]
packages = [x for x in params if not x.startswith("-")]
command = EmergeCommand(list(packages), emerge_default_opts=deo,
extra_params=param)
with EmergeParser(command) as emerge:
try:
emerge.question.action = lambda x: False
emerge.run()
if emerge.install_packages.list:
emergelike = self.clVars.Get(
'update.cl_update_emergelist_set') == 'on'
self._display_install_package(emerge, emergelike)
if emerge.skipped_packages:
self._display_error(emerge.skipped_packages)
if not pretend:
answer = self.askConfirm(
_("Would you like to merge these packages?"), "yes")
if answer == "no":
emerge.command.send("no\n")
raise KeyboardInterrupt
else:
return True
else:
self.printSUCCESS(_("The system is up to date"))
except EmergeError:
self.set_need_update(False)
self._display_install_package(emerge, emergelike=True)
self._display_error(emerge.prepare_error)
raise
self._startEmerging(emerge)


+ 9
- 6
pym/update/utils/cl_update.py View File

@@ -69,12 +69,13 @@ class ClUpdateAction(Action):
{'name': 'premerge',
'message': __("Calculating dependencies"),
'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')
}],
},
{'name': 'premerge:update',
{'name': 'update',
'condition': lambda Get:Get('cl_update_pretend_set') == 'off',
'depend': Tasks.result("premerge", eq='yes')
},
{'name': 'update_other',
'condition': lambda Get: ( Get('cl_update_pretend_set') == 'off' and
@@ -83,11 +84,13 @@ class ClUpdateAction(Action):
{'name': 'update:update_world',
'group': __("Updating packages"),
'tasks': [
{'name': 'update:update_world',
{'name': 'update_world',
'message': __("Calculating dependencies"),
'method': 'Update.emerge("","-uDN","@world")',
'method': 'Update.emerge_ask(cl_update_pretend_set,'
'"-uDN","@world")',
}
]
],
'condition': lambda Get: Get('cl_update_sync_only_set') == 'off'
},
{'name': 'update:update_perl',
'group': __("Updating Perl"),


Loading…
Cancel
Save