diff options
Diffstat (limited to 'poky/bitbake/lib/layerindexlib')
-rw-r--r-- | poky/bitbake/lib/layerindexlib/__init__.py | 48 | ||||
-rw-r--r-- | poky/bitbake/lib/layerindexlib/cooker.py | 4 | ||||
-rw-r--r-- | poky/bitbake/lib/layerindexlib/restapi.py | 32 | ||||
-rw-r--r-- | poky/bitbake/lib/layerindexlib/tests/cooker.py | 4 | ||||
-rw-r--r-- | poky/bitbake/lib/layerindexlib/tests/restapi.py | 18 |
5 files changed, 53 insertions, 53 deletions
diff --git a/poky/bitbake/lib/layerindexlib/__init__.py b/poky/bitbake/lib/layerindexlib/__init__.py index 45157b6681..9ca127b9df 100644 --- a/poky/bitbake/lib/layerindexlib/__init__.py +++ b/poky/bitbake/lib/layerindexlib/__init__.py @@ -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: diff --git a/poky/bitbake/lib/layerindexlib/cooker.py b/poky/bitbake/lib/layerindexlib/cooker.py index 21ec438a22..2de6e5faa0 100644 --- a/poky/bitbake/lib/layerindexlib/cooker.py +++ b/poky/bitbake/lib/layerindexlib/cooker.py @@ -173,7 +173,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): else: branches = ['HEAD'] - logger.debug(1, "Loading cooker data branches %s" % branches) + logger.debug("Loading cooker data branches %s" % branches) index = self._load_bblayers(branches=branches) @@ -220,7 +220,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): required=required, layerbranch=layerBranchId, dependency=depLayerBranch.layer_id) - logger.debug(1, '%s requires %s' % (layerDependency.layer.name, layerDependency.dependency.name)) + logger.debug('%s requires %s' % (layerDependency.layer.name, layerDependency.dependency.name)) index.add_element("layerDependencies", [layerDependency]) return layerDependencyId diff --git a/poky/bitbake/lib/layerindexlib/restapi.py b/poky/bitbake/lib/layerindexlib/restapi.py index 7023f42f20..26a1c9674e 100644 --- a/poky/bitbake/lib/layerindexlib/restapi.py +++ b/poky/bitbake/lib/layerindexlib/restapi.py @@ -82,7 +82,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): def load_cache(path, index, branches=[]): - logger.debug(1, 'Loading json file %s' % path) + logger.debug('Loading json file %s' % path) with open(path, 'rt', encoding='utf-8') as f: pindex = json.load(f) @@ -102,7 +102,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): if newpBranch: index.add_raw_element('branches', layerindexlib.Branch, newpBranch) else: - logger.debug(1, 'No matching branches (%s) in index file(s)' % branches) + logger.debug('No matching branches (%s) in index file(s)' % branches) # No matching branches.. return nothing... return @@ -120,7 +120,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): load_cache(up.path, index, branches) return index - logger.debug(1, 'Loading from dir %s...' % (up.path)) + logger.debug('Loading from dir %s...' % (up.path)) for (dirpath, _, filenames) in os.walk(up.path): for filename in filenames: if not filename.endswith('.json'): @@ -144,7 +144,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): def _get_json_response(apiurl=None, username=None, password=None, retry=True): assert apiurl is not None - logger.debug(1, "fetching %s" % apiurl) + logger.debug("fetching %s" % apiurl) up = urlparse(apiurl) @@ -163,9 +163,9 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): parsed = json.loads(res.read().decode('utf-8')) except ConnectionResetError: if retry: - logger.debug(1, "%s: Connection reset by peer. Retrying..." % url) + logger.debug("%s: Connection reset by peer. Retrying..." % url) parsed = _get_json_response(apiurl=up_stripped.geturl(), username=username, password=password, retry=False) - logger.debug(1, "%s: retry successful.") + logger.debug("%s: retry successful.") else: raise layerindexlib.LayerIndexFetchError('%s: Connection reset by peer. Is there a firewall blocking your connection?' % apiurl) @@ -207,25 +207,25 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): if "*" not in branches: filter = "?filter=name:%s" % "OR".join(branches) - logger.debug(1, "Loading %s from %s" % (branches, index.apilinks['branches'])) + logger.debug("Loading %s from %s" % (branches, index.apilinks['branches'])) # The link won't include username/password, so pull it from the original url pindex['branches'] = _get_json_response(index.apilinks['branches'] + filter, username=up.username, password=up.password) if not pindex['branches']: - logger.debug(1, "No valid branches (%s) found at url %s." % (branch, url)) + logger.debug("No valid branches (%s) found at url %s." % (branch, url)) return index index.add_raw_element("branches", layerindexlib.Branch, pindex['branches']) # Load all of the layerItems (these can not be easily filtered) - logger.debug(1, "Loading %s from %s" % ('layerItems', index.apilinks['layerItems'])) + logger.debug("Loading %s from %s" % ('layerItems', index.apilinks['layerItems'])) # The link won't include username/password, so pull it from the original url pindex['layerItems'] = _get_json_response(index.apilinks['layerItems'], username=up.username, password=up.password) if not pindex['layerItems']: - logger.debug(1, "No layers were found at url %s." % (url)) + logger.debug("No layers were found at url %s." % (url)) return index index.add_raw_element("layerItems", layerindexlib.LayerItem, pindex['layerItems']) @@ -235,13 +235,13 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): for branch in index.branches: filter = "?filter=branch__name:%s" % index.branches[branch].name - logger.debug(1, "Loading %s from %s" % ('layerBranches', index.apilinks['layerBranches'])) + logger.debug("Loading %s from %s" % ('layerBranches', index.apilinks['layerBranches'])) # The link won't include username/password, so pull it from the original url pindex['layerBranches'] = _get_json_response(index.apilinks['layerBranches'] + filter, username=up.username, password=up.password) if not pindex['layerBranches']: - logger.debug(1, "No valid layer branches (%s) found at url %s." % (branches or "*", url)) + logger.debug("No valid layer branches (%s) found at url %s." % (branches or "*", url)) return index index.add_raw_element("layerBranches", layerindexlib.LayerBranch, pindex['layerBranches']) @@ -256,7 +256,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): ("distros", layerindexlib.Distro)]: if lName not in load: continue - logger.debug(1, "Loading %s from %s" % (lName, index.apilinks[lName])) + logger.debug("Loading %s from %s" % (lName, index.apilinks[lName])) # The link won't include username/password, so pull it from the original url pindex[lName] = _get_json_response(index.apilinks[lName] + filter, @@ -283,7 +283,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): if up.scheme != 'file': raise layerindexlib.plugin.LayerIndexPluginUrlError(self.type, url) - logger.debug(1, "Storing to %s..." % up.path) + logger.debug("Storing to %s..." % up.path) try: layerbranches = index.layerBranches @@ -299,12 +299,12 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin): if getattr(index, objects)[obj].layerbranch_id == layerbranchid: filtered.append(getattr(index, objects)[obj]._data) except AttributeError: - logger.debug(1, 'No obj.layerbranch_id: %s' % objects) + logger.debug('No obj.layerbranch_id: %s' % objects) # No simple filter method, just include it... try: filtered.append(getattr(index, objects)[obj]._data) except AttributeError: - logger.debug(1, 'No obj._data: %s %s' % (objects, type(obj))) + logger.debug('No obj._data: %s %s' % (objects, type(obj))) filtered.append(obj) return filtered diff --git a/poky/bitbake/lib/layerindexlib/tests/cooker.py b/poky/bitbake/lib/layerindexlib/tests/cooker.py index 1d0685e099..5ddf89aa21 100644 --- a/poky/bitbake/lib/layerindexlib/tests/cooker.py +++ b/poky/bitbake/lib/layerindexlib/tests/cooker.py @@ -72,7 +72,7 @@ class LayerIndexCookerTest(LayersTest): def test_find_collection(self): def _check(collection, expected): - self.logger.debug(1, "Looking for collection %s..." % collection) + self.logger.debug("Looking for collection %s..." % collection) result = self.layerindex.find_collection(collection) if expected: self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection) @@ -91,7 +91,7 @@ class LayerIndexCookerTest(LayersTest): def test_find_layerbranch(self): def _check(name, expected): - self.logger.debug(1, "Looking for layerbranch %s..." % name) + self.logger.debug("Looking for layerbranch %s..." % name) result = self.layerindex.find_layerbranch(name) if expected: self.assertIsNotNone(result, msg="Did not find %s when it shouldn't be there" % collection) diff --git a/poky/bitbake/lib/layerindexlib/tests/restapi.py b/poky/bitbake/lib/layerindexlib/tests/restapi.py index 4646d01f9f..33b5c1c4c8 100644 --- a/poky/bitbake/lib/layerindexlib/tests/restapi.py +++ b/poky/bitbake/lib/layerindexlib/tests/restapi.py @@ -57,11 +57,11 @@ class LayerIndexWebRestApiTest(LayersTest): type in self.layerindex.indexes[0].config['local']: continue for id in getattr(self.layerindex.indexes[0], type): - self.logger.debug(1, "type %s" % (type)) + self.logger.debug("type %s" % (type)) self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number not in reloaded index") - self.logger.debug(1, "%s ? %s" % (getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id])) + self.logger.debug("%s ? %s" % (getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id])) self.assertEqual(getattr(self.layerindex.indexes[0], type)[id], getattr(reload.indexes[0], type)[id], msg="Reloaded contents different") @@ -80,11 +80,11 @@ class LayerIndexWebRestApiTest(LayersTest): type in self.layerindex.indexes[0].config['local']: continue for id in getattr(self.layerindex.indexes[0] ,type): - self.logger.debug(1, "type %s" % (type)) + self.logger.debug("type %s" % (type)) self.assertTrue(id in getattr(reload.indexes[0], type), msg="Id number missing from reloaded data") - self.logger.debug(1, "%s ? %s" % (getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id])) + self.logger.debug("%s ? %s" % (getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id])) self.assertEqual(getattr(self.layerindex.indexes[0] ,type)[id], getattr(reload.indexes[0], type)[id], msg="reloaded data does not match original") @@ -111,14 +111,14 @@ class LayerIndexWebRestApiTest(LayersTest): if dep.layer.name == 'meta-python': break else: - self.logger.debug(1, "meta-python was not found") + self.logger.debug("meta-python was not found") raise self.failureException # Only check the first element... break else: # Empty list, this is bad. - self.logger.debug(1, "Empty list of dependencies") + self.logger.debug("Empty list of dependencies") self.assertIsNotNone(first, msg="Empty list of dependencies") # Last dep should be the requested item @@ -128,7 +128,7 @@ class LayerIndexWebRestApiTest(LayersTest): @skipIfNoNetwork() def test_find_collection(self): def _check(collection, expected): - self.logger.debug(1, "Looking for collection %s..." % collection) + self.logger.debug("Looking for collection %s..." % collection) result = self.layerindex.find_collection(collection) if expected: self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection) @@ -148,11 +148,11 @@ class LayerIndexWebRestApiTest(LayersTest): @skipIfNoNetwork() def test_find_layerbranch(self): def _check(name, expected): - self.logger.debug(1, "Looking for layerbranch %s..." % name) + self.logger.debug("Looking for layerbranch %s..." % name) for index in self.layerindex.indexes: for layerbranchid in index.layerBranches: - self.logger.debug(1, "Present: %s" % index.layerBranches[layerbranchid].layer.name) + self.logger.debug("Present: %s" % index.layerBranches[layerbranchid].layer.name) result = self.layerindex.find_layerbranch(name) if expected: self.assertIsNotNone(result, msg="Did not find %s when it should be there" % collection) |