From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5B008138359 for ; Mon, 3 Aug 2020 22:45:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8C880E0CF3; Mon, 3 Aug 2020 22:44:06 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 56B29E0CF3 for ; Mon, 3 Aug 2020 22:44:06 +0000 (UTC) From: Aaron Bauman To: gentoo-portage-dev@lists.gentoo.org Cc: Aaron Bauman Subject: [gentoo-portage-dev] [PATCH 28/68] lib/portage/cache/sql_template.py: fix whitespace Date: Mon, 3 Aug 2020 18:42:47 -0400 Message-Id: <20200803224327.1593726-28-bman@gentoo.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803224327.1593726-1-bman@gentoo.org> References: <20200803224327.1593726-1-bman@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: db053190-dcc4-4aca-9c5c-615cb0073dbe X-Archives-Hash: e1523abc6d764567d3bbc618b9206644 Signed-off-by: Aaron Bauman --- lib/portage/cache/sql_template.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/portage/cache/sql_template.py b/lib/portage/cache/sql_template.py index b87612f2d..180dd60b2 100644 --- a/lib/portage/cache/sql_template.py +++ b/lib/portage/cache/sql_template.py @@ -1,4 +1,4 @@ -# Copyright: 2005 Gentoo Foundation +# Copyright: 2005-2020 Gentoo Authors # Author(s): Brian Harring (ferringb@gentoo.org) # License: GPL2 @@ -7,19 +7,19 @@ from portage.cache.template import reconstruct_eclasses class SQLDatabase(template.database): """template class for RDBM based caches - + This class is designed such that derivatives don't have to change much code, mostly constant strings. _BaseError must be an exception class that all Exceptions thrown from the derived RDBMS are derived from. SCHEMA_INSERT_CPV_INTO_PACKAGE should be modified dependant on the RDBMS, as should SCHEMA_PACKAGE_CREATE- - basically you need to deal with creation of a unique pkgid. If the dbapi2 rdbms class has a method of + basically you need to deal with creation of a unique pkgid. If the dbapi2 rdbms class has a method of recovering that id, then modify _insert_cpv to remove the extra select. Creation of a derived class involves supplying _initdb_con, and table_exists. Additionally, the default schemas may have to be modified. """ - + SCHEMA_PACKAGE_NAME = "package_cache" SCHEMA_PACKAGE_CREATE = "CREATE TABLE %s (\ pkgid INTEGER PRIMARY KEY, label VARCHAR(255), cpv VARCHAR(255), UNIQUE(label, cpv))" % SCHEMA_PACKAGE_NAME @@ -116,10 +116,10 @@ class SQLDatabase(template.database): def _delitem(self, cpv): """delete a cpv cache entry - derived RDBM classes for this *must* either support cascaded deletes, or + derived RDBM classes for this *must* either support cascaded deletes, or override this method""" try: - try: + try: self.con.execute("DELETE FROM %s WHERE label=%s AND cpv=%s" % \ (self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv))) if self.autocommits: @@ -151,7 +151,7 @@ class SQLDatabase(template.database): except self._BaseError as e: raise cache_errors.CacheCorruption(cpv, e) - # __getitem__ fills out missing values, + # __getitem__ fills out missing values, # so we store only what's handed to us and is a known key db_values = [] for key in self._known_keys: @@ -183,7 +183,7 @@ class SQLDatabase(template.database): doesn't support auto-increment columns for pkgid. returns the cpvs new pkgid note this doesn't commit the transaction. The caller is expected to.""" - + cpv = self._sfilter(cpv) if self._supports_replace: query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE.replace("INSERT","REPLACE",1) @@ -201,7 +201,7 @@ class SQLDatabase(template.database): raise self.con.execute("SELECT pkgid FROM %s WHERE label=%s AND cpv=%s" % \ (self.SCHEMA_PACKAGE_NAME, self.label, cpv)) - + if self.con.rowcount != 1: raise cache_error.CacheCorruption(cpv, "Tried to insert the cpv, but found " " %i matches upon the following select!" % len(rows)) @@ -231,7 +231,7 @@ class SQLDatabase(template.database): raise cache_errors.GeneralCacheCorruption(e) try: - self.con.execute("SELECT cpv FROM %s WHERE label=%s" % + self.con.execute("SELECT cpv FROM %s WHERE label=%s" % (self.SCHEMA_PACKAGE_NAME, self.label)) except self._BaseError as e: raise cache_errors.GeneralCacheCorruption(e) @@ -246,7 +246,7 @@ class SQLDatabase(template.database): self.label)) except self._BaseError as e: raise cache_errors.CacheCorruption(self, cpv, e) - + oldcpv = None l = [] for x, y, v in self.con.fetchall(): @@ -267,7 +267,7 @@ class SQLDatabase(template.database): d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"]) else: d["_eclasses_"] = {} - yield cpv, d + yield cpv, d def commit(self): self.db.commit() -- 2.28.0