From bc7067fb12409fa8fa7cc1be4779dd5142768931 Mon Sep 17 00:00:00 2001 From: Mike Khiretskiy Date: Mon, 14 Jul 2014 10:12:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D1=80=D0=BE=D1=82=D0=BA=D0=B0=D1=8F?= =?UTF-8?q?=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8F=20--other-update,=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81?= =?UTF-8?q?=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update/package_tools.py | 10 ++++++++++ update/variables/update.py | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/update/package_tools.py b/update/package_tools.py index 22ed72f..90dde33 100644 --- a/update/package_tools.py +++ b/update/package_tools.py @@ -126,6 +126,16 @@ class Layman: self._add_to_makeconf(rpath) 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: """ Объект для управление git репозиторием diff --git a/update/variables/update.py b/update/variables/update.py index 1c22e5c..f770836 100644 --- a/update/variables/update.py +++ b/update/variables/update.py @@ -21,10 +21,12 @@ from os import path from calculate.lib.datavars import (Variable, VariableError, ReadonlyVariable, ReadonlyTableVariable, TableVariable, FieldValue) 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.update.emerge_parser import EmergeCache +from calculate.update.package_tools import Git, GitError, Layman setLocalTranslate('cl_update3',sys.modules[__name__]) @@ -327,7 +329,7 @@ class VariableClUpdateOtherSet(Variable): """ type = "bool" value = "off" - opt = ["--update-other"] + opt = ["-o", "--update-other"] def init(self): self.help = _("update other overlays") @@ -342,10 +344,13 @@ class VariableClUpdateOtherRepData(ReadonlyTableVariable): def generator(self): 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'): repo_file = path.join(rpath,"profiles/repo_name") 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) def get(self):