|
|
|
@ -32,6 +32,7 @@ from calculate.lib.utils.colortext import get_color_print
|
|
|
|
|
from calculate.update.emerge_parser import RevdepPercentBlock
|
|
|
|
|
from calculate.update.datavars import DataVarsUpdate
|
|
|
|
|
from calculate.update.update_info import UpdateInfo
|
|
|
|
|
from calculate.lib.utils.binhosts import fetch_packages
|
|
|
|
|
from calculate.lib.cl_log import log
|
|
|
|
|
import re
|
|
|
|
|
import shutil
|
|
|
|
@ -154,7 +155,7 @@ class Update(MethodsInterface):
|
|
|
|
|
return getProgPath(program_name)
|
|
|
|
|
|
|
|
|
|
def _syncRepository(self, name, url, rpath, revision,
|
|
|
|
|
cb_progress=None, clean=False):
|
|
|
|
|
cb_progress=None, clean=False, notask=False):
|
|
|
|
|
"""
|
|
|
|
|
Синхронизировать репозитори
|
|
|
|
|
"""
|
|
|
|
@ -167,6 +168,10 @@ class Update(MethodsInterface):
|
|
|
|
|
try:
|
|
|
|
|
self.stash_cache(rpath, name)
|
|
|
|
|
if not git.checkExistsRep(rpath):
|
|
|
|
|
if not notask:
|
|
|
|
|
self.startTask(_("Syncing the {rep} repository").format(
|
|
|
|
|
rep=name.capitalize()))
|
|
|
|
|
self.addProgress()
|
|
|
|
|
git.cloneTagRepository(url, rpath, revision,
|
|
|
|
|
cb_progress=cb_progress)
|
|
|
|
|
info_outdated = True
|
|
|
|
@ -177,10 +182,7 @@ class Update(MethodsInterface):
|
|
|
|
|
tag_cr = git.getCommit(rpath, revision)
|
|
|
|
|
cr = git.getCurrentCommit(rpath)
|
|
|
|
|
ref_type = git.reference_type(rpath, revision)
|
|
|
|
|
if git.isNeedUnpack(rpath):
|
|
|
|
|
need_update = True
|
|
|
|
|
clean = True
|
|
|
|
|
elif tag_cr != cr or ref_type == Git.Reference.Branch:
|
|
|
|
|
if tag_cr != cr or ref_type == Git.Reference.Branch:
|
|
|
|
|
need_update = True
|
|
|
|
|
elif clean:
|
|
|
|
|
status = git.getStatusInfo(rpath)
|
|
|
|
@ -189,6 +191,10 @@ class Update(MethodsInterface):
|
|
|
|
|
except GitError:
|
|
|
|
|
need_update = True
|
|
|
|
|
if need_update:
|
|
|
|
|
if not notask:
|
|
|
|
|
self.startTask(_("Syncing the {rep} repository").format(
|
|
|
|
|
rep=name.capitalize()))
|
|
|
|
|
self.addProgress()
|
|
|
|
|
git.updateTagRepository(url, rpath, revision,
|
|
|
|
|
cb_progress=cb_progress,
|
|
|
|
|
clean=clean)
|
|
|
|
@ -300,7 +306,8 @@ class Update(MethodsInterface):
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
@variable_module("update")
|
|
|
|
|
def syncRepositories(self, repname, clean_on_error=True):
|
|
|
|
|
def syncRepositories(self, repname, fallback_sync=False,
|
|
|
|
|
clean_on_error=True):
|
|
|
|
|
"""
|
|
|
|
|
Синхронизировать репозитории
|
|
|
|
|
"""
|
|
|
|
@ -321,7 +328,6 @@ class Update(MethodsInterface):
|
|
|
|
|
rpath_orig = rpath
|
|
|
|
|
else:
|
|
|
|
|
rpath_orig = rpath[len(chroot_path):]
|
|
|
|
|
self.addProgress()
|
|
|
|
|
|
|
|
|
|
mtime = MTimeKeeper(path.join(rpath, "profiles/updates"))
|
|
|
|
|
mtime.save()
|
|
|
|
@ -336,7 +342,8 @@ class Update(MethodsInterface):
|
|
|
|
|
layman.add(repname, url, rpath_orig)
|
|
|
|
|
if not self._syncRepository(repname, url, rpath, revision,
|
|
|
|
|
cb_progress=self.setProgress,
|
|
|
|
|
clean=check_status):
|
|
|
|
|
clean=check_status,
|
|
|
|
|
notask=fallback_sync):
|
|
|
|
|
return "skip"
|
|
|
|
|
return True
|
|
|
|
|
except GitError as e:
|
|
|
|
@ -353,7 +360,8 @@ class Update(MethodsInterface):
|
|
|
|
|
try:
|
|
|
|
|
self._syncRepository(repname, url, rpath_new, revision,
|
|
|
|
|
cb_progress=self.setProgress,
|
|
|
|
|
clean=check_status)
|
|
|
|
|
clean=check_status,
|
|
|
|
|
notask=fallback_sync)
|
|
|
|
|
removeDir(rpath)
|
|
|
|
|
shutil.move(rpath_new, rpath)
|
|
|
|
|
except OSError as e:
|
|
|
|
@ -1200,6 +1208,7 @@ class Update(MethodsInterface):
|
|
|
|
|
if write_binhost:
|
|
|
|
|
if hosts[0] != self.clVars.Get('update.cl_update_binhost'):
|
|
|
|
|
self.refresh_binhost = True
|
|
|
|
|
self.clVars.Set('cl_update_package_cache_set', 'on')
|
|
|
|
|
self.clVars.Write('cl_update_binhost', hosts[0], location="system")
|
|
|
|
|
new_ts = self.clVars.Get("update.cl_update_binhost_timestamp")
|
|
|
|
|
if new_ts:
|
|
|
|
@ -1266,3 +1275,9 @@ class Update(MethodsInterface):
|
|
|
|
|
dv.Set('update.cl_update_branch_name', revs)
|
|
|
|
|
dv.Invalidate('update.cl_update_rep_rev')
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def download_packages(self, url_binhost, packages_fn):
|
|
|
|
|
fetch_packages(url_binhost, packages_fn)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|