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 8269A138D1A for ; Wed, 15 Jul 2015 15:53:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 969C6E0844; Wed, 15 Jul 2015 15:53:38 +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 3C1BEE0844 for ; Wed, 15 Jul 2015 15:53:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2BC5C340A7F for ; Wed, 15 Jul 2015 15:53:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 97843738 for ; Wed, 15 Jul 2015 15:53:34 +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: <1436975668.57848c6abf1a43a9df8efcefc4cbe2297d4ecac4.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: 57848c6abf1a43a9df8efcefc4cbe2297d4ecac4 X-VCS-Branch: master Date: Wed, 15 Jul 2015 15:53:34 +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: eecb99f1-d3c5-4b09-8158-95107112c988 X-Archives-Hash: 64769937549c25e05f76f1601e656b66 commit: 57848c6abf1a43a9df8efcefc4cbe2297d4ecac4 Author: Devan Franchini gentoo org> AuthorDate: Wed Jul 15 15:54:28 2015 +0000 Commit: Devan Franchini gentoo org> CommitDate: Wed Jul 15 15:54:28 2015 +0000 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=57848c6a dbbase.py: Optimizes if check for db_type layman/dbbase.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/layman/dbbase.py b/layman/dbbase.py index 0bdd4e9..283d65c 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -179,10 +179,10 @@ class DbBase(object): ''' Read the overlay database for installed overlay definitions. ''' + db_type = self.db_type + if text and text_type: db_type = text_type - else: - db_type = self.db_type #Added to keep xml functionality for cached overlay XML definitions if 'cache' in path and '.xml' in path: @@ -197,11 +197,16 @@ class DbBase(object): db_ctl.read_db(path, text=text) - def write(self, path): + def write(self, path, migrate_type=None): ''' Write the list of overlays to a file. ''' - db_ctl = self.mod_ctl.get_class(self.db_type)(self.config, + db_type = self.db_type + + if migrate_type: + db_type = migrate_type + + db_ctl = self.mod_ctl.get_class(db_type)(self.config, self.overlays, self.paths, self.ignore,