summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/layerindexlib
diff options
context:
space:
mode:
authorFrazer Clews <frazerleslieclews@gmail.com>2020-08-24 15:51:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-25 18:14:53 +0100
commitabc6f864b9c6fa9a47a218a8250e79dcfa367d4d (patch)
treee4dfa762398e1b2a8ae019e0039417be3e85d99c /bitbake/lib/layerindexlib
parentac3593f6ed8f2ffb0bb62df47220b598cc1781f6 (diff)
downloadpoky-abc6f864b9c6fa9a47a218a8250e79dcfa367d4d.tar.gz
bitbake: lib: fix most undefined code picked up by pylint
Correctly import, and inherit functions, and variables. Also fix some typos and remove some Python 2 code that isn't recognised. (Bitbake rev: b0c807be5c2170c9481c1a04d4c11972135d7dc5) Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/layerindexlib')
-rw-r--r--bitbake/lib/layerindexlib/__init__.py15
-rw-r--r--bitbake/lib/layerindexlib/cooker.py7
-rw-r--r--bitbake/lib/layerindexlib/restapi.py6
-rw-r--r--bitbake/lib/layerindexlib/tests/restapi.py2
4 files changed, 18 insertions, 12 deletions
diff --git a/bitbake/lib/layerindexlib/__init__.py b/bitbake/lib/layerindexlib/__init__.py
index 77196b408f..45157b6681 100644
--- a/bitbake/lib/layerindexlib/__init__.py
+++ b/bitbake/lib/layerindexlib/__init__.py
@@ -7,6 +7,7 @@ import datetime
7 7
8import logging 8import logging
9import imp 9import imp
10import os
10 11
11from collections import OrderedDict 12from collections import OrderedDict
12from layerindexlib.plugin import LayerIndexPluginUrlError 13from layerindexlib.plugin import LayerIndexPluginUrlError
@@ -70,7 +71,7 @@ class LayerIndex():
70 71
71 if self.__class__ != newIndex.__class__ or \ 72 if self.__class__ != newIndex.__class__ or \
72 other.__class__ != newIndex.__class__: 73 other.__class__ != newIndex.__class__:
73 raise TypeException("Can not add different types.") 74 raise TypeError("Can not add different types.")
74 75
75 for indexEnt in self.indexes: 76 for indexEnt in self.indexes:
76 newIndex.indexes.append(indexEnt) 77 newIndex.indexes.append(indexEnt)
@@ -266,8 +267,8 @@ will write out the individual elements split by layer and related components.
266 logger.debug(1, "Store not implemented in %s" % plugin.type) 267 logger.debug(1, "Store not implemented in %s" % plugin.type)
267 pass 268 pass
268 else: 269 else:
269 logger.debug(1, "No plugins support %s" % url) 270 logger.debug(1, "No plugins support %s" % indexURI)
270 raise LayerIndexException("No plugins support %s" % url) 271 raise LayerIndexException("No plugins support %s" % indexURI)
271 272
272 273
273 def is_empty(self): 274 def is_empty(self):
@@ -657,7 +658,7 @@ class LayerIndexObj():
657 if obj.id in self._index[indexname]: 658 if obj.id in self._index[indexname]:
658 if self._index[indexname][obj.id] == obj: 659 if self._index[indexname][obj.id] == obj:
659 continue 660 continue
660 raise LayerIndexError('Conflict adding object %s(%s) to index' % (indexname, obj.id)) 661 raise LayerIndexException('Conflict adding object %s(%s) to index' % (indexname, obj.id))
661 self._index[indexname][obj.id] = obj 662 self._index[indexname][obj.id] = obj
662 663
663 def add_raw_element(self, indexname, objtype, rawobjs): 664 def add_raw_element(self, indexname, objtype, rawobjs):
@@ -842,11 +843,11 @@ class LayerIndexObj():
842 843
843 def _resolve_dependencies(layerbranches, ignores, dependencies, invalid): 844 def _resolve_dependencies(layerbranches, ignores, dependencies, invalid):
844 for layerbranch in layerbranches: 845 for layerbranch in layerbranches:
845 if ignores and layerBranch.layer.name in ignores: 846 if ignores and layerbranch.layer.name in ignores:
846 continue 847 continue
847 848
848 for layerdependency in layerbranch.index.layerDependencies_layerBranchId[layerBranch.id]: 849 for layerdependency in layerbranch.index.layerDependencies_layerBranchId[layerbranch.id]:
849 deplayerbranch = layerDependency.dependency_layerBranch 850 deplayerbranch = layerdependency.dependency_layerBranch
850 851
851 if ignores and deplayerbranch.layer.name in ignores: 852 if ignores and deplayerbranch.layer.name in ignores:
852 continue 853 continue
diff --git a/bitbake/lib/layerindexlib/cooker.py b/bitbake/lib/layerindexlib/cooker.py
index 65b23d087f..21ec438a22 100644
--- a/bitbake/lib/layerindexlib/cooker.py
+++ b/bitbake/lib/layerindexlib/cooker.py
@@ -4,6 +4,7 @@
4# 4#
5 5
6import logging 6import logging
7import os
7 8
8from collections import defaultdict 9from collections import defaultdict
9 10
@@ -73,7 +74,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
73 d = self.layerindex.data 74 d = self.layerindex.data
74 75
75 if not branches: 76 if not branches:
76 raise LayerIndexFetchError("No branches specified for _load_bblayers!") 77 raise layerindexlib.LayerIndexFetchError("No branches specified for _load_bblayers!")
77 78
78 index = layerindexlib.LayerIndexObj() 79 index = layerindexlib.LayerIndexObj()
79 80
@@ -202,7 +203,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
202 try: 203 try:
203 depDict = bb.utils.explode_dep_versions2(deps) 204 depDict = bb.utils.explode_dep_versions2(deps)
204 except bb.utils.VersionStringException as vse: 205 except bb.utils.VersionStringException as vse:
205 bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (c, str(vse))) 206 bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (collection, str(vse)))
206 207
207 for dep, oplist in list(depDict.items()): 208 for dep, oplist in list(depDict.items()):
208 # We need to search ourselves, so use the _ version... 209 # We need to search ourselves, so use the _ version...
@@ -268,7 +269,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
268 269
269 layer = bb.utils.get_file_layer(realfn[0], self.config_data) 270 layer = bb.utils.get_file_layer(realfn[0], self.config_data)
270 271
271 depBranchId = collection_layerbranch[layer] 272 depBranchId = collection[layer]
272 273
273 recipeId += 1 274 recipeId += 1
274 recipe = layerindexlib.Recipe(index, None) 275 recipe = layerindexlib.Recipe(index, None)
diff --git a/bitbake/lib/layerindexlib/restapi.py b/bitbake/lib/layerindexlib/restapi.py
index 21fd144143..7023f42f20 100644
--- a/bitbake/lib/layerindexlib/restapi.py
+++ b/bitbake/lib/layerindexlib/restapi.py
@@ -5,9 +5,13 @@
5 5
6import logging 6import logging
7import json 7import json
8import os
9
8from urllib.parse import unquote 10from urllib.parse import unquote
9from urllib.parse import urlparse 11from urllib.parse import urlparse
10 12
13import bb
14
11import layerindexlib 15import layerindexlib
12import layerindexlib.plugin 16import layerindexlib.plugin
13 17
@@ -163,7 +167,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
163 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)
164 logger.debug(1, "%s: retry successful.") 168 logger.debug(1, "%s: retry successful.")
165 else: 169 else:
166 raise 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)
167 171
168 return parsed 172 return parsed
169 173
diff --git a/bitbake/lib/layerindexlib/tests/restapi.py b/bitbake/lib/layerindexlib/tests/restapi.py
index e5ccafe5c9..4646d01f9f 100644
--- a/bitbake/lib/layerindexlib/tests/restapi.py
+++ b/bitbake/lib/layerindexlib/tests/restapi.py
@@ -112,7 +112,7 @@ class LayerIndexWebRestApiTest(LayersTest):
112 break 112 break
113 else: 113 else:
114 self.logger.debug(1, "meta-python was not found") 114 self.logger.debug(1, "meta-python was not found")
115 self.assetTrue(False) 115 raise self.failureException
116 116
117 # Only check the first element... 117 # Only check the first element...
118 break 118 break