|
|
diff --git data/cl-git-wrapper data/cl-git-wrapper
|
|
|
index 8728c8b..d945d0a 100755
|
|
|
--- data/cl-git-wrapper
|
|
|
+++ data/cl-git-wrapper
|
|
|
@@ -22,7 +22,7 @@ native_reps=,$(/usr/sbin/cl-core --method core_variables_show \
|
|
|
if echo $native_reps | grep -q ,${repo_name},
|
|
|
then
|
|
|
# отбновить репозиторий через утилиты Calculate
|
|
|
- /usr/sbin/cl-core --method update $repo_name --sync-only on --skip-update-metadata --skip-eix-update --update-rev=off
|
|
|
+ /usr/sbin/cl-core --method update $repo_name --sync on --skip-update-metadata --skip-eix-update --update-rev=off
|
|
|
else
|
|
|
# выполнить обновление через git
|
|
|
/usr/bin/git $*
|
|
|
diff --git update/emerge_parser.py update/emerge_parser.py
|
|
|
index 80d012b..a9064c6 100644
|
|
|
--- update/emerge_parser.py
|
|
|
+++ update/emerge_parser.py
|
|
|
@@ -32,6 +32,7 @@ from calculate.lib.utils.files import getProgPath, readLinesFile, listDirectory,
|
|
|
from calculate.lib.utils.colortext.output import XmlOutput
|
|
|
from calculate.lib.utils.colortext.converter import (ConsoleCodes256Converter,
|
|
|
XmlConverter)
|
|
|
+from calculate.lib.cl_log import log
|
|
|
|
|
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate, _
|
|
|
|
|
|
@@ -218,16 +219,25 @@ class UninstallPackagesBlock(EmergeInformationBlock):
|
|
|
Блок emerge содержащий список удаляемых пакетов
|
|
|
"""
|
|
|
list = PackageList([])
|
|
|
+ verbose_result = ""
|
|
|
_new_line = EmergeInformationBlock._new_line
|
|
|
_color_block = EmergeInformationBlock._color_block
|
|
|
- token = ["These are the packages that would be unmerged",
|
|
|
- "Calculating removal order"]
|
|
|
+ token = ["Calculating removal order",
|
|
|
+ "These are the packages that would be unmerged",]
|
|
|
end_token = re.compile("All selected packages:.*\n")
|
|
|
- re_block = re.compile(r"All selected packages: (.*?){nl}".
|
|
|
- format(nl=_new_line, c=_color_block), re.DOTALL)
|
|
|
+ re_block = re.compile(
|
|
|
+ r"(?:{token}).*?{nl}(.*){nl}All selected packages: (.*?){nl}".
|
|
|
+ format(token="|".join(token),
|
|
|
+ nl=_new_line, c=_color_block), re.DOTALL)
|
|
|
|
|
|
def get_data(self, match):
|
|
|
- super(UninstallPackagesBlock, self).get_data(match)
|
|
|
+ re_clean = re.compile(
|
|
|
+ "^.*?({token}).*?{c}{nl}".format(token="|".join(self.token),
|
|
|
+ nl=self._new_line,
|
|
|
+ c=self._color_block), re.DOTALL)
|
|
|
+ verbose_result = re_clean.sub("", match.group(1))
|
|
|
+ self.verbose_result = self._get_text(verbose_result)
|
|
|
+ self.result = self._get_text(match.group(2))
|
|
|
list_block = XmlConverter().transform(self.result).split()
|
|
|
self.list = PackageList(map(EmergePackage, list_block))
|
|
|
|
|
|
@@ -403,6 +413,16 @@ class UnemergingPackage(NotifierInformationBlock):
|
|
|
observer(EmergePackage(groups[2]), num=groups[0], max_num=groups[1])
|
|
|
|
|
|
|
|
|
+class FetchingTarball(NotifierInformationBlock):
|
|
|
+ """
|
|
|
+ Происходит скачивание архивов
|
|
|
+ """
|
|
|
+ token = "Saving to:"
|
|
|
+ re_block = re.compile("Saving to:\s*‘(\S+)?’")
|
|
|
+
|
|
|
+ def notify(self, observer, groups):
|
|
|
+ observer(groups[0])
|
|
|
+
|
|
|
class InstallingPackage(NotifierInformationBlock):
|
|
|
"""
|
|
|
Запуск устанавливаемого пакета
|
|
|
@@ -447,7 +467,7 @@ class EmergeingErrorBlock(EmergeInformationBlock):
|
|
|
return self.text_converter.transform(readFile(self.result))
|
|
|
|
|
|
def action(self, child):
|
|
|
- raise EmergeError(_("Emerge %s is failed") % self.package)
|
|
|
+ raise EmergeError(_("Failed to emerge %s") % self.package)
|
|
|
|
|
|
|
|
|
class RevdepPercentBlock(NotifierInformationBlock):
|
|
|
@@ -500,8 +520,10 @@ class EmergeParser(object):
|
|
|
self.installing = InstallingPackage(self)
|
|
|
self.uninstalling = UnemergingPackage(self)
|
|
|
self.emerging = EmergingPackage(self)
|
|
|
+ self.fetching = FetchingTarball(self)
|
|
|
|
|
|
self.emerging.add_observer(self.mark_binary)
|
|
|
+ self.emerging.add_observer(self.skip_fetching)
|
|
|
if run:
|
|
|
self.run()
|
|
|
|
|
|
@@ -509,6 +531,9 @@ class EmergeParser(object):
|
|
|
if binary:
|
|
|
self.installing.mark_binary(package)
|
|
|
|
|
|
+ def skip_fetching(self, *argv, **kw):
|
|
|
+ self.fetching.action = lambda child: None
|
|
|
+
|
|
|
def add_element(self, element):
|
|
|
if element.token:
|
|
|
if type(element.token) == list:
|
|
|
@@ -587,6 +612,9 @@ class EmergeCache(object):
|
|
|
'/etc/make.profile'),
|
|
|
Md5Checkvalue('/var/lib/portage/world',
|
|
|
'/var/lib/portage/world_sets')]
|
|
|
+ logger = log("emerge-cache",
|
|
|
+ filename="/var/log/calculate/emerge-cache.log",
|
|
|
+ formatter="%(asctime)s - %(levelname)s - %(message)s")
|
|
|
|
|
|
def __init__(self):
|
|
|
self.files_control_values = {}
|
|
|
@@ -602,14 +630,20 @@ class EmergeCache(object):
|
|
|
f.write('\n')
|
|
|
for pkg in package_list:
|
|
|
f.write("%s\n"% str(pkg))
|
|
|
+ self.logger.info("Setting cache (%d packages)"%len(package_list))
|
|
|
|
|
|
- def drop_cache(self):
|
|
|
+ def drop_cache(self, reason=None):
|
|
|
if path.exists(self.cache_file):
|
|
|
with ignore(OSError):
|
|
|
os.unlink(self.cache_file)
|
|
|
+ self.logger.info("Droping cache. Reason: %s"%reason)
|
|
|
+ else:
|
|
|
+ self.logger.info("Droping empty cache. Reason: %s"%reason)
|
|
|
|
|
|
def get_cached_package_list(self):
|
|
|
self.read_cache()
|
|
|
+ if not path.exists(self.cache_file):
|
|
|
+ self.logger.info("Requesting empty cache")
|
|
|
if self.check_actuality():
|
|
|
return self.pkg_list
|
|
|
return None
|
|
|
@@ -618,7 +652,20 @@ class EmergeCache(object):
|
|
|
"""
|
|
|
Кэш считается актуальным если ни один из файлов не менялся
|
|
|
"""
|
|
|
- return self.get_control_values() == self.files_control_values
|
|
|
+ if self.get_control_values() == self.files_control_values:
|
|
|
+ self.logger.info(
|
|
|
+ "Getting actuality cache (%d packages)" % len(self.pkg_list))
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ reason = "Unknown"
|
|
|
+ for k,v in self.get_control_values().items():
|
|
|
+ if k in self.files_control_values:
|
|
|
+ if v != self.files_control_values[k]:
|
|
|
+ reason = "%s was modified"%k
|
|
|
+ else:
|
|
|
+ reason = "Checksum of file %s is not exist" % k
|
|
|
+ self.logger.info("Failed to get cache. Reason: %s" % reason)
|
|
|
+ return False
|
|
|
|
|
|
def read_cache(self):
|
|
|
self.files_control_values = {}
|
|
|
diff --git update/package_tools.py update/package_tools.py
|
|
|
index dd86cbd..a99af36 100644
|
|
|
--- update/package_tools.py
|
|
|
+++ update/package_tools.py
|
|
|
@@ -29,6 +29,7 @@ from calculate.lib.utils.files import (getProgPath, STDOUT,
|
|
|
PercentProgress, process, readFile,
|
|
|
readLinesFile)
|
|
|
from calculate.lib.utils.common import cmpVersion
|
|
|
+from calculate.lib.utils.tools import ignore
|
|
|
from contextlib import closing
|
|
|
|
|
|
|
|
|
@@ -140,11 +141,11 @@ class Git:
|
|
|
if path.exists(rpath):
|
|
|
if not path.isdir(rpath):
|
|
|
raise GitError(
|
|
|
- _("Repository {path} is not directory").format(
|
|
|
+ _("Repository {path} is not a directory").format(
|
|
|
path=rpath))
|
|
|
if not path.isdir(self._gitDir(rpath)):
|
|
|
raise GitError(
|
|
|
- _("Repository {path} is not git").format(
|
|
|
+ _("Repository {path} is not Git").format(
|
|
|
path=rpath))
|
|
|
return True
|
|
|
return False
|
|
|
@@ -155,7 +156,7 @@ class Git:
|
|
|
"""
|
|
|
git = getProgPath("/usr/bin/git")
|
|
|
if not git:
|
|
|
- raise GitError(_("Git utility is not found"))
|
|
|
+ raise GitError(_("The Git tool is not found"))
|
|
|
return git
|
|
|
|
|
|
@staticmethod
|
|
|
@@ -191,9 +192,9 @@ class Git:
|
|
|
error = gitClone.read()
|
|
|
if "Remote branch %s not found" % branch in error:
|
|
|
raise GitError(
|
|
|
- _("Branch {branch} not found in {url} repository").format(
|
|
|
+ _("Branch {branch} not found in repository {url}").format(
|
|
|
branch=branch, url=url))
|
|
|
- raise GitError(_("Failed to clone {url} repository").format(
|
|
|
+ raise GitError(_("Failed to clone repository {url}").format(
|
|
|
url=url), error)
|
|
|
return True
|
|
|
|
|
|
@@ -272,7 +273,7 @@ class Git:
|
|
|
if command("get_rev_tag") or command("fetchshallow"):
|
|
|
if not command("has_branch"):
|
|
|
raise GitError(
|
|
|
- _("Branch {branch} not found in {url} repository"
|
|
|
+ _("Branch {branch} not found in repository {url}"
|
|
|
).format(branch=branch, url=url))
|
|
|
# если среди коммитов есть указанный коммит
|
|
|
if command("has_revision"):
|
|
|
@@ -281,7 +282,7 @@ class Git:
|
|
|
return True
|
|
|
elif command("checkout"):
|
|
|
return False
|
|
|
- raise GitError(_("Failed to clone {url} repository").format(
|
|
|
+ raise GitError(_("Failed to clone repository {url}").format(
|
|
|
url=url), error[-1])
|
|
|
|
|
|
def pullRepository(self, rpath, quiet_error=False, cb_progress=None):
|
|
|
@@ -294,7 +295,7 @@ class Git:
|
|
|
if not quiet_error:
|
|
|
error = gitPull.read()
|
|
|
raise GitError(
|
|
|
- _("Failed to update repository in {rpath}").format(
|
|
|
+ _("Failed to update the repository in {rpath}").format(
|
|
|
rpath=rpath), error)
|
|
|
return False
|
|
|
return True
|
|
|
@@ -316,7 +317,7 @@ class Git:
|
|
|
if gitFetch.failed():
|
|
|
error = gitFetch.read()
|
|
|
raise GitError(
|
|
|
- _("Failed to update repository in {rpath}").format(
|
|
|
+ _("Failed to update the repository in {rpath}").format(
|
|
|
rpath=rpath), error)
|
|
|
return True
|
|
|
|
|
|
@@ -332,7 +333,7 @@ class Git:
|
|
|
return not any(x.strip() for x in git_status)
|
|
|
else:
|
|
|
raise GitError(
|
|
|
- _("Wrong repository in {rpath} directory").format(
|
|
|
+ _("Wrong repository in the {rpath} directory").format(
|
|
|
rpath=rpath))
|
|
|
|
|
|
def parseStatusInfo(self, data):
|
|
|
@@ -376,8 +377,7 @@ class Git:
|
|
|
return git_show.read().strip()
|
|
|
else:
|
|
|
raise GitError(
|
|
|
- _("Failed to get status of repository in "
|
|
|
- "{rpath} directory").format(
|
|
|
+ _("Failed to get the repository status for {rpath}").format(
|
|
|
rpath=rpath))
|
|
|
|
|
|
def getStatusInfo(self, rpath):
|
|
|
@@ -395,13 +395,12 @@ class Git:
|
|
|
retDict = self.parseStatusInfo(git_status.read())
|
|
|
if not retDict:
|
|
|
raise GitError(
|
|
|
- _("Failed to get status of repository in "
|
|
|
- "{rpath} directory").format(
|
|
|
+ _("Failed to get the repository status for {rpath}").format(
|
|
|
rpath=rpath))
|
|
|
return retDict
|
|
|
else:
|
|
|
raise GitError(
|
|
|
- _("Wrong repository in {rpath} directory").format(
|
|
|
+ _("Wrong repository in the {rpath} directory").format(
|
|
|
rpath=rpath))
|
|
|
|
|
|
def resetRepository(self, rpath, to_origin=False, to_rev=None, info=None):
|
|
|
@@ -434,7 +433,7 @@ class Git:
|
|
|
rpath,
|
|
|
"clean", "-fd", stderr=STDOUT)
|
|
|
if git_reset.failed() or git_clean.failed():
|
|
|
- raise GitError(_("Failed to clean {rpath} repository").format(
|
|
|
+ raise GitError(_("Failed to clean the {rpath} repository").format(
|
|
|
rpath=rpath))
|
|
|
return True
|
|
|
|
|
|
@@ -456,11 +455,11 @@ class Git:
|
|
|
error = git_checkout.read()
|
|
|
if "pathspec '%s' did not match" % branch in error:
|
|
|
raise GitError(
|
|
|
- _("Branch {branch} not found in {rpath} repository").format(
|
|
|
+ _("Branch {branch} not found in repository {rpath}").format(
|
|
|
branch=branch, rpath=rpath))
|
|
|
raise GitError(
|
|
|
- _("Failed to change branch to {branch} in "
|
|
|
- "{rpath} repository").format(branch=branch,
|
|
|
+ _("Failed to change branch to {branch} in the {rpath} "
|
|
|
+ "repository").format(branch=branch,
|
|
|
rpath=rpath), error)
|
|
|
return True
|
|
|
|
|
|
@@ -600,16 +599,18 @@ class PackageInformation:
|
|
|
pkg_list = "|".join(
|
|
|
[x['CATEGORY/PN'].replace("+", r"\+") for x in self.query_packages])
|
|
|
output = pexpect.spawn(self.eix_cmd, ["--xml", pkg_list]).read()
|
|
|
- xml = ET.fromstring(output)
|
|
|
- for pkg in self.query_packages:
|
|
|
- cat_pn = pkg['CATEGORY/PN']
|
|
|
- if not cat_pn in self.information_cache:
|
|
|
- descr_node = xml.find(
|
|
|
- 'category[@name="%s"]/package[@name="%s"]/description'
|
|
|
- % (pkg['CATEGORY'], pkg['PN']))
|
|
|
- if descr_node is not None:
|
|
|
- self.information_cache[cat_pn]['DESCRIPTION'] = \
|
|
|
- descr_node.text
|
|
|
+ re_cut = re.compile("^.*?(?=<\?xml version)",re.S)
|
|
|
+ with ignore(ET.ParseError):
|
|
|
+ xml = ET.fromstring(re_cut.sub('',output))
|
|
|
+ for pkg in self.query_packages:
|
|
|
+ cat_pn = pkg['CATEGORY/PN']
|
|
|
+ if not cat_pn in self.information_cache:
|
|
|
+ descr_node = xml.find(
|
|
|
+ 'category[@name="%s"]/package[@name="%s"]/description'
|
|
|
+ % (pkg['CATEGORY'], pkg['PN']))
|
|
|
+ if descr_node is not None:
|
|
|
+ self.information_cache[cat_pn]['DESCRIPTION'] = \
|
|
|
+ descr_node.text
|
|
|
while self.query_packages:
|
|
|
self.query_packages.pop()
|
|
|
|
|
|
diff --git update/update.py update/update.py
|
|
|
index 2f867f4..70de1f3 100644
|
|
|
--- update/update.py
|
|
|
+++ update/update.py
|
|
|
@@ -14,17 +14,19 @@
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
from itertools import ifilter
|
|
|
+import random
|
|
|
|
|
|
import sys
|
|
|
from os import path
|
|
|
import os
|
|
|
import time
|
|
|
-from calculate.core.server.gen_pid import search_worked_process
|
|
|
+from calculate.core.server.gen_pid import search_worked_process, ProcessStatus
|
|
|
|
|
|
from calculate.lib.utils.tools import AddonError
|
|
|
from calculate.lib.utils.colortext.palette import TextState
|
|
|
from calculate.lib.utils.colortext import get_color_print
|
|
|
from calculate.update.emerge_parser import RevdepPercentBlock
|
|
|
+import math
|
|
|
|
|
|
from package_tools import Git, Layman,\
|
|
|
EmergeLogNamedTask, EmergeLog, GitError, \
|
|
|
@@ -36,6 +38,7 @@ from calculate.lib.utils.files import (getProgPath, STDOUT, removeDir,
|
|
|
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate,
|
|
|
RegexpLocalization, _)
|
|
|
import emerge_parser
|
|
|
+import logging
|
|
|
from emerge_parser import EmergeParser, EmergeCommand, EmergeError, EmergeCache
|
|
|
|
|
|
setLocalTranslate('cl_update3', sys.modules[__name__])
|
|
|
@@ -56,6 +59,8 @@ class Update:
|
|
|
emerge_parser.CommandExecutor.logfile = commandLog
|
|
|
self.color_print = get_color_print()
|
|
|
self.emerge_cache = EmergeCache()
|
|
|
+ if self.clVars.Get('cl_env_debug_set') == 'off':
|
|
|
+ EmergeCache.logger.logger.setLevel(logging.WARNING)
|
|
|
self.emerge_cache.check_list = (
|
|
|
self.emerge_cache.check_list +
|
|
|
map(emerge_parser.GitCheckvalue,
|
|
|
@@ -116,10 +121,17 @@ class Update:
|
|
|
raise UpdateError(_("Update is already running. "
|
|
|
"Try to run later."))
|
|
|
else:
|
|
|
- self.startTask(_("Waiting for complete another update"))
|
|
|
- while any(ifilter(lambda x: os.getpid() != x,
|
|
|
- search_worked_process('update', dv))):
|
|
|
- time.sleep(0.3)
|
|
|
+ self.startTask(_("Waiting for another update to be complete"))
|
|
|
+
|
|
|
+ while filter(lambda x: os.getpid() != x,
|
|
|
+ search_worked_process('update', dv)):
|
|
|
+ self.pauseProcess()
|
|
|
+ while any(ifilter(lambda x: os.getpid() != x,
|
|
|
+ search_worked_process('update', dv))):
|
|
|
+ time.sleep(0.3)
|
|
|
+ self.resumeProcess()
|
|
|
+ time.sleep(random.random()*3)
|
|
|
+
|
|
|
self.endTask()
|
|
|
return True
|
|
|
|
|
|
@@ -133,8 +145,8 @@ class Update:
|
|
|
"cl_update_rep_rev", "cl_update_branch_name"],
|
|
|
where="cl_update_rep_name", eq=repname, limit=1))
|
|
|
if not url or not rpath:
|
|
|
- raise UpdateError(_("Variables with repositories settings "
|
|
|
- "is not configured"))
|
|
|
+ raise UpdateError(_("Configuration variables for repositories "
|
|
|
+ "are not setup"))
|
|
|
self.addProgress()
|
|
|
if clean_on_error:
|
|
|
try:
|
|
|
@@ -148,7 +160,7 @@ class Update:
|
|
|
self.printWARNING(str(e))
|
|
|
self.endTask(False)
|
|
|
self.startTask(
|
|
|
- _("Re-fetch {name} repository").format(name=repname))
|
|
|
+ _("Re-fetching the {name} repository").format(name=repname))
|
|
|
self.addProgress()
|
|
|
try:
|
|
|
rpath_new = "%s_new" % rpath
|
|
|
@@ -157,7 +169,7 @@ class Update:
|
|
|
removeDir(rpath)
|
|
|
os.rename(rpath_new, rpath)
|
|
|
except OSError:
|
|
|
- raise UpdateError(_("Permission denied to change "
|
|
|
+ raise UpdateError(_("Permission denied to modify the "
|
|
|
"{repname} repository").format(
|
|
|
repname=repname))
|
|
|
finally:
|
|
|
@@ -179,7 +191,7 @@ class Update:
|
|
|
"""
|
|
|
layman = getProgPath('/usr/bin/layman')
|
|
|
if not layman:
|
|
|
- raise UpdateError(_("Layman utility is not found"))
|
|
|
+ raise UpdateError(_("The Layman tool is not found"))
|
|
|
rpath = self.clVars.Select('cl_update_other_rep_path',
|
|
|
where='cl_update_other_rep_name', eq=repname,
|
|
|
limit=1)
|
|
|
@@ -193,7 +205,7 @@ class Update:
|
|
|
p = process(layman, "-s", repname, stderr=STDOUT)
|
|
|
if p.failed():
|
|
|
raise UpdateError(
|
|
|
- _("Failed to update repository {rname}").format(rname=repname),
|
|
|
+ _("Failed to update the {rname} repository").format(rname=repname),
|
|
|
addon=p.read())
|
|
|
return True
|
|
|
|
|
|
@@ -203,12 +215,12 @@ class Update:
|
|
|
"""
|
|
|
egenCache = getProgPath('/usr/bin/egencache')
|
|
|
if not egenCache:
|
|
|
- raise UpdateError(_("Portage utility is not found"))
|
|
|
+ raise UpdateError(_("The Portage tool is not found"))
|
|
|
cpu_num = self.clVars.Get('hr_cpu_num')
|
|
|
p = process(egenCache, "--repo=%s" % repname, "--update",
|
|
|
"--jobs=%s" % cpu_num, stderr=STDOUT)
|
|
|
if p.failed():
|
|
|
- raise UpdateError(_("Failed to update cache of {rname} "
|
|
|
+ raise UpdateError(_("Failed to update the cache of the {rname} "
|
|
|
"repository").format(rname=repname),
|
|
|
addon=p.read())
|
|
|
return True
|
|
|
@@ -219,7 +231,7 @@ class Update:
|
|
|
"""
|
|
|
emerge = getProgPath("/usr/bin/emerge")
|
|
|
if not emerge:
|
|
|
- raise UpdateError(_("Emerge utility is not found"))
|
|
|
+ raise UpdateError(_("The Emerge tool is not found"))
|
|
|
self.addProgress()
|
|
|
p = PercentProgress(emerge, "--metadata", part=1, atty=True)
|
|
|
for perc in p.progress():
|
|
|
@@ -238,7 +250,7 @@ class Update:
|
|
|
"""
|
|
|
eixupdate = getProgPath("/usr/bin/eix-update")
|
|
|
if not eixupdate:
|
|
|
- raise UpdateError(_("Eix utility is not found"))
|
|
|
+ raise UpdateError(_("The Eix tool is not found"))
|
|
|
self.addProgress()
|
|
|
excludeList = []
|
|
|
if self.clVars.Get('cl_update_eixupdate_force') == 'force':
|
|
|
@@ -284,12 +296,10 @@ class Update:
|
|
|
"""
|
|
|
self.endTask()
|
|
|
_print = self.color_print
|
|
|
- if max_num > 1:
|
|
|
- one = _print.foreground(Colors.YELLOW).bold("{0}", num)
|
|
|
- two = _print.foreground(Colors.YELLOW).bold("{0}", max_num)
|
|
|
- part = " (%s of %s)" % (one, two)
|
|
|
- else:
|
|
|
- part = ""
|
|
|
+ one = _print.bold("{0}", num)
|
|
|
+ two = _print.bold("{0}", max_num)
|
|
|
+ part = _(" ({current} of {maximum})").format(current=one,
|
|
|
+ maximum=two)
|
|
|
if self.is_binary_pkg(pkg,binary):
|
|
|
_print = _print.foreground(Colors.PURPLE)
|
|
|
else:
|
|
|
@@ -312,19 +322,24 @@ class Update:
|
|
|
self.startTask(_("Installing %s") %
|
|
|
_print(str(pkg)))
|
|
|
|
|
|
+ def _printFetching(self, fn):
|
|
|
+ """
|
|
|
+ Вывод сообщения о скачивании
|
|
|
+ """
|
|
|
+ self.endTask()
|
|
|
+ self.startTask(_("Fetching binary packages"))
|
|
|
+
|
|
|
+
|
|
|
def _printUninstallPackage(self, pkg, num=1, max_num=1):
|
|
|
"""
|
|
|
Вывод сообщения удаления пакета
|
|
|
"""
|
|
|
self.endTask()
|
|
|
_print = self.color_print
|
|
|
- if max_num > 1:
|
|
|
- one = _print.foreground(Colors.YELLOW).bold("{0}", num)
|
|
|
- two = _print.foreground(Colors.YELLOW).bold("{0}", max_num)
|
|
|
- part = _(" ({current} of {maximum})").format(current=one,
|
|
|
- maximum=two)
|
|
|
- else:
|
|
|
- part = ""
|
|
|
+ one = _print.bold("{0}", num)
|
|
|
+ two = _print.bold("{0}", max_num)
|
|
|
+ part = _(" ({current} of {maximum})").format(current=one,
|
|
|
+ maximum=two)
|
|
|
_print = _print.foreground(Colors.RED)
|
|
|
|
|
|
self.startTask(
|
|
|
@@ -337,7 +352,7 @@ class Update:
|
|
|
"""
|
|
|
cmd_path = getProgPath(cmd)
|
|
|
if not cmd_path:
|
|
|
- raise UpdateError(_("Failed to find %s command") % cmd)
|
|
|
+ raise UpdateError(_("Failed to find the %s command") % cmd)
|
|
|
with EmergeParser(
|
|
|
emerge_parser.CommandExecutor(cmd_path, params)) as emerge:
|
|
|
self._startEmerging(emerge)
|
|
|
@@ -349,7 +364,7 @@ class Update:
|
|
|
"""
|
|
|
cmd_path = getProgPath(cmd)
|
|
|
if not cmd_path:
|
|
|
- raise UpdateError(_("Failed to find %s command") % cmd)
|
|
|
+ raise UpdateError(_("Failed to find the %s command") % cmd)
|
|
|
with EmergeParser(
|
|
|
emerge_parser.CommandExecutor(cmd_path, params)) as emerge:
|
|
|
revdep = RevdepPercentBlock(emerge)
|
|
|
@@ -409,7 +424,7 @@ class Update:
|
|
|
self._display_pretty_package_list(pkglist)
|
|
|
if emerge.install_packages.remove_list:
|
|
|
self.printSUCCESS(_print(
|
|
|
- _("List removal packages")))
|
|
|
+ _("Listing packages for removal")))
|
|
|
self._display_pretty_package_list(
|
|
|
emerge.install_packages.remove_list, remove_list=True)
|
|
|
if str(emerge.download_size) != "0 kB":
|
|
|
@@ -422,12 +437,13 @@ class Update:
|
|
|
"""
|
|
|
# подробный список пакетов
|
|
|
if self.clVars.Get('cl_verbose_set') == 'on':
|
|
|
- self.printPre(str(emerge.uninstall_packages))
|
|
|
+ self.printPre(self._emerge_translate(
|
|
|
+ emerge.uninstall_packages.verbose_result))
|
|
|
else:
|
|
|
_print = self.color_print
|
|
|
pkglist = emerge.uninstall_packages.list
|
|
|
self.printSUCCESS(_print.bold(
|
|
|
- _("List removal packages")))
|
|
|
+ _("Listing packages for removal")))
|
|
|
self._display_pretty_package_list(pkglist, remove_list=True)
|
|
|
|
|
|
def getCacheOnWorld(self, params, packages, check=False):
|
|
|
@@ -439,7 +455,8 @@ class Update:
|
|
|
elog = EmergeLog(
|
|
|
EmergeLogNamedTask(ClUpdateAction.log_names['premerge']))
|
|
|
if check and (elog.list or elog.remove_list):
|
|
|
- self.emerge_cache.drop_cache()
|
|
|
+ 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()
|
|
|
@@ -475,7 +492,8 @@ class Update:
|
|
|
emerge.run()
|
|
|
if "@world" in packages:
|
|
|
if emerge.install_packages.remove_list:
|
|
|
- self.emerge_cache.drop_cache()
|
|
|
+ self.emerge_cache.drop_cache(
|
|
|
+ "List has packages for remove")
|
|
|
else:
|
|
|
self.updateCache(emerge.install_packages.list)
|
|
|
if not emerge.install_packages.list:
|
|
|
@@ -483,7 +501,7 @@ class Update:
|
|
|
return True
|
|
|
self._display_install_package(emerge)
|
|
|
except EmergeError:
|
|
|
- self.emerge_cache.drop_cache()
|
|
|
+ self.emerge_cache.drop_cache("Emerge error")
|
|
|
self.printPre(self._emerge_translate(emerge.prepare_error))
|
|
|
raise
|
|
|
if self.clVars.Get('cl_update_pretend_set') == 'on':
|
|
|
@@ -516,10 +534,11 @@ class Update:
|
|
|
emerge.emerging.add_observer(self._printEmergePackage)
|
|
|
emerge.installing.add_observer(self._printInstallPackage)
|
|
|
emerge.uninstalling.add_observer(self._printUninstallPackage)
|
|
|
+ emerge.fetching.add_observer(self._printFetching)
|
|
|
try:
|
|
|
emerge.run()
|
|
|
except EmergeError:
|
|
|
- self.emerge_cache.drop_cache()
|
|
|
+ self.emerge_cache.drop_cache("Emerge error")
|
|
|
if emerge.emerging_error:
|
|
|
self.printPre(
|
|
|
self._emerge_translate(emerge.emerging_error.log))
|
|
|
@@ -547,7 +566,7 @@ class Update:
|
|
|
if not emerge.install_packages.list:
|
|
|
return True
|
|
|
except EmergeError:
|
|
|
- self.emerge_cache.drop_cache()
|
|
|
+ self.emerge_cache.drop_cache("Emerge error")
|
|
|
self.printPre(self._emerge_translate(emerge.prepare_error))
|
|
|
raise
|
|
|
self._startEmerging(emerge)
|
|
|
diff --git update/utils/cl_update.py update/utils/cl_update.py
|
|
|
index 2ac2c36..a58c827 100644
|
|
|
--- update/utils/cl_update.py
|
|
|
+++ update/utils/cl_update.py
|
|
|
@@ -51,8 +51,7 @@ class ClUpdateAction(Action):
|
|
|
return func
|
|
|
|
|
|
def pkg_color(text):
|
|
|
- _print = get_color_print()
|
|
|
- return _print.bold.foreground(Colors.BLUE)(text)
|
|
|
+ return text
|
|
|
|
|
|
log_names = {'premerge': "check updates",
|
|
|
'python_updater': "update python modules",
|
|
|
@@ -151,7 +150,7 @@ class ClUpdateAction(Action):
|
|
|
]
|
|
|
},
|
|
|
{'name': 'update_other:depclean',
|
|
|
- 'group': __("Cleaning system from needless packages"),
|
|
|
+ 'group': __("Cleaning the system from needless packages"),
|
|
|
'tasks': [
|
|
|
{'name': 'update_other:update_depclean',
|
|
|
'message': __("Calculating dependencies"),
|
|
|
@@ -209,19 +208,19 @@ class ClUpdateAction(Action):
|
|
|
'tasks': [
|
|
|
{'name': 'sync_reps',
|
|
|
'foreach': 'cl_update_sync_rep',
|
|
|
- 'message': __("Syncing {eachvar:capitalize} repository"),
|
|
|
+ 'message': __("Syncing the {eachvar:capitalize} repository"),
|
|
|
'method': 'Update.syncRepositories(eachvar)',
|
|
|
'condition': lambda Get: Get('cl_update_sync_rep')
|
|
|
},
|
|
|
{'name': 'sync_other_reps',
|
|
|
'foreach': 'cl_update_other_rep_name',
|
|
|
- 'message': __("Syncing {eachvar:capitalize} repository"),
|
|
|
+ 'message': __("Syncing the {eachvar:capitalize} repository"),
|
|
|
'method': 'Update.syncLaymanRepository(eachvar)',
|
|
|
'condition': lambda Get: Get('cl_update_other_set') == 'on'
|
|
|
},
|
|
|
{'name': 'sync_reps:regen_cache',
|
|
|
'foreach': 'cl_update_sync_overlay_rep',
|
|
|
- 'message': __("Updating {eachvar:capitalize} repository cache"),
|
|
|
+ 'message': __("Updating the {eachvar:capitalize} repository cache"),
|
|
|
'essential': False,
|
|
|
'method': 'Update.regenCache(eachvar)',
|
|
|
'condition': (
|
|
|
@@ -231,12 +230,12 @@ class ClUpdateAction(Action):
|
|
|
},
|
|
|
{'name': 'sync_other_reps:regen_other_cache',
|
|
|
'foreach': 'cl_update_other_rep_name',
|
|
|
- 'message': __("Updating {eachvar:capitalize} repository cache"),
|
|
|
+ 'message': __("Updating the {eachvar:capitalize} repository cache"),
|
|
|
'method': 'Update.regenCache(eachvar)',
|
|
|
'essential': False,
|
|
|
},
|
|
|
{'name': 'emerge_metadata',
|
|
|
- 'message': __("Metadata trasfer"),
|
|
|
+ 'message': __("Metadata transfer"),
|
|
|
'method': 'Update.emergeMetadata()',
|
|
|
'condition': (
|
|
|
lambda Get: (Get('cl_update_outdate_set') == 'on' and
|
|
|
@@ -244,7 +243,7 @@ class ClUpdateAction(Action):
|
|
|
Get('cl_update_metadata_force') == 'force'))
|
|
|
},
|
|
|
{'name': 'eix_update',
|
|
|
- 'message': __("Updating eix cache"),
|
|
|
+ 'message': __("Updating the eix cache"),
|
|
|
'method': 'Update.eixUpdate()',
|
|
|
'condition': (
|
|
|
lambda Get: (Get('cl_update_outdate_set') == 'on' and
|
|
|
diff --git update/variables/update.py update/variables/update.py
|
|
|
index 01eedf8..1c22e5c 100644
|
|
|
--- update/variables/update.py
|
|
|
+++ update/variables/update.py
|
|
|
@@ -74,8 +74,8 @@ class VariableClUpdateRevSet(Variable):
|
|
|
"cl_update_eixupdate_force"]
|
|
|
|
|
|
def init(self):
|
|
|
- self.help = _("revision update")
|
|
|
- self.label = _("Revision update")
|
|
|
+ self.help = _("make a revision update")
|
|
|
+ self.label = _("Make a revision update")
|
|
|
|
|
|
class VariableClUpdateRep(Variable):
|
|
|
"""
|
|
|
@@ -122,7 +122,7 @@ class VariableClUpdateSystemProfile(ReadonlyVariable):
|
|
|
path.join(path.dirname(make_profile),
|
|
|
os.readlink(make_profile)))
|
|
|
except:
|
|
|
- raise VariableError(_("Failed to determine system profile"))
|
|
|
+ raise VariableError(_("Failed to determine the system profile"))
|
|
|
|
|
|
class VariableClUpdateLaymanStorage(ReadonlyVariable):
|
|
|
"""
|
|
|
@@ -239,8 +239,8 @@ class VariableClUpdateSyncRep(Variable):
|
|
|
untrusted = True
|
|
|
|
|
|
def init(self):
|
|
|
- self.help = _("synchronize repositories (all by default)")
|
|
|
- self.label = _("Synchronize repositories")
|
|
|
+ self.help = _("synchronized repositories (all by default)")
|
|
|
+ self.label = _("Synchronized repositories")
|
|
|
|
|
|
def set(self,value):
|
|
|
orderList = self.Get('cl_update_rep_name')
|
|
|
@@ -288,15 +288,15 @@ class VariableClUpdateMetadataForce(Variable):
|
|
|
#untrusted = True
|
|
|
|
|
|
def init(self):
|
|
|
- self.help = ("'force' - " + _("force update ebuilds metadata") +
|
|
|
- ",\n'skip' - " + _("skip update ebuilds metadata") +
|
|
|
- ",\n'auto' - " + _("update metadata if they are outdated"))
|
|
|
+ self.help = ("'force' - " + _("force the update ebuilds metadata") +
|
|
|
+ ",\n'skip' - " + _("skip the ebuild metadata update") +
|
|
|
+ ",\n'auto' - " + _("update metadata if it is outdated"))
|
|
|
self.label = _("Update metadata")
|
|
|
|
|
|
def choice(self):
|
|
|
return [("force", _("Force")),
|
|
|
("skip", _("Skip")),
|
|
|
- ("auto", _("By need"))]
|
|
|
+ ("auto", _("If needed"))]
|
|
|
|
|
|
class VariableClUpdateEixupdateForce(Variable):
|
|
|
"""
|
|
|
@@ -310,15 +310,16 @@ class VariableClUpdateEixupdateForce(Variable):
|
|
|
#untrusted = True
|
|
|
|
|
|
def init(self):
|
|
|
- self.help = ("'force' - " + _("force update eix cache") +
|
|
|
- ",\n'skip' - " + _("skip update eix cache") +
|
|
|
- ",\n'auto' - " + _("update eix cache if it is outdated"))
|
|
|
- self.label = _("Update eix cache")
|
|
|
+ self.help = ("'force' - " + _("force the eix cache update") +
|
|
|
+ ",\n'skip' - " + _("skip the eix cache update") +
|
|
|
+ ",\n'auto' - " + _("update the eix cache if it "
|
|
|
+ "is outdated"))
|
|
|
+ self.label = _("Update the eix cache")
|
|
|
|
|
|
def choice(self):
|
|
|
return [("force", _("Force")),
|
|
|
("skip", _("Skip")),
|
|
|
- ("auto", _("By need"))]
|
|
|
+ ("auto", _("If needed"))]
|
|
|
|
|
|
class VariableClUpdateOtherSet(Variable):
|
|
|
"""
|
|
|
@@ -389,9 +390,10 @@ class VariableClUpdatePretendSet(Variable):
|
|
|
opt = ["-p", "--pretend"]
|
|
|
|
|
|
def init(self):
|
|
|
- self.label = _("Pretend package update")
|
|
|
- self.help = _("instead of actually performing packages update, "
|
|
|
- "simply only display what have been installed")
|
|
|
+ self.label = _("Pretend a package update")
|
|
|
+ self.help = _("instead of actually performing the update, "
|
|
|
+ "simply display the list of packages that "
|
|
|
+ "will be installed")
|
|
|
|
|
|
class VariableClUpdateSyncOnlySet(Variable):
|
|
|
"""
|
|
|
@@ -399,7 +401,7 @@ class VariableClUpdateSyncOnlySet(Variable):
|
|
|
"""
|
|
|
type = "bool"
|
|
|
value = "off"
|
|
|
- opt = ["-s","--sync-only"]
|
|
|
+ opt = ["-s", "--sync"]
|
|
|
|
|
|
def init(self):
|
|
|
self.label = _("Only synchronize repositories")
|
|
|
@@ -423,5 +425,5 @@ class VariableClUpdateWaitAnotherSet(Variable):
|
|
|
opt = ["--wait-another-update"]
|
|
|
|
|
|
def init(self):
|
|
|
- self.label = _("Wait for complete another update")
|
|
|
- self.help = _("wait until the other updates or abort")
|
|
|
+ self.label = _("Wait for another update to be complete")
|
|
|
+ self.help = _("wait until the running update is finished")
|
|
|
diff --git update/wsdl_update.py update/wsdl_update.py
|
|
|
index 10ec376..9bd535e 100644
|
|
|
--- update/wsdl_update.py
|
|
|
+++ update/wsdl_update.py
|
|
|
@@ -39,7 +39,7 @@ class Wsdl(WsdlBase):
|
|
|
# категория метода
|
|
|
'category': __('Update'),
|
|
|
# заголовок метода
|
|
|
- 'title': __("Update System"),
|
|
|
+ 'title': __("Update the System"),
|
|
|
# иконка для графической консоли
|
|
|
'image': 'software-properties,preferences-desktop',
|
|
|
# метод присутствует в графической консоли
|
|
|
@@ -60,7 +60,7 @@ class Wsdl(WsdlBase):
|
|
|
'setvars': {'cl_action!': 'sync'},
|
|
|
# описание груп (список лямбда функций)
|
|
|
'groups': [
|
|
|
- lambda group: group(_("Update system"),
|
|
|
+ lambda group: group(_("Update the system"),
|
|
|
normal=(),
|
|
|
expert=(
|
|
|
'cl_rebuild_world_set', 'cl_update_rev_set',
|