Добавлена короткая опция --other-update, исправлена синхронизация

master3.3
Mike Khiretskiy 10 years ago
parent c18456f459
commit bc7067fb12

@ -126,6 +126,16 @@ class Layman:
self._add_to_makeconf(rpath) self._add_to_makeconf(rpath)
return True return True
def get_installed(self):
"""
Получить список установленных репозиториев
"""
if path.exists(self.installed) and readFile(self.installed).strip():
tree = ET.parse(self.installed)
return [x.text for x in tree.findall("repo/name")]
return []
class Git: class Git:
""" """
Объект для управление git репозиторием Объект для управление git репозиторием

@ -21,10 +21,12 @@ from os import path
from calculate.lib.datavars import (Variable, VariableError, from calculate.lib.datavars import (Variable, VariableError,
ReadonlyVariable, ReadonlyTableVariable, TableVariable, FieldValue) ReadonlyVariable, ReadonlyTableVariable, TableVariable, FieldValue)
from calculate.lib.utils.portage import searchProfile from calculate.lib.utils.portage import searchProfile
from calculate.lib.utils.files import readLinesFile, readFile from calculate.lib.utils.files import readLinesFile, readFile, makeDirectory, \
listDirectory
from calculate.lib.cl_lang import setLocalTranslate from calculate.lib.cl_lang import setLocalTranslate
from calculate.update.emerge_parser import EmergeCache from calculate.update.emerge_parser import EmergeCache
from calculate.update.package_tools import Git, GitError, Layman
setLocalTranslate('cl_update3',sys.modules[__name__]) setLocalTranslate('cl_update3',sys.modules[__name__])
@ -327,7 +329,7 @@ class VariableClUpdateOtherSet(Variable):
""" """
type = "bool" type = "bool"
value = "off" value = "off"
opt = ["--update-other"] opt = ["-o", "--update-other"]
def init(self): def init(self):
self.help = _("update other overlays") self.help = _("update other overlays")
@ -342,10 +344,13 @@ class VariableClUpdateOtherRepData(ReadonlyTableVariable):
def generator(self): def generator(self):
repNames = self.Get('cl_update_rep_name') repNames = self.Get('cl_update_rep_name')
layman = Layman(self.Get('cl_update_layman_installed'),
self.Get('cl_update_layman_make'))
layman_overlays = layman.get_installed()
for rpath in self.Get('cl_portdir_overlay'): for rpath in self.Get('cl_portdir_overlay'):
repo_file = path.join(rpath,"profiles/repo_name") repo_file = path.join(rpath,"profiles/repo_name")
rname = readFile(repo_file).strip() or path.basename(rpath) rname = readFile(repo_file).strip() or path.basename(rpath)
if not rname in repNames: if rname in layman_overlays and not rname in repNames:
yield (rname, rpath) yield (rname, rpath)
def get(self): def get(self):

Loading…
Cancel
Save