Browse Source

Исправлено восстановение репозитория. Добавлено ограничение вывода при

сообщения с ошибкой.
tags/3.2.2_beta3
Mike Khiretskiy 6 years ago
parent
commit
3a98aa127d
2 changed files with 21 additions and 9 deletions
  1. +10
    -6
      pym/update/update.py
  2. +11
    -3
      pym/update/variables/update.py

+ 10
- 6
pym/update/update.py View File

@@ -725,7 +725,7 @@ class Update:
except EmergeError:
self.set_need_update(False)
self.emerge_cache.drop_cache("Emerge error")
self.printPre(self._emerge_translate(emerge.prepare_error))
self._display_error(emerge.prepare_error)
raise
if self.clVars.Get('cl_update_pretend_set') == 'on':
# установить кэш: есть обновления
@@ -780,12 +780,16 @@ class Update:
except EmergeError:
self.emerge_cache.drop_cache("Emerge error")
if emerge.emerging_error:
self.printPre(
self._emerge_translate(emerge.emerging_error.log))
self._display_error(emerge.emerging_error.log)
else:
self.printPre(self._emerge_translate(emerge.prepare_error))
self._display_error(emerge.prepare_error)
raise

def _display_error(self, error):
lines_num = int(self.clVars.Get('update.cl_update_lines_limit'))
error = "\n".join(str(error).split('<br/>')[-lines_num:])
self.printPre(self._emerge_translate(error))

def emerge(self, param, *packages):
"""
Выполнить сборку пакета
@@ -808,7 +812,7 @@ class Update:
return True
except EmergeError:
self.emerge_cache.drop_cache("Emerge error")
self.printPre(self._emerge_translate(emerge.prepare_error))
self._display_error(emerge.prepare_error)
raise
self._startEmerging(emerge)
return True
@@ -848,7 +852,7 @@ class Update:
emerge.run()
self._display_remove_list(emerge)
except EmergeError:
self.printPre(self._emerge_translate(emerge.prepare_error))
self._display_error(emerge.prepare_error)
raise
if (self.askConfirm(
_("Would you like to unmerge these packages?")) != 'yes'):


+ 11
- 3
pym/update/variables/update.py View File

@@ -229,9 +229,12 @@ class VariableClUpdateBranchName(Variable):

def get(self):
def generateBranch():
git = Git()
for reppath in self.Get('cl_update_rep_path'):
headPath = path.join(reppath, ".git/HEAD")
yield readFile(headPath).rpartition('/')[2].strip() or "master"
try:
yield git.getBranch(reppath) or "master"
except GitError:
yield "master"

return list(generateBranch())

@@ -1051,4 +1054,9 @@ class VariableClUpdateKernelPkg(ReadonlyVariable):
else:
return ""


class VariableClUpdateLinesLimit(Variable):
"""
Количество выводимых строк при ошибке
"""
type = "int"
value = "30"

Loading…
Cancel
Save