mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
7283a0b3b6
commit
75f87db413
@@ -94,7 +94,7 @@ class LayerIndex():
|
||||
if not param:
|
||||
continue
|
||||
item = param.split('=', 1)
|
||||
logger.debug(1, item)
|
||||
logger.debug(item)
|
||||
param_dict[item[0]] = item[1]
|
||||
|
||||
return param_dict
|
||||
@@ -123,7 +123,7 @@ class LayerIndex():
|
||||
up = urlparse(url)
|
||||
|
||||
if username:
|
||||
logger.debug(1, "Configuring authentication for %s..." % url)
|
||||
logger.debug("Configuring authentication for %s..." % url)
|
||||
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
|
||||
password_mgr.add_password(None, "%s://%s" % (up.scheme, up.netloc), username, password)
|
||||
handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
|
||||
@@ -133,20 +133,20 @@ class LayerIndex():
|
||||
|
||||
urllib.request.install_opener(opener)
|
||||
|
||||
logger.debug(1, "Fetching %s (%s)..." % (url, ["without authentication", "with authentication"][bool(username)]))
|
||||
logger.debug("Fetching %s (%s)..." % (url, ["without authentication", "with authentication"][bool(username)]))
|
||||
|
||||
try:
|
||||
res = urlopen(Request(url, headers={'User-Agent': 'Mozilla/5.0 (bitbake/lib/layerindex)'}, unverifiable=True))
|
||||
except urllib.error.HTTPError as e:
|
||||
logger.debug(1, "HTTP Error: %s: %s" % (e.code, e.reason))
|
||||
logger.debug(1, " Requested: %s" % (url))
|
||||
logger.debug(1, " Actual: %s" % (e.geturl()))
|
||||
logger.debug("HTTP Error: %s: %s" % (e.code, e.reason))
|
||||
logger.debug(" Requested: %s" % (url))
|
||||
logger.debug(" Actual: %s" % (e.geturl()))
|
||||
|
||||
if e.code == 404:
|
||||
logger.debug(1, "Request not found.")
|
||||
logger.debug("Request not found.")
|
||||
raise LayerIndexFetchError(url, e)
|
||||
else:
|
||||
logger.debug(1, "Headers:\n%s" % (e.headers))
|
||||
logger.debug("Headers:\n%s" % (e.headers))
|
||||
raise LayerIndexFetchError(url, e)
|
||||
except OSError as e:
|
||||
error = 0
|
||||
@@ -170,7 +170,7 @@ class LayerIndex():
|
||||
raise LayerIndexFetchError(url, "Unable to fetch OSError exception: %s" % e)
|
||||
|
||||
finally:
|
||||
logger.debug(1, "...fetching %s (%s), done." % (url, ["without authentication", "with authentication"][bool(username)]))
|
||||
logger.debug("...fetching %s (%s), done." % (url, ["without authentication", "with authentication"][bool(username)]))
|
||||
|
||||
return res
|
||||
|
||||
@@ -205,14 +205,14 @@ The format of the indexURI:
|
||||
if reload:
|
||||
self.indexes = []
|
||||
|
||||
logger.debug(1, 'Loading: %s' % indexURI)
|
||||
logger.debug('Loading: %s' % indexURI)
|
||||
|
||||
if not self.plugins:
|
||||
raise LayerIndexException("No LayerIndex Plugins available")
|
||||
|
||||
for plugin in self.plugins:
|
||||
# Check if the plugin was initialized
|
||||
logger.debug(1, 'Trying %s' % plugin.__class__)
|
||||
logger.debug('Trying %s' % plugin.__class__)
|
||||
if not hasattr(plugin, 'type') or not plugin.type:
|
||||
continue
|
||||
try:
|
||||
@@ -220,11 +220,11 @@ The format of the indexURI:
|
||||
indexEnt = plugin.load_index(indexURI, load)
|
||||
break
|
||||
except LayerIndexPluginUrlError as e:
|
||||
logger.debug(1, "%s doesn't support %s" % (plugin.type, e.url))
|
||||
logger.debug("%s doesn't support %s" % (plugin.type, e.url))
|
||||
except NotImplementedError:
|
||||
pass
|
||||
else:
|
||||
logger.debug(1, "No plugins support %s" % indexURI)
|
||||
logger.debug("No plugins support %s" % indexURI)
|
||||
raise LayerIndexException("No plugins support %s" % indexURI)
|
||||
|
||||
# Mark CONFIG data as something we've added...
|
||||
@@ -255,19 +255,19 @@ will write out the individual elements split by layer and related components.
|
||||
|
||||
for plugin in self.plugins:
|
||||
# Check if the plugin was initialized
|
||||
logger.debug(1, 'Trying %s' % plugin.__class__)
|
||||
logger.debug('Trying %s' % plugin.__class__)
|
||||
if not hasattr(plugin, 'type') or not plugin.type:
|
||||
continue
|
||||
try:
|
||||
plugin.store_index(indexURI, index)
|
||||
break
|
||||
except LayerIndexPluginUrlError as e:
|
||||
logger.debug(1, "%s doesn't support %s" % (plugin.type, e.url))
|
||||
logger.debug("%s doesn't support %s" % (plugin.type, e.url))
|
||||
except NotImplementedError:
|
||||
logger.debug(1, "Store not implemented in %s" % plugin.type)
|
||||
logger.debug("Store not implemented in %s" % plugin.type)
|
||||
pass
|
||||
else:
|
||||
logger.debug(1, "No plugins support %s" % indexURI)
|
||||
logger.debug("No plugins support %s" % indexURI)
|
||||
raise LayerIndexException("No plugins support %s" % indexURI)
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ layerBranches set. If not, they are effectively blank.'''
|
||||
the default configuration until the first vcs_url/branch match.'''
|
||||
|
||||
for index in self.indexes:
|
||||
logger.debug(1, ' searching %s' % index.config['DESCRIPTION'])
|
||||
logger.debug(' searching %s' % index.config['DESCRIPTION'])
|
||||
layerBranch = index.find_vcs_url(vcs_url, [branch])
|
||||
if layerBranch:
|
||||
return layerBranch
|
||||
@@ -304,7 +304,7 @@ layerBranches set. If not, they are effectively blank.'''
|
||||
If a branch has not been specified, we will iterate over the branches in
|
||||
the default configuration until the first collection/branch match.'''
|
||||
|
||||
logger.debug(1, 'find_collection: %s (%s) %s' % (collection, version, branch))
|
||||
logger.debug('find_collection: %s (%s) %s' % (collection, version, branch))
|
||||
|
||||
if branch:
|
||||
branches = [branch]
|
||||
@@ -312,12 +312,12 @@ layerBranches set. If not, they are effectively blank.'''
|
||||
branches = None
|
||||
|
||||
for index in self.indexes:
|
||||
logger.debug(1, ' searching %s' % index.config['DESCRIPTION'])
|
||||
logger.debug(' searching %s' % index.config['DESCRIPTION'])
|
||||
layerBranch = index.find_collection(collection, version, branches)
|
||||
if layerBranch:
|
||||
return layerBranch
|
||||
else:
|
||||
logger.debug(1, 'Collection %s (%s) not found for branch (%s)' % (collection, version, branch))
|
||||
logger.debug('Collection %s (%s) not found for branch (%s)' % (collection, version, branch))
|
||||
return None
|
||||
|
||||
def find_layerbranch(self, name, branch=None):
|
||||
@@ -408,7 +408,7 @@ layerBranches set. If not, they are effectively blank.'''
|
||||
version=deplayerbranch.version
|
||||
)
|
||||
if rdeplayerbranch != deplayerbranch:
|
||||
logger.debug(1, 'Replaced %s:%s:%s with %s:%s:%s' % \
|
||||
logger.debug('Replaced %s:%s:%s with %s:%s:%s' % \
|
||||
(deplayerbranch.index.config['DESCRIPTION'],
|
||||
deplayerbranch.branch.name,
|
||||
deplayerbranch.layer.name,
|
||||
@@ -1121,7 +1121,7 @@ class LayerBranch(LayerIndexItemObj):
|
||||
@property
|
||||
def branch(self):
|
||||
try:
|
||||
logger.debug(1, "Get branch object from branches[%s]" % (self.branch_id))
|
||||
logger.debug("Get branch object from branches[%s]" % (self.branch_id))
|
||||
return self.index.branches[self.branch_id]
|
||||
except KeyError:
|
||||
raise AttributeError('Unable to find branches in index to map branch_id %s' % self.branch_id)
|
||||
@@ -1149,7 +1149,7 @@ class LayerBranch(LayerIndexItemObj):
|
||||
|
||||
@actual_branch.setter
|
||||
def actual_branch(self, value):
|
||||
logger.debug(1, "Set actual_branch to %s .. name is %s" % (value, self.branch.name))
|
||||
logger.debug("Set actual_branch to %s .. name is %s" % (value, self.branch.name))
|
||||
if value != self.branch.name:
|
||||
self._setattr('actual_branch', value, prop=False)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user