summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/layerindexlib
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2021-02-09 09:50:21 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-10 23:48:16 +0000
commit75f87db413f3659fee18eff389b7b339b01cce15 (patch)
treee733135549b516c72c4f34172b6bbf865377fc76 /bitbake/lib/layerindexlib
parent7283a0b3b6ca49d0d2e13593333a580ef10439a8 (diff)
downloadpoky-75f87db413f3659fee18eff389b7b339b01cce15.tar.gz
bitbake: logging: Make bitbake logger compatible with python logger
The bitbake logger overrode the definition of the debug() logging call to include a debug level, but this causes problems with code that may be using standard python logging, since the extra argument is interpreted differently. Instead, change the bitbake loggers debug() call to match the python logger call and add a debug2() and debug3() API to replace calls that were logging to a different debug level. [RP: Small fix to ensure bb.debug calls bbdebug()] (Bitbake rev: f68682a79d83e6399eb403f30a1f113516575f51) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/layerindexlib')
-rw-r--r--bitbake/lib/layerindexlib/__init__.py48
-rw-r--r--bitbake/lib/layerindexlib/cooker.py4
-rw-r--r--bitbake/lib/layerindexlib/restapi.py32
-rw-r--r--bitbake/lib/layerindexlib/tests/cooker.py4
-rw-r--r--bitbake/lib/layerindexlib/tests/restapi.py18
5 files changed, 53 insertions, 53 deletions
diff --git a/bitbake/lib/layerindexlib/__init__.py b/bitbake/lib/layerindexlib/__init__.py
index 45157b6681..9ca127b9df 100644
--- a/bitbake/lib/layerindexlib/__init__.py
+++ b/bitbake/lib/layerindexlib/__init__.py
@@ -94,7 +94,7 @@ class LayerIndex():
94 if not param: 94 if not param:
95 continue 95 continue
96 item = param.split('=', 1) 96 item = param.split('=', 1)
97 logger.debug(1, item) 97 logger.debug(item)
98 param_dict[item[0]] = item[1] 98 param_dict[item[0]] = item[1]
99 99
100 return param_dict 100 return param_dict
@@ -123,7 +123,7 @@ class LayerIndex():
123 up = urlparse(url) 123 up = urlparse(url)
124 124
125 if username: 125 if username:
126 logger.debug(1, "Configuring authentication for %s..." % url) 126 logger.debug("Configuring authentication for %s..." % url)
127 password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() 127 password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
128 password_mgr.add_password(None, "%s://%s" % (up.scheme, up.netloc), username, password) 128 password_mgr.add_password(None, "%s://%s" % (up.scheme, up.netloc), username, password)
129 handler = urllib.request.HTTPBasicAuthHandler(password_mgr) 129 handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
@@ -133,20 +133,20 @@ class LayerIndex():
133 133
134 urllib.request.install_opener(opener) 134 urllib.request.install_opener(opener)
135 135
136 logger.debug(1, "Fetching %s (%s)..." % (url, ["without authentication", "with authentication"][bool(username)])) 136 logger.debug("Fetching %s (%s)..." % (url, ["without authentication", "with authentication"][bool(username)]))
137 137
138 try: 138 try:
139 res = urlopen(Request(url, headers={'User-Agent': 'Mozilla/5.0 (bitbake/lib/layerindex)'}, unverifiable=True)) 139 res = urlopen(Request(url, headers={'User-Agent': 'Mozilla/5.0 (bitbake/lib/layerindex)'}, unverifiable=True))
140 except urllib.error.HTTPError as e: 140 except urllib.error.HTTPError as e:
141 logger.debug(1, "HTTP Error: %s: %s" % (e.code, e.reason)) 141 logger.debug("HTTP Error: %s: %s" % (e.code, e.reason))
142 logger.debug(1, " Requested: %s" % (url)) 142 logger.debug(" Requested: %s" % (url))
143 logger.debug(1, " Actual: %s" % (e.geturl())) 143 logger.debug(" Actual: %s" % (e.geturl()))
144 144
145 if e.code == 404: 145 if e.code == 404:
146 logger.debug(1, "Request not found.") 146 logger.debug("Request not found.")
147 raise LayerIndexFetchError(url, e) 147 raise LayerIndexFetchError(url, e)
148 else: 148 else:
149 logger.debug(1, "Headers:\n%s" % (e.headers)) 149 logger.debug("Headers:\n%s" % (e.headers))
150 raise LayerIndexFetchError(url, e) 150 raise LayerIndexFetchError(url, e)
151 except OSError as e: 151 except OSError as e:
152 error = 0 152 error = 0
@@ -170,7 +170,7 @@ class LayerIndex():
170 raise LayerIndexFetchError(url, "Unable to fetch OSError exception: %s" % e) 170 raise LayerIndexFetchError(url, "Unable to fetch OSError exception: %s" % e)
171 171
172 finally: 172 finally:
173 logger.debug(1, "...fetching %s (%s), done." % (url, ["without authentication", "with authentication"][bool(username)])) 173 logger.debug("...fetching %s (%s), done." % (url, ["without authentication", "with authentication"][bool(username)]))
174 174
175 return res 175 return res
176 176
@@ -205,14 +205,14 @@ The format of the indexURI:
205 if reload: 205 if reload:
206 self.indexes = [] 206 self.indexes = []
207 207
208 logger.debug(1, 'Loading: %s' % indexURI) 208 logger.debug('Loading: %s' % indexURI)
209 209
210 if not self.plugins: 210 if not self.plugins:
211 raise LayerIndexException("No LayerIndex Plugins available") 211 raise LayerIndexException("No LayerIndex Plugins available")
212 212
213 for plugin in self.plugins: 213 for plugin in self.plugins:
214 # Check if the plugin was initialized 214 # Check if the plugin was initialized
215 logger.debug(1, 'Trying %s' % plugin.__class__) 215 logger.debug('Trying %s' % plugin.__class__)
216 if not hasattr(plugin, 'type') or not plugin.type: 216 if not hasattr(plugin, 'type') or not plugin.type:
217 continue 217 continue
218 try: 218 try:
@@ -220,11 +220,11 @@ The format of the indexURI:
220 indexEnt = plugin.load_index(indexURI, load) 220 indexEnt = plugin.load_index(indexURI, load)
221 break 221 break
222 except LayerIndexPluginUrlError as e: 222 except LayerIndexPluginUrlError as e:
223 logger.debug(1, "%s doesn't support %s" % (plugin.type, e.url)) 223 logger.debug("%s doesn't support %s" % (plugin.type, e.url))
224 except NotImplementedError: 224 except NotImplementedError:
225 pass 225 pass
226 else: 226 else:
227 logger.debug(1, "No plugins support %s" % indexURI) 227 logger.debug("No plugins support %s" % indexURI)
228 raise LayerIndexException("No plugins support %s" % indexURI) 228 raise LayerIndexException("No plugins support %s" % indexURI)
229 229
230 # Mark CONFIG data as something we've added... 230 # Mark CONFIG data as something we've added...
@@ -255,19 +255,19 @@ will write out the individual elements split by layer and related components.
255 255
256 for plugin in self.plugins: 256 for plugin in self.plugins:
257 # Check if the plugin was initialized 257 # Check if the plugin was initialized
258 logger.debug(1, 'Trying %s' % plugin.__class__) 258 logger.debug('Trying %s' % plugin.__class__)
259 if not hasattr(plugin, 'type') or not plugin.type: 259 if not hasattr(plugin, 'type') or not plugin.type:
260 continue 260 continue
261 try: 261 try:
262 plugin.store_index(indexURI, index) 262 plugin.store_index(indexURI, index)
263 break 263 break
264 except LayerIndexPluginUrlError as e: 264 except LayerIndexPluginUrlError as e:
265 logger.debug(1, "%s doesn't support %s" % (plugin.type, e.url)) 265 logger.debug("%s doesn't support %s" % (plugin.type, e.url))
266 except NotImplementedError: 266 except NotImplementedError:
267 logger.debug(1, "Store not implemented in %s" % plugin.type) 267 logger.debug("Store not implemented in %s" % plugin.type)
268 pass 268 pass
269 else: 269 else:
270 logger.debug(1, "No plugins support %s" % indexURI) 270 logger.debug("No plugins support %s" % indexURI)
271 raise LayerIndexException("No plugins support %s" % indexURI) 271 raise LayerIndexException("No plugins support %s" % indexURI)
272 272
273 273
@@ -292,7 +292,7 @@ layerBranches set. If not, they are effectively blank.'''
292 the default configuration until the first vcs_url/branch match.''' 292 the default configuration until the first vcs_url/branch match.'''
293 293
294 for index in self.indexes: 294 for index in self.indexes:
295 logger.debug(1, ' searching %s' % index.config['DESCRIPTION']) 295 logger.debug(' searching %s' % index.config['DESCRIPTION'])
296 layerBranch = index.find_vcs_url(vcs_url, [branch]) 296 layerBranch = index.find_vcs_url(vcs_url, [branch])
297 if layerBranch: 297 if layerBranch:
298 return layerBranch 298 return layerBranch
@@ -304,7 +304,7 @@ layerBranches set. If not, they are effectively blank.'''
304 If a branch has not been specified, we will iterate over the branches in 304 If a branch has not been specified, we will iterate over the branches in
305 the default configuration until the first collection/branch match.''' 305 the default configuration until the first collection/branch match.'''
306 306
307 logger.debug(1, 'find_collection: %s (%s) %s' % (collection, version, branch)) 307 logger.debug('find_collection: %s (%s) %s' % (collection, version, branch))
308 308
309 if branch: 309 if branch:
310 branches = [branch] 310 branches = [branch]
@@ -312,12 +312,12 @@ layerBranches set. If not, they are effectively blank.'''
312 branches = None 312 branches = None
313 313
314 for index in self.indexes: 314 for index in self.indexes:
315 logger.debug(1, ' searching %s' % index.config['DESCRIPTION']) 315 logger.debug(' searching %s' % index.config['DESCRIPTION'])
316 layerBranch = index.find_collection(collection, version, branches) 316 layerBranch = index.find_collection(collection, version, branches)
317 if layerBranch: 317 if layerBranch:
318 return layerBranch 318 return layerBranch
319 else: 319 else:
320 logger.debug(1, 'Collection %s (%s) not found for branch (%s)' % (collection, version, branch)) 320 logger.debug('Collection %s (%s) not found for branch (%s)' % (collection, version, branch))
321 return None 321 return None
322 322
323 def find_layerbranch(self, name, branch=None): 323 def find_layerbranch(self, name, branch=None):
@@ -408,7 +408,7 @@ layerBranches set. If not, they are effectively blank.'''
408 version=deplayerbranch.version 408 version=deplayerbranch.version
409 ) 409 )
410 if rdeplayerbranch != deplayerbranch: 410 if rdeplayerbranch != deplayerbranch:
411 logger.debug(1, 'Replaced %s:%s:%s with %s:%s:%s' % \ 411 logger.debug('Replaced %s:%s:%s with %s:%s:%s' % \
412 (deplayerbranch.index.config['DESCRIPTION'], 412 (deplayerbranch.index.config['DESCRIPTION'],
413 deplayerbranch.branch.name, 413 deplayerbranch.branch.name,
414 deplayerbranch.layer.name, 414 deplayerbranch.layer.name,
@@ -1121,7 +1121,7 @@ class LayerBranch(LayerIndexItemObj):
1121 @property 1121 @property
1122 def branch(self): 1122 def branch(self):
1123 try: 1123 try:
1124 logger.debug(1, "Get branch object from branches[%s]" % (self.branch_id)) 1124 logger.debug("Get branch object from branches[%s]" % (self.branch_id))
1125 return self.index.branches[self.branch_id] 1125 return self.index.branches[self.branch_id]
1126 except KeyError: 1126 except KeyError:
1127 raise AttributeError('Unable to find branches in index to map branch_id %s' % self.branch_id) 1127 raise AttributeError('Unable to find branches in index to map branch_id %s' % self.branch_id)
@@ -1149,7 +1149,7 @@ class LayerBranch(LayerIndexItemObj):
1149 1149
1150 @actual_branch.setter 1150 @actual_branch.setter
1151 def actual_branch(self, value): 1151 def actual_branch(self, value):
1152 logger.debug(1, "Set actual_branch to %s .. name is %s" % (value, self.branch.name)) 1152 logger.debug("Set actual_branch to %s .. name is %s" % (value, self.branch.name))
1153 if value != self.branch.name: 1153 if value != self.branch.name:
1154 self._setattr('actual_branch', value, prop=False) 1154 self._setattr('actual_branch', value, prop=False)
1155 else: 1155 else:
diff --git a/bitbake/lib/layerindexlib/cooker.py b/bitbake/lib/layerindexlib/cooker.py
index 21ec438a22..2de6e5faa0 100644
--- a/bitbake/lib/layerindexlib/cooker.py
+++ b/bitbake/lib/layerindexlib/cooker.py
@@ -173,7 +173,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
173 else: 173 else:
174 branches = ['HEAD'] 174 branches = ['HEAD']
175 175
176 logger.debug(1, "Loading cooker data branches %s" % branches) 176 logger.debug("Loading cooker data branches %s" % branches)
177 177
178 index = self._load_bblayers(branches=branches) 178 index = self._load_bblayers(branches=branches)
179 179
@@ -220,7 +220,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
220 required=required, layerbranch=layerBranchId, 220 required=required, layerbranch=layerBranchId,
221 dependency=depLayerBranch.layer_id) 221 dependency=depLayerBranch.layer_id)
222 222
223 logger.debug(1, '%s requires %s' % (layerDependency.layer.name, layerDependency.dependency.name)) 223 logger.debug('%s requires %s' % (layerDependency.layer.name, layerDependency.dependency.name))
224 index.add_element("layerDependencies", [layerDependency]) 224 index.add_element("layerDependencies", [layerDependency])
225 225
226 return layerDependencyId 226 return layerDependencyId
diff --git a/bitbake/lib/layerindexlib/restapi.py b/bitbake/lib/layerindexlib/restapi.py
index 7023f42f20..26a1c9674e 100644
--- a/bitbake/lib/layerindexlib/restapi.py
+++ b/bitbake/lib/layerindexlib/restapi.py
@@ -82,7 +82,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
82 82
83 83
84 def load_cache(path, index, branches=[]): 84 def load_cache(path, index, branches=[]):
85 logger.debug(1, 'Loading json file %s' % path) 85 logger.debug('Loading json file %s' % path)
86 with open(path, 'rt', encoding='utf-8') as f: 86 with open(path, 'rt', encoding='utf-8') as f:
87 pindex = json.load(f) 87 pindex = json.load(f)
88 88
@@ -102,7 +102,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
102 if newpBranch: 102 if newpBranch:
103 index.add_raw_element('branches', layerindexlib.Branch, newpBranch) 103 index.add_raw_element('branches', layerindexlib.Branch, newpBranch)
104 else: 104 else:
105 logger.debug(1, 'No matching branches (%s) in index file(s)' % branches) 105 logger.debug('No matching branches (%s) in index file(s)' % branches)
106 # No matching branches.. return nothing... 106 # No matching branches.. return nothing...
107 return 107 return
108 108
@@ -120,7 +120,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
120 load_cache(up.path, index, branches) 120 load_cache(up.path, index, branches)
121 return index 121 return index
122 122
123 logger.debug(1, 'Loading from dir %s...' % (up.path)) 123 logger.debug('Loading from dir %s...' % (up.path))
124 for (dirpath, _, filenames) in os.walk(up.path): 124 for (dirpath, _, filenames) in os.walk(up.path):
125 for filename in filenames: 125 for filename in filenames:
126 if not filename.endswith('.json'): 126 if not filename.endswith('.json'):
@@ -144,7 +144,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
144 def _get_json_response(apiurl=None, username=None, password=None, retry=True): 144 def _get_json_response(apiurl=None, username=None, password=None, retry=True):
145 assert apiurl is not None 145 assert apiurl is not None
146 146
147 logger.debug(1, "fetching %s" % apiurl) 147 logger.debug("fetching %s" % apiurl)
148 148
149 up = urlparse(apiurl) 149 up = urlparse(apiurl)
150 150
@@ -163,9 +163,9 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
163 parsed = json.loads(res.read().decode('utf-8')) 163 parsed = json.loads(res.read().decode('utf-8'))
164 except ConnectionResetError: 164 except ConnectionResetError:
165 if retry: 165 if retry:
166 logger.debug(1, "%s: Connection reset by peer. Retrying..." % url) 166 logger.debug("%s: Connection reset by peer. Retrying..." % url)
167 parsed = _get_json_response(apiurl=up_stripped.geturl(), username=username, password=password, retry=False) 167 parsed = _get_json_response(apiurl=up_stripped.geturl(), username=username, password=password, retry=False)
168 logger.debug(1, "%s: retry successful.") 168 logger.debug("%s: retry successful.")
169 else: 169 else:
170 raise layerindexlib.LayerIndexFetchError('%s: Connection reset by peer. Is there a firewall blocking your connection?' % apiurl) 170 raise layerindexlib.LayerIndexFetchError('%s: Connection reset by peer. Is there a firewall blocking your connection?' % apiurl)
171 171
@@ -207,25 +207,25 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
207 if "*" not in branches: 207 if "*" not in branches:
208 filter = "?filter=name:%s" % "OR".join(branches) 208 filter = "?filter=name:%s" % "OR".join(branches)
209 209
210 logger.debug(1, "Loading %s from %s" % (branches, index.apilinks['branches'])) 210 logger.debug("Loading %s from %s" % (branches, index.apilinks['branches']))
211 211
212 # The link won't include username/password, so pull it from the original url 212 # The link won't include username/password, so pull it from the original url
213 pindex['branches'] = _get_json_response(index.apilinks['branches'] + filter, 213 pindex['branches'] = _get_json_response(index.apilinks['branches'] + filter,
214 username=up.username, password=up.password) 214 username=up.username, password=up.password)
215 if not pindex['branches']: 215 if not pindex['branches']:
216 logger.debug(1, "No valid branches (%s) found at url %s." % (branch, url)) 216 logger.debug("No valid branches (%s) found at url %s." % (branch, url))
217 return index 217 return index
218 index.add_raw_element("branches", layerindexlib.Branch, pindex['branches']) 218 index.add_raw_element("branches", layerindexlib.Branch, pindex['branches'])
219 219
220 # Load all of the layerItems (these can not be easily filtered) 220 # Load all of the layerItems (these can not be easily filtered)
221 logger.debug(1, "Loading %s from %s" % ('layerItems', index.apilinks['layerItems'])) 221 logger.debug("Loading %s from %s" % ('layerItems', index.apilinks['layerItems']))
222 222
223 223
224 # The link won't include username/password, so pull it from the original url 224 # The link won't include username/password, so pull it from the original url
225 pindex['layerItems'] = _get_json_response(index.apilinks['layerItems'], 225 pindex['layerItems'] = _get_json_response(index.apilinks['layerItems'],
226 username=up.username, password=up.password) 226 username=up.username, password=up.password)
227 if not pindex['layerItems']: 227 if not pindex['layerItems']:
228 logger.debug(1, "No layers were found at url %s." % (url)) 228 logger.debug("No layers were found at url %s." % (url))
229 return index 229 return index
230 index.add_raw_element("layerItems", layerindexlib.LayerItem, pindex['layerItems']) 230 index.add_raw_element("layerItems", layerindexlib.LayerItem, pindex['layerItems'])
231 231
@@ -235,13 +235,13 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
235 for branch in index.branches: 235 for branch in index.branches:
236 filter = "?filter=branch__name:%s" % index.branches[branch].name 236 filter = "?filter=branch__name:%s" % index.branches[branch].name
237 237
238 logger.debug(1, "Loading %s from %s" % ('layerBranches', index.apilinks['layerBranches'])) 238 logger.debug("Loading %s from %s" % ('layerBranches', index.apilinks['layerBranches']))
239 239
240 # The link won't include username/password, so pull it from the original url 240 # The link won't include username/password, so pull it from the original url
241 pindex['layerBranches'] = _get_json_response(index.apilinks['layerBranches'] + filter, 241 pindex['layerBranches'] = _get_json_response(index.apilinks['layerBranches'] + filter,
242 username=up.username, password=up.password) 242 username=up.username, password=up.password)
243 if not pindex['layerBranches']: 243 if not pindex['layerBranches']:
244 logger.debug(1, "No valid layer branches (%s) found at url %s." % (branches or "*", url)) 244 logger.debug("No valid layer branches (%s) found at url %s." % (branches or "*", url))
245 return index 245 return index
246 index.add_raw_element("layerBranches", layerindexlib.LayerBranch, pindex['layerBranches']) 246 index.add_raw_element("layerBranches", layerindexlib.LayerBranch, pindex['layerBranches'])
247 247
@@ -256,7 +256,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
256 ("distros", layerindexlib.Distro)]: 256 ("distros", layerindexlib.Distro)]:
257 if lName not in load: 257 if lName not in load:
258 continue 258 continue
259 logger.debug(1, "Loading %s from %s" % (lName, index.apilinks[lName])) 259 logger.debug("Loading %s from %s" % (lName, index.apilinks[lName]))
260 260
261 # The link won't include username/password, so pull it from the original url 261 # The link won't include username/password, so pull it from the original url
262 pindex[lName] = _get_json_response(index.apilinks[lName] + filter, 262 pindex[lName] = _get_json_response(index.apilinks[lName] + filter,
@@ -283,7 +283,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
283 if up.scheme != 'file': 283 if up.scheme != 'file':
284 raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url) 284 raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url)
285 285
286 logger.debug(1, "Storing to %s..." % up.path) 286 logger.debug("Storing to %s..." % up.path)
287 287
288 try: 288 try:
289 layerbranches = index.layerBranches 289 layerbranches = index.layerBranches
@@ -299,12 +299,12 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
299 if getattr(index, objects)[obj].layerbranch_id == layerbranchid: 299 if getattr(index, objects)[obj].layerbranch_id == layerbranchid:
300 filtered.append(getattr(index, objects)[obj]._data) 300 filtered.append(getattr(index, objects)[obj]._data)
301 except AttributeError: 301 except AttributeError:
302 logger.debug(1, 'No obj.layerbranch_id: %s' % objects) 302 logger.debug('No obj.layerbranch_id: %s' % objects)
303 # No simple filter method, just include it... 303 # No simple filter method, just include it...
304 try: 304 try:
305 filtered.append(getattr(index, objects)[obj]._data) 305 filtered.append(getattr(index, objects)[obj]._data)
306 except AttributeError: 306 except AttributeError:
307 logger.debug(1, 'No obj._data: %s %s' % (objects, type(obj))) 307 logger.debug('No obj._data: %s %s' % (objects, type(obj)))
308 filtered.append(obj) 308 filtered.append(obj)
309 return filtered 309 return filtered
310 310
diff --git a/bitbake/lib/layerindexlib/tests/cooker.py b/bitbake/lib/layerindexlib/tests/cooker.py
index 1d0685e099..5ddf89aa21 100644
--- a/bitbake/lib/layerindexlib/tests/cooker.py
+++ b/bitbake/lib/layerindexlib/tests/cooker.py
@@ -72,7 +72,7 @@ class LayerIndexCookerTest(LayersTest):
72 72
73 def test_find_collection(self): 73 def test_find_collection(self):
74 def _check(collection, expected): 74 def _check(collection, expected):
75 self.logger.debug(1, "Looking for collection %s..." % collection) 75 self.logger.debug("Looking for collection %s..." % collection)
76 result = self.layerindex.find_collection(collection) 76 result = self.layerindex.find_collection(collection)
77 if expected: 77 if expected:
78 self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection) 78 self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection)
@@ -91,7 +91,7 @@ class LayerIndexCookerTest(LayersTest):
91 91
92 def test_find_layerbranch(self): 92 def test_find_layerbranch(self):
93 def _check(name, expected): 93 def _check(name, expected):
94 self.logger.debug(1, "Looking for layerbranch %s..." % name) 94 self.logger.debug("Looking for layerbranch %s..." % name)
95 result = self.layerindex.find_layerbranch(name) 95 result = self.layerindex.find_layerbranch(name)
96 if expected: 96 if expected:
97 self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection) 97 self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection)
diff --git a/bitbake/lib/layerindexlib/tests/restapi.py b/bitbake/lib/layerindexlib/tests/restapi.py
index 4646d01f9f..33b5c1c4c8 100644
--- a/bitbake/lib/layerindexlib/tests/restapi.py
+++ b/bitbake/lib/layerindexlib/tests/restapi.py
@@ -57,11 +57,11 @@ class LayerIndexWebRestApiTest(LayersTest):
57 type in self.layerindex.indexes[0].config['local']: 57 type in self.layerindex.indexes[0].config['local']:
58 continue 58 continue
59 for id in getattr(self.layerindex.indexes[0], type): 59 for id in getattr(self.layerindex.indexes[0], type):
60 self.logger.debug(1, "type %s" % (type)) 60 self.logger.debug("type %s" % (type))
61 61
62 self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number not in reloaded index") 62 self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number not in reloaded index")
63 63
64 self.logger.debug(1, "%s ? %s" % (getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id])) 64 self.logger.debug("%s ? %s" % (getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id]))
65 65
66 self.assertEqual(getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id], msg="Reloaded contents different") 66 self.assertEqual(getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id], msg="Reloaded contents different")
67 67
@@ -80,11 +80,11 @@ class LayerIndexWebRestApiTest(LayersTest):
80 type in self.layerindex.indexes[0].config['local']: 80 type in self.layerindex.indexes[0].config['local']:
81 continue 81 continue
82 for id in getattr(self.layerindex.indexes[0] ,type): 82 for id in getattr(self.layerindex.indexes[0] ,type):
83 self.logger.debug(1, "type %s" % (type)) 83 self.logger.debug("type %s" % (type))
84 84
85 self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number missing from reloaded data") 85 self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number missing from reloaded data")
86 86
87 self.logger.debug(1, "%s ? %s" % (getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id])) 87 self.logger.debug("%s ? %s" % (getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id]))
88 88
89 self.assertEqual(getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id], msg="reloaded data does not match original") 89 self.assertEqual(getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id], msg="reloaded data does not match original")
90 90
@@ -111,14 +111,14 @@ class LayerIndexWebRestApiTest(LayersTest):
111 if dep.layer.name == 'meta-python': 111 if dep.layer.name == 'meta-python':
112 break 112 break
113 else: 113 else:
114 self.logger.debug(1, "meta-python was not found") 114 self.logger.debug("meta-python was not found")
115 raise self.failureException 115 raise self.failureException
116 116
117 # Only check the first element... 117 # Only check the first element...
118 break 118 break
119 else: 119 else:
120 # Empty list, this is bad. 120 # Empty list, this is bad.
121 self.logger.debug(1, "Empty list of dependencies") 121 self.logger.debug("Empty list of dependencies")
122 self.assertIsNotNone(first, msg="Empty list of dependencies") 122 self.assertIsNotNone(first, msg="Empty list of dependencies")
123 123
124 # Last dep should be the requested item 124 # Last dep should be the requested item
@@ -128,7 +128,7 @@ class LayerIndexWebRestApiTest(LayersTest):
128 @skipIfNoNetwork() 128 @skipIfNoNetwork()
129 def test_find_collection(self): 129 def test_find_collection(self):
130 def _check(collection, expected): 130 def _check(collection, expected):
131 self.logger.debug(1, "Looking for collection %s..." % collection) 131 self.logger.debug("Looking for collection %s..." % collection)
132 result = self.layerindex.find_collection(collection) 132 result = self.layerindex.find_collection(collection)
133 if expected: 133 if expected:
134 self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection) 134 self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection)
@@ -148,11 +148,11 @@ class LayerIndexWebRestApiTest(LayersTest):
148 @skipIfNoNetwork() 148 @skipIfNoNetwork()
149 def test_find_layerbranch(self): 149 def test_find_layerbranch(self):
150 def _check(name, expected): 150 def _check(name, expected):
151 self.logger.debug(1, "Looking for layerbranch %s..." % name) 151 self.logger.debug("Looking for layerbranch %s..." % name)
152 152
153 for index in self.layerindex.indexes: 153 for index in self.layerindex.indexes:
154 for layerbranchid in index.layerBranches: 154 for layerbranchid in index.layerBranches:
155 self.logger.debug(1, "Present: %s" % index.layerBranches[layerbranchid].layer.name) 155 self.logger.debug("Present: %s" % index.layerBranches[layerbranchid].layer.name)
156 result = self.layerindex.find_layerbranch(name) 156 result = self.layerindex.find_layerbranch(name)
157 if expected: 157 if expected:
158 self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection) 158 self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection)