Gentoo Archives: gentoo-portage-dev

From: Aaron Bauman <bman@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Aaron Bauman <bman@g.o>
Subject: [gentoo-portage-dev] [PATCH 28/68] lib/portage/cache/sql_template.py: fix whitespace
Date: Mon, 03 Aug 2020 22:45:12
Message-Id: 20200803224327.1593726-28-bman@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 01/68] lib/portage/util/_dyn_libs/PreservedLibsRegistry.py: fix whitespace by Aaron Bauman
1 Signed-off-by: Aaron Bauman <bman@g.o>
2 ---
3 lib/portage/cache/sql_template.py | 24 ++++++++++++------------
4 1 file changed, 12 insertions(+), 12 deletions(-)
5
6 diff --git a/lib/portage/cache/sql_template.py b/lib/portage/cache/sql_template.py
7 index b87612f2d..180dd60b2 100644
8 --- a/lib/portage/cache/sql_template.py
9 +++ b/lib/portage/cache/sql_template.py
10 @@ -1,4 +1,4 @@
11 -# Copyright: 2005 Gentoo Foundation
12 +# Copyright: 2005-2020 Gentoo Authors
13 # Author(s): Brian Harring (ferringb@g.o)
14 # License: GPL2
15
16 @@ -7,19 +7,19 @@ from portage.cache.template import reconstruct_eclasses
17
18 class SQLDatabase(template.database):
19 """template class for RDBM based caches
20 -
21 +
22 This class is designed such that derivatives don't have to change much code, mostly constant strings.
23 _BaseError must be an exception class that all Exceptions thrown from the derived RDBMS are derived
24 from.
25
26 SCHEMA_INSERT_CPV_INTO_PACKAGE should be modified dependant on the RDBMS, as should SCHEMA_PACKAGE_CREATE-
27 - basically you need to deal with creation of a unique pkgid. If the dbapi2 rdbms class has a method of
28 + basically you need to deal with creation of a unique pkgid. If the dbapi2 rdbms class has a method of
29 recovering that id, then modify _insert_cpv to remove the extra select.
30
31 Creation of a derived class involves supplying _initdb_con, and table_exists.
32 Additionally, the default schemas may have to be modified.
33 """
34 -
35 +
36 SCHEMA_PACKAGE_NAME = "package_cache"
37 SCHEMA_PACKAGE_CREATE = "CREATE TABLE %s (\
38 pkgid INTEGER PRIMARY KEY, label VARCHAR(255), cpv VARCHAR(255), UNIQUE(label, cpv))" % SCHEMA_PACKAGE_NAME
39 @@ -116,10 +116,10 @@ class SQLDatabase(template.database):
40
41 def _delitem(self, cpv):
42 """delete a cpv cache entry
43 - derived RDBM classes for this *must* either support cascaded deletes, or
44 + derived RDBM classes for this *must* either support cascaded deletes, or
45 override this method"""
46 try:
47 - try:
48 + try:
49 self.con.execute("DELETE FROM %s WHERE label=%s AND cpv=%s" % \
50 (self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv)))
51 if self.autocommits:
52 @@ -151,7 +151,7 @@ class SQLDatabase(template.database):
53 except self._BaseError as e:
54 raise cache_errors.CacheCorruption(cpv, e)
55
56 - # __getitem__ fills out missing values,
57 + # __getitem__ fills out missing values,
58 # so we store only what's handed to us and is a known key
59 db_values = []
60 for key in self._known_keys:
61 @@ -183,7 +183,7 @@ class SQLDatabase(template.database):
62 doesn't support auto-increment columns for pkgid.
63 returns the cpvs new pkgid
64 note this doesn't commit the transaction. The caller is expected to."""
65 -
66 +
67 cpv = self._sfilter(cpv)
68 if self._supports_replace:
69 query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE.replace("INSERT","REPLACE",1)
70 @@ -201,7 +201,7 @@ class SQLDatabase(template.database):
71 raise
72 self.con.execute("SELECT pkgid FROM %s WHERE label=%s AND cpv=%s" % \
73 (self.SCHEMA_PACKAGE_NAME, self.label, cpv))
74 -
75 +
76 if self.con.rowcount != 1:
77 raise cache_error.CacheCorruption(cpv, "Tried to insert the cpv, but found "
78 " %i matches upon the following select!" % len(rows))
79 @@ -231,7 +231,7 @@ class SQLDatabase(template.database):
80 raise cache_errors.GeneralCacheCorruption(e)
81
82 try:
83 - self.con.execute("SELECT cpv FROM %s WHERE label=%s" %
84 + self.con.execute("SELECT cpv FROM %s WHERE label=%s" %
85 (self.SCHEMA_PACKAGE_NAME, self.label))
86 except self._BaseError as e:
87 raise cache_errors.GeneralCacheCorruption(e)
88 @@ -246,7 +246,7 @@ class SQLDatabase(template.database):
89 self.label))
90 except self._BaseError as e:
91 raise cache_errors.CacheCorruption(self, cpv, e)
92 -
93 +
94 oldcpv = None
95 l = []
96 for x, y, v in self.con.fetchall():
97 @@ -267,7 +267,7 @@ class SQLDatabase(template.database):
98 d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"])
99 else:
100 d["_eclasses_"] = {}
101 - yield cpv, d
102 + yield cpv, d
103
104 def commit(self):
105 self.db.commit()
106 --
107 2.28.0