summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/layerindexlib/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/layerindexlib/__init__.py')
-rw-r--r--bitbake/lib/layerindexlib/__init__.py72
1 files changed, 39 insertions, 33 deletions
diff --git a/bitbake/lib/layerindexlib/__init__.py b/bitbake/lib/layerindexlib/__init__.py
index 45157b6681..c3265ddaa1 100644
--- a/bitbake/lib/layerindexlib/__init__.py
+++ b/bitbake/lib/layerindexlib/__init__.py
@@ -6,7 +6,6 @@
import datetime
import logging
-import imp
import os
from collections import OrderedDict
@@ -94,7 +93,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 +122,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 +132,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 +169,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
@@ -179,9 +178,9 @@ class LayerIndex():
'''Load the layerindex.
indexURI - An index to load. (Use multiple calls to load multiple indexes)
-
+
reload - If reload is True, then any previously loaded indexes will be forgotten.
-
+
load - List of elements to load. Default loads all items.
Note: plugs may ignore this.
@@ -199,20 +198,20 @@ The format of the indexURI:
For example:
- http://layers.openembedded.org/layerindex/api/;branch=master;desc=OpenEmbedded%20Layer%20Index
+ https://layers.openembedded.org/layerindex/api/;branch=master;desc=OpenEmbedded%20Layer%20Index
cooker://
'''
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 +219,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 +254,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 +291,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 +303,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 +311,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):
@@ -384,7 +383,14 @@ layerBranches set. If not, they are effectively blank.'''
# Get a list of dependencies and then recursively process them
for layerdependency in layerbranch.index.layerDependencies_layerBranchId[layerbranch.id]:
- deplayerbranch = layerdependency.dependency_layerBranch
+ try:
+ deplayerbranch = layerdependency.dependency_layerBranch
+ except AttributeError as e:
+ logger.error('LayerBranch does not exist for dependent layer {}:{}\n' \
+ ' Cannot continue successfully.\n' \
+ ' You might be able to resolve this by checking out the layer locally.\n' \
+ ' Consider reaching out the to the layer maintainers or the layerindex admins' \
+ .format(layerdependency.dependency.name, layerbranch.branch.name))
if ignores and deplayerbranch.layer.name in ignores:
continue
@@ -408,7 +414,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,
@@ -577,7 +583,7 @@ This function is used to implement debugging and provide the user info.
# index['config'] - configuration data for this index
# index['branches'] - dictionary of Branch objects, by id number
# index['layerItems'] - dictionary of layerItem objects, by id number
-# ...etc... (See: http://layers.openembedded.org/layerindex/api/)
+# ...etc... (See: https://layers.openembedded.org/layerindex/api/)
#
# The class needs to manage the 'index' entries and allow easily adding
# of new items, as well as simply loading of the items.
@@ -847,7 +853,7 @@ class LayerIndexObj():
continue
for layerdependency in layerbranch.index.layerDependencies_layerBranchId[layerbranch.id]:
- deplayerbranch = layerdependency.dependency_layerBranch
+ deplayerbranch = layerdependency.dependency_layerBranch or None
if ignores and deplayerbranch.layer.name in ignores:
continue
@@ -1121,7 +1127,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 +1155,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:
@@ -1279,7 +1285,7 @@ class Recipe(LayerIndexItemObj_LayerBranch):
filename, filepath, pn, pv, layerbranch,
summary="", description="", section="", license="",
homepage="", bugtracker="", provides="", bbclassextend="",
- inherits="", blacklisted="", updated=None):
+ inherits="", disallowed="", updated=None):
self.id = id
self.filename = filename
self.filepath = filepath
@@ -1295,7 +1301,7 @@ class Recipe(LayerIndexItemObj_LayerBranch):
self.bbclassextend = bbclassextend
self.inherits = inherits
self.updated = updated or datetime.datetime.today().isoformat()
- self.blacklisted = blacklisted
+ self.disallowed = disallowed
if isinstance(layerbranch, LayerBranch):
self.layerbranch = layerbranch
else: