summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/layerindexlib/__init__.py
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/__init__.py
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/__init__.py')
-rw-r--r--bitbake/lib/layerindexlib/__init__.py48
1 files changed, 24 insertions, 24 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: