|
|
|
@ -42,7 +42,8 @@ from calculate.lib.utils.files import (
|
|
|
|
|
from calculate.lib.utils.mount import isMount
|
|
|
|
|
from calculate.lib.utils.git import Git
|
|
|
|
|
from calculate.builder.variables.action import Actions
|
|
|
|
|
from calculate.lib.utils.portage import (Layman, EmergeLog, EmergeLogFiltered,
|
|
|
|
|
from calculate.lib.utils.portage import (ReposConf, EmergeLog,
|
|
|
|
|
EmergeLogFiltered,
|
|
|
|
|
EmergeLogNamedTask,
|
|
|
|
|
InstalledPackageInfo, EbuildInfoError,
|
|
|
|
|
EbuildInfo, ChrootEix, getRequires,
|
|
|
|
@ -353,12 +354,12 @@ class Builder(Update):
|
|
|
|
|
where="cl_update_rep_name", eq=repname, limit=1)
|
|
|
|
|
chroot_path = path.normpath(self.clVars.Get('cl_chroot_path'))
|
|
|
|
|
rpath_orig = rpath[len(chroot_path):]
|
|
|
|
|
layman = Layman(self.clVars.Get('update.cl_update_layman_installed'),
|
|
|
|
|
self.clVars.Get('update.cl_update_layman_make'),
|
|
|
|
|
self.clVars.Get('update.cl_update_layman_conf'),
|
|
|
|
|
prefix=self.clVars.Get('cl_builder_path'))
|
|
|
|
|
reposconf = ReposConf(dv.Get('cl_update_reposconf'),
|
|
|
|
|
dv.Get('cl_update_reposconf_dir'),
|
|
|
|
|
prefix=self.clVars.Get('cl_builder_path'))
|
|
|
|
|
|
|
|
|
|
if repname not in ("gentoo", "portage"):
|
|
|
|
|
layman.remove(repname, rpath_orig)
|
|
|
|
|
reposconf.remove(repname, rpath_orig)
|
|
|
|
|
removeDir(rpath)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
@ -1122,55 +1123,55 @@ class Builder(Update):
|
|
|
|
|
self._startEmerging(emerge)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def update_layman(self):
|
|
|
|
|
def update_rep_list(self):
|
|
|
|
|
"""
|
|
|
|
|
Обновить базу layman
|
|
|
|
|
Обновить список доступных репозиториев
|
|
|
|
|
:param builder_path:
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
|
|
|
|
builder_path = self.clVars.Get("cl_builder_path")
|
|
|
|
|
cmd = "/usr/bin/layman"
|
|
|
|
|
cmd = "/usr/bin/eselect"
|
|
|
|
|
cmd_path = self.get_prog_path(cmd)
|
|
|
|
|
logfile = self._get_log_file()
|
|
|
|
|
if not cmd_path:
|
|
|
|
|
raise BuilderError(_("Failed to find the %s command") % cmd)
|
|
|
|
|
layman = self.chrootize(builder_path, CommandExecutor(cmd_path, ["-f"],
|
|
|
|
|
repsync = self.chrootize(builder_path, CommandExecutor(cmd_path, ["repository", "list"],
|
|
|
|
|
logfile=logfile))
|
|
|
|
|
layman.execute()
|
|
|
|
|
return layman.success()
|
|
|
|
|
repsync.execute()
|
|
|
|
|
return repsync.success()
|
|
|
|
|
|
|
|
|
|
def syncLaymanRepository(self, repname):
|
|
|
|
|
def syncOtherRepository(self, repname):
|
|
|
|
|
"""
|
|
|
|
|
Обновить репозиторий через layman
|
|
|
|
|
Обновить репозиторий через emerge --sync
|
|
|
|
|
"""
|
|
|
|
|
chroot_path = self.clVars.Get('cl_builder_path')
|
|
|
|
|
layman = self.get_prog_path('/usr/bin/layman')
|
|
|
|
|
if not layman:
|
|
|
|
|
raise BuilderError(_("The Layman tool is not found"))
|
|
|
|
|
emerge = self.get_prog_path('/usr/bin/emerge')
|
|
|
|
|
if not emerge:
|
|
|
|
|
raise BuilderError(_("The Emerge tool is not found"))
|
|
|
|
|
|
|
|
|
|
rpath = self.clVars.Select('cl_builder_other_rep_path',
|
|
|
|
|
where='cl_builder_other_rep_name',
|
|
|
|
|
eq=repname, limit=1)
|
|
|
|
|
laymanname = path.basename(rpath)
|
|
|
|
|
self.stash_cache(rpath, laymanname)
|
|
|
|
|
repdirname = path.basename(rpath)
|
|
|
|
|
self.stash_cache(rpath, repdirname)
|
|
|
|
|
try:
|
|
|
|
|
if Git.is_git(rpath):
|
|
|
|
|
self.addProgress()
|
|
|
|
|
p = PercentProgress(
|
|
|
|
|
"/usr/bin/chroot", chroot_path,
|
|
|
|
|
layman, "-s", laymanname, part=1, atty=True)
|
|
|
|
|
emerge, "--sync", repname, part=1, atty=True)
|
|
|
|
|
for perc in p.progress():
|
|
|
|
|
self.setProgress(perc)
|
|
|
|
|
else:
|
|
|
|
|
p = self.chroot_process(
|
|
|
|
|
chroot_path, layman, "-s", repname, stderr=STDOUT)
|
|
|
|
|
chroot_path, emerge, "--sync", repname, stderr=STDOUT)
|
|
|
|
|
if p.failed():
|
|
|
|
|
raise BuilderError(
|
|
|
|
|
_("Failed to update the {rname} repository").format(
|
|
|
|
|
rname=repname),
|
|
|
|
|
addon=p.read())
|
|
|
|
|
finally:
|
|
|
|
|
self.unstash_cache(rpath, laymanname)
|
|
|
|
|
self.unstash_cache(rpath, repdirname)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
cap_file = "/var/lib/calculate/filecaps"
|
|
|
|
|