From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id ADD3F138D18 for ; Mon, 13 Jul 2015 23:05:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5D9B114001; Mon, 13 Jul 2015 23:05:47 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9BA0A14001 for ; Mon, 13 Jul 2015 23:05:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8C224340A02 for ; Mon, 13 Jul 2015 23:05:45 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A8A4875E for ; Mon, 13 Jul 2015 23:05:43 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1436828739.d4a11440154449a27357dc2b670803220e7c2f06.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/dbbase.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: d4a11440154449a27357dc2b670803220e7c2f06 X-VCS-Branch: master Date: Mon, 13 Jul 2015 23:05:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 302ff158-1dc0-4489-ad54-08891b4fe470 X-Archives-Hash: d7f0191b5cdbeb4045224a7d8e957897 commit: d4a11440154449a27357dc2b670803220e7c2f06 Author: Devan Franchini gentoo org> AuthorDate: Mon Jul 13 23:05:39 2015 +0000 Commit: Devan Franchini gentoo org> CommitDate: Mon Jul 13 23:05:39 2015 +0000 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=d4a11440 dbbase.py: Adds limitation to use only one db type layman/dbbase.py | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/layman/dbbase.py b/layman/dbbase.py index 09133c2..0bdd4e9 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -82,7 +82,7 @@ class DbBase(object): ignore_init_read_errors=False, allow_missing=False): self.config = config - self.db_types = config['db_type'] + self.db_type = config['db_type'] self.ignore = ignore self.ignore_init_read_errors = ignore_init_read_errors self.mod_ctl = Modules(path=MOD_PATH, @@ -96,8 +96,16 @@ class DbBase(object): self.output.debug('Initializing overlay list handler', 8) - if isinstance(self.db_types, STR): - self.db_types = [x.strip() for x in self.db_types.split(',')] + if isinstance(self.db_type, STR): + self.db_type = [x.strip() for x in self.db_type.split(',')] + + if len(self.db_type) > 1: + msg = 'DbBase; warning, multiple instances of "db_type" found:'\ + ' %(db_types)s.\nDefaulting to: %(db_type)s'\ + % {'db_types': self.db_type, 'db_type': self.db_type[0]} + self.output.warn(msg) + + self.db_type = self.db_type[0] for path in self.paths: if not os.path.exists(path): @@ -172,32 +180,34 @@ class DbBase(object): Read the overlay database for installed overlay definitions. ''' if text and text_type: - types = [text_type] + db_type = text_type else: - types = self.db_types + db_type = self.db_type + + #Added to keep xml functionality for cached overlay XML definitions + if 'cache' in path and '.xml' in path: + db_type = 'xml_db' - for t in types: - db_ctl = self.mod_ctl.get_class(t)(self.config, - self.overlays, - self.paths, - self.ignore, - self.ignore_init_read_errors) + db_ctl = self.mod_ctl.get_class(db_type)(self.config, + self.overlays, + self.paths, + self.ignore, + self.ignore_init_read_errors) - db_ctl.read_db(path, text=text) + db_ctl.read_db(path, text=text) def write(self, path): ''' Write the list of overlays to a file. ''' - for types in self.db_types: - db_ctl = self.mod_ctl.get_class(types)(self.config, - self.overlays, - self.paths, - self.ignore, - self.ignore_init_read_errors) + db_ctl = self.mod_ctl.get_class(self.db_type)(self.config, + self.overlays, + self.paths, + self.ignore, + self.ignore_init_read_errors) - db_ctl.write(path) + db_ctl.write(path) def select(self, overlay):