|
|
|
@ -0,0 +1,196 @@
|
|
|
|
|
diff --git update/package_tools.py update/package_tools.py
|
|
|
|
|
index a99af36..22ed72f 100644
|
|
|
|
|
--- update/package_tools.py
|
|
|
|
|
+++ update/package_tools.py
|
|
|
|
|
@@ -658,13 +658,14 @@ class EmergeUpdateInfo(Mapping):
|
|
|
|
|
Информация об обновлении одного пакета
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
- install_info = "\[(binary|ebuild)[^\]]+\]"
|
|
|
|
|
+ install_info = "\[(binary|ebuild)([^\]]+)\]"
|
|
|
|
|
atom_info = r"\S+"
|
|
|
|
|
use_info = 'USE="[^"]+"'
|
|
|
|
|
prev_version = "\[([^\]]+)\]"
|
|
|
|
|
pkg_size = r"[\d,]+ \w+"
|
|
|
|
|
|
|
|
|
|
- attrs = ['binary', 'REPLACING_VERSIONS', 'SIZE']
|
|
|
|
|
+ attrs = ['binary', 'REPLACING_VERSIONS', 'SIZE', 'new', 'newslot',
|
|
|
|
|
+ 'updating', 'downgrading', 'reinstall']
|
|
|
|
|
|
|
|
|
|
def __init__(self, data):
|
|
|
|
|
self._data = data
|
|
|
|
|
@@ -675,9 +676,16 @@ class EmergeUpdateInfo(Mapping):
|
|
|
|
|
r = self.update_info.search(self._data)
|
|
|
|
|
if r:
|
|
|
|
|
self._info['binary'] = r.group(2) == 'binary'
|
|
|
|
|
- self._package = EmergePackage(r.group(3))
|
|
|
|
|
- self._info['REPLACING_VERSIONS'] = r.group(4) or ""
|
|
|
|
|
- self._info['SIZE'] = r.group(6) or ""
|
|
|
|
|
+ install_flag = r.group(3)
|
|
|
|
|
+ self._info['newslot'] = "S" in install_flag
|
|
|
|
|
+ self._info['new'] = "N" in install_flag and not "S" in install_flag
|
|
|
|
|
+ self._info['updating'] = ("U" in install_flag and
|
|
|
|
|
+ not "D" in install_flag)
|
|
|
|
|
+ self._info['downgrading'] = "D" in install_flag
|
|
|
|
|
+ self._info['reinstall'] = "R" in install_flag
|
|
|
|
|
+ self._package = EmergePackage(r.group(4))
|
|
|
|
|
+ self._info['REPLACING_VERSIONS'] = r.group(5) or ""
|
|
|
|
|
+ self._info['SIZE'] = r.group(7) or ""
|
|
|
|
|
|
|
|
|
|
def __iter__(self):
|
|
|
|
|
return chain(EmergePackage.attrs, self.attrs)
|
|
|
|
|
@@ -725,7 +733,7 @@ class EmergeRemoveInfo(EmergeUpdateInfo):
|
|
|
|
|
"""
|
|
|
|
|
Информация об удалении одного пакета (в списке обновляемых пакетов)
|
|
|
|
|
"""
|
|
|
|
|
- install_info = "\[(uninstall)[^\]]+\]"
|
|
|
|
|
+ install_info = "\[(uninstall)([^\]]+)\]"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Eix:
|
|
|
|
|
diff --git update/update.py update/update.py
|
|
|
|
|
index 19a1fe2..eaf030a 100644
|
|
|
|
|
--- update/update.py
|
|
|
|
|
+++ update/update.py
|
|
|
|
|
@@ -35,7 +35,7 @@ from package_tools import Git, Layman,\
|
|
|
|
|
|
|
|
|
|
Colors = TextState.Colors
|
|
|
|
|
from calculate.lib.utils.files import (getProgPath, STDOUT, removeDir,
|
|
|
|
|
- PercentProgress, process)
|
|
|
|
|
+ PercentProgress, process, getRunCommands)
|
|
|
|
|
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate,
|
|
|
|
|
RegexpLocalization, _)
|
|
|
|
|
import emerge_parser
|
|
|
|
|
@@ -115,24 +115,34 @@ class Update:
|
|
|
|
|
"""
|
|
|
|
|
Проверить повторный запуск
|
|
|
|
|
"""
|
|
|
|
|
+ update_running = lambda: any(os.getpid() != x
|
|
|
|
|
+ for x in search_worked_process('update', dv))
|
|
|
|
|
dv = self.clVars
|
|
|
|
|
- if filter(lambda x: os.getpid() != x,
|
|
|
|
|
- search_worked_process('update', dv)):
|
|
|
|
|
+ if update_running():
|
|
|
|
|
if not wait_update:
|
|
|
|
|
raise UpdateError(_("Update is already running. "
|
|
|
|
|
"Try to run later."))
|
|
|
|
|
else:
|
|
|
|
|
self.startTask(_("Waiting for another update to be complete"))
|
|
|
|
|
|
|
|
|
|
- while filter(lambda x: os.getpid() != x,
|
|
|
|
|
- search_worked_process('update', dv)):
|
|
|
|
|
+ while update_running():
|
|
|
|
|
self.pauseProcess()
|
|
|
|
|
- while any(ifilter(lambda x: os.getpid() != x,
|
|
|
|
|
- search_worked_process('update', dv))):
|
|
|
|
|
+ while update_running():
|
|
|
|
|
time.sleep(0.3)
|
|
|
|
|
self.resumeProcess()
|
|
|
|
|
time.sleep(random.random()*3)
|
|
|
|
|
+ self.endTask()
|
|
|
|
|
|
|
|
|
|
+ emerge_running = lambda: any("/usr/bin/emerge" in x
|
|
|
|
|
+ for x in getRunCommands())
|
|
|
|
|
+ if emerge_running():
|
|
|
|
|
+ if not wait_update:
|
|
|
|
|
+ raise UpdateError(_("Emerge is running. "
|
|
|
|
|
+ "Try to run later."))
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.startTask(_("Waiting for emerge to be complete"))
|
|
|
|
|
+ while emerge_running():
|
|
|
|
|
+ time.sleep(1)
|
|
|
|
|
self.endTask()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@@ -169,10 +179,10 @@ class Update:
|
|
|
|
|
branch, cb_progress=self.setProgress)
|
|
|
|
|
removeDir(rpath)
|
|
|
|
|
os.rename(rpath_new, rpath)
|
|
|
|
|
- except OSError:
|
|
|
|
|
- raise UpdateError(_("Permission denied to modify the "
|
|
|
|
|
+ except OSError as e:
|
|
|
|
|
+ raise UpdateError(_("Failed to modify the "
|
|
|
|
|
"{repname} repository").format(
|
|
|
|
|
- repname=repname))
|
|
|
|
|
+ repname=repname)+":"+str(e))
|
|
|
|
|
finally:
|
|
|
|
|
if path.exists(rpath_new):
|
|
|
|
|
removeDir(rpath_new)
|
|
|
|
|
@@ -234,11 +244,15 @@ class Update:
|
|
|
|
|
if not emerge:
|
|
|
|
|
raise UpdateError(_("The Emerge tool is not found"))
|
|
|
|
|
self.addProgress()
|
|
|
|
|
- p = PercentProgress(emerge, "--metadata", part=1, atty=True)
|
|
|
|
|
+ p = PercentProgress(emerge, "--ask=n", "--metadata", part=1, atty=True)
|
|
|
|
|
for perc in p.progress():
|
|
|
|
|
self.setProgress(perc)
|
|
|
|
|
if p.failed():
|
|
|
|
|
- raise UpdateError(_("Failed to update metadata"), addon=p.read())
|
|
|
|
|
+ data = p.read()
|
|
|
|
|
+ with open('/var/log/calculate/failed-metadata-%d.log' % time.time(),
|
|
|
|
|
+ 'w') as f:
|
|
|
|
|
+ f.write(data+p.alldata)
|
|
|
|
|
+ raise UpdateError(_("Failed to update metadata"), addon=data)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def eixUpdate(self):
|
|
|
|
|
@@ -385,12 +399,28 @@ class Update:
|
|
|
|
|
ebuild_color = TextState.Colors.GREEN
|
|
|
|
|
binary_color = TextState.Colors.PURPLE
|
|
|
|
|
remove_color = TextState.Colors.LIGHT_RED
|
|
|
|
|
+ flag_map = {"updating":
|
|
|
|
|
+ _print.foreground(TextState.Colors.LIGHT_CYAN)("U"),
|
|
|
|
|
+ "reinstall":
|
|
|
|
|
+ _print.foreground(TextState.Colors.YELLOW)("rR"),
|
|
|
|
|
+ "new":
|
|
|
|
|
+ _print.foreground(TextState.Colors.LIGHT_GREEN)("N"),
|
|
|
|
|
+ "newslot":
|
|
|
|
|
+ _print.foreground(TextState.Colors.LIGHT_GREEN)("NS"),
|
|
|
|
|
+ "downgrading": (
|
|
|
|
|
+ _print.foreground(TextState.Colors.LIGHT_CYAN)("U") +
|
|
|
|
|
+ _print.foreground(TextState.Colors.LIGHT_BLUE)("D"))}
|
|
|
|
|
for pkg in sorted([PackageInformation.add_info(x) for x in
|
|
|
|
|
pkglist],
|
|
|
|
|
key=lambda y: y['CATEGORY/PN']):
|
|
|
|
|
+ install_flag = ""
|
|
|
|
|
if remove_list:
|
|
|
|
|
pkgcolor = _print.foreground(remove_color)
|
|
|
|
|
else:
|
|
|
|
|
+ for flag in flag_map:
|
|
|
|
|
+ if pkg[flag]:
|
|
|
|
|
+ install_flag = "(%s) " % flag_map[flag]
|
|
|
|
|
+ break
|
|
|
|
|
if self.is_binary_pkg(pkg):
|
|
|
|
|
pkgcolor = _print.foreground(binary_color)
|
|
|
|
|
else:
|
|
|
|
|
@@ -407,8 +437,10 @@ class Update:
|
|
|
|
|
else:
|
|
|
|
|
size = ""
|
|
|
|
|
mult = _print.bold("*")
|
|
|
|
|
- self.printDefault(" {mult} {fullname}{shortname}{size}".format(
|
|
|
|
|
- mult=mult, fullname=fullname, shortname=shortname, size=size))
|
|
|
|
|
+ self.printDefault(
|
|
|
|
|
+ " {mult} {fullname}{flag}{shortname}{size}".format(
|
|
|
|
|
+ mult=mult, fullname=fullname, shortname=shortname, size=size,
|
|
|
|
|
+ flag=install_flag))
|
|
|
|
|
|
|
|
|
|
def _display_install_package(self, emerge):
|
|
|
|
|
"""
|
|
|
|
|
diff --git update/utils/cl_update.py update/utils/cl_update.py
|
|
|
|
|
index d300ea0..0a815ff 100644
|
|
|
|
|
--- update/utils/cl_update.py
|
|
|
|
|
+++ update/utils/cl_update.py
|
|
|
|
|
@@ -192,6 +192,13 @@ class ClUpdateAction(Action):
|
|
|
|
|
'condition': was_installed('.*', log_names['revdep']),
|
|
|
|
|
'decoration': 'Update.update_task("%s")' % log_names['revdep']
|
|
|
|
|
},
|
|
|
|
|
+ {'name': 'update_other:dispatch_conf_end',
|
|
|
|
|
+ 'message': __("Updating configuration files"),
|
|
|
|
|
+ 'method':'Update.dispatchConf()',
|
|
|
|
|
+ 'condition': lambda Get: ((Get('cl_update_rev_set') == 'on' or
|
|
|
|
|
+ Get('cl_rebuild_world_set') == 'on') and
|
|
|
|
|
+ Get('cl_update_pretend_set') == 'off')
|
|
|
|
|
+ },
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{'name': 'update:set_upto_date_cache',
|