|
|
|
@ -23,7 +23,7 @@ import time
|
|
|
|
|
from calculate.core.server.gen_pid import search_worked_process
|
|
|
|
|
from calculate.core.setup_cache import Cache as SetupCache
|
|
|
|
|
from calculate.core.server.func import MethodsInterface
|
|
|
|
|
from calculate.lib.cl_template import SystemIni
|
|
|
|
|
from calculate.lib.cl_template import SystemIni, LayeredIni
|
|
|
|
|
from calculate.lib.datavars import DataVarsError
|
|
|
|
|
|
|
|
|
|
from calculate.lib.utils.tools import AddonError
|
|
|
|
@ -49,7 +49,8 @@ from calculate.lib.utils.portage import (Layman, EmergeLog,
|
|
|
|
|
Colors = TextState.Colors
|
|
|
|
|
from calculate.lib.utils.files import (getProgPath, STDOUT, removeDir,
|
|
|
|
|
PercentProgress, process, getRunCommands,
|
|
|
|
|
readFile, listDirectory)
|
|
|
|
|
readFile, listDirectory, pathJoin,
|
|
|
|
|
writeFile)
|
|
|
|
|
import emerge_parser
|
|
|
|
|
import logging
|
|
|
|
|
from emerge_parser import (EmergeParser, EmergeCommand, EmergeError,
|
|
|
|
@ -221,7 +222,7 @@ class Update(MethodsInterface):
|
|
|
|
|
if not status:
|
|
|
|
|
self.printWARNING(_("Updates autocheck is not enabled"))
|
|
|
|
|
return False
|
|
|
|
|
last_check = SystemIni().getVar('update', 'last_check') or ""
|
|
|
|
|
last_check = SystemIni(self.clVars).getVar('update', 'last_check') or ""
|
|
|
|
|
re_interval = re.compile("^(\d+)\s*(hours?|days?|weeks?)?", re.I)
|
|
|
|
|
interval_match = re_interval.search(interval)
|
|
|
|
|
MINUTE = 60
|
|
|
|
@ -779,7 +780,7 @@ class Update(MethodsInterface):
|
|
|
|
|
"""
|
|
|
|
|
Установить отметку о запуске запланированной проверки
|
|
|
|
|
"""
|
|
|
|
|
SystemIni().setVar('update', {'last_check': str(int(time.time()))})
|
|
|
|
|
SystemIni(self.clVars).setVar('update', {'last_check': str(int(time.time()))})
|
|
|
|
|
|
|
|
|
|
def get_default_emerge_opts(self):
|
|
|
|
|
return self.clVars.Get('cl_emerge_default_opts')
|
|
|
|
@ -1172,10 +1173,23 @@ class Update(MethodsInterface):
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
|
|
|
|
hosts = self.clVars.Get("update.cl_update_binhost_host")
|
|
|
|
|
datas = self.clVars.Get("update.cl_update_binhost_revisions")
|
|
|
|
|
bin_cache_fn = pathJoin(self.clVars.Get('cl_chroot_path'),
|
|
|
|
|
LayeredIni.IniPath.Grp)
|
|
|
|
|
if not hosts:
|
|
|
|
|
self.clVars.Delete('cl_update_binhost', location="system")
|
|
|
|
|
try:
|
|
|
|
|
if path.exists(bin_cache_fn):
|
|
|
|
|
os.unlink(bin_cache_fn)
|
|
|
|
|
except OSError:
|
|
|
|
|
raise UpdateError(
|
|
|
|
|
_("Failed to clear ini cache of binary repository"))
|
|
|
|
|
|
|
|
|
|
raise UpdateError(_("Failed to find the server with "
|
|
|
|
|
"appropriate updates"))
|
|
|
|
|
else:
|
|
|
|
|
with writeFile(bin_cache_fn) as f:
|
|
|
|
|
f.write(datas[0].strip()+"\n")
|
|
|
|
|
if write_binhost:
|
|
|
|
|
if hosts[0] != self.clVars.Get('update.cl_update_binhost'):
|
|
|
|
|
self.refresh_binhost = True
|
|
|
|
|