diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2018-10-11 17:18:33 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-18 10:59:26 +0100 |
commit | b33c179aa978b6145c5c73c6ce545f9a68ffca28 (patch) | |
tree | 106e4a5392b52b0e6e9c84872aacdb8d6e1ee511 /bitbake/lib/layerindexlib/cooker.py | |
parent | 64fe513327837d0ac7603b76558c791db28c73f1 (diff) | |
download | poky-b33c179aa978b6145c5c73c6ce545f9a68ffca28.tar.gz |
bitbake: layerindexlib: Fix various type checking errors
In the list_obj function, we can't check if the requested object is 'in',
the index data -- as it's actually an attribute of the object. Move to hasattr.
The remaining items were incorrect usages of 'type' for class type comparison.
Instead move to 'isinstance'. Remaing 'type' comparisons are still valid. The
code was also reordered slightly to avoid a lot of:
if not isinstance(x, y):
...
else:
...
reordering it removes the not and makes the code slightly easier to read.
(Bitbake rev: cddea4282820ef10ad4863d87327891ea9383916)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/layerindexlib/cooker.py')
-rw-r--r-- | bitbake/lib/layerindexlib/cooker.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/bitbake/lib/layerindexlib/cooker.py b/bitbake/lib/layerindexlib/cooker.py index 248a597754..848f0e2ee2 100644 --- a/bitbake/lib/layerindexlib/cooker.py +++ b/bitbake/lib/layerindexlib/cooker.py | |||
@@ -136,10 +136,13 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): | |||
136 | layerrev = self._run_command('git rev-parse HEAD', layerpath, default="<unknown>") | 136 | layerrev = self._run_command('git rev-parse HEAD', layerpath, default="<unknown>") |
137 | 137 | ||
138 | for remotes in self._run_command('git remote -v', layerpath, default="").split("\n"): | 138 | for remotes in self._run_command('git remote -v', layerpath, default="").split("\n"): |
139 | remote = remotes.split("\t")[1].split(" ")[0] | 139 | if not remotes: |
140 | if "(fetch)" == remotes.split("\t")[1].split(" ")[1]: | 140 | layerurl = self._handle_git_remote(layerpath) |
141 | layerurl = self._handle_git_remote(remote) | 141 | else: |
142 | break | 142 | remote = remotes.split("\t")[1].split(" ")[0] |
143 | if "(fetch)" == remotes.split("\t")[1].split(" ")[1]: | ||
144 | layerurl = self._handle_git_remote(remote) | ||
145 | break | ||
143 | 146 | ||
144 | layerItemId += 1 | 147 | layerItemId += 1 |
145 | index.layerItems[layerItemId] = layerindexlib.LayerItem(index, None) | 148 | index.layerItems[layerItemId] = layerindexlib.LayerItem(index, None) |
@@ -297,7 +300,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): | |||
297 | 300 | ||
298 | for layerBranchId in index.layerBranches: | 301 | for layerBranchId in index.layerBranches: |
299 | # load_bblayers uses the description to cache the actual path... | 302 | # load_bblayers uses the description to cache the actual path... |
300 | machine_path = index.layerBranches[layerBranchId].getDescription() | 303 | machine_path = index.layerBranches[layerBranchId].layer.description |
301 | machine_path = os.path.join(machine_path, 'conf/machine') | 304 | machine_path = os.path.join(machine_path, 'conf/machine') |
302 | if os.path.isdir(machine_path): | 305 | if os.path.isdir(machine_path): |
303 | for (dirpath, _, filenames) in os.walk(machine_path): | 306 | for (dirpath, _, filenames) in os.walk(machine_path): |
@@ -310,7 +313,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): | |||
310 | machine = layerindexlib.Machine(index, None) | 313 | machine = layerindexlib.Machine(index, None) |
311 | machine.define_data(id=machineId, name=fname[:-5], | 314 | machine.define_data(id=machineId, name=fname[:-5], |
312 | description=fname[:-5], | 315 | description=fname[:-5], |
313 | layerbranch=collection_layerbranch[entry]) | 316 | layerbranch=index.layerBranches[layerBranchId]) |
314 | 317 | ||
315 | index.add_element("machines", [machine]) | 318 | index.add_element("machines", [machine]) |
316 | 319 | ||
@@ -321,7 +324,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): | |||
321 | 324 | ||
322 | for layerBranchId in index.layerBranches: | 325 | for layerBranchId in index.layerBranches: |
323 | # load_bblayers uses the description to cache the actual path... | 326 | # load_bblayers uses the description to cache the actual path... |
324 | distro_path = index.layerBranches[layerBranchId].getDescription() | 327 | distro_path = index.layerBranches[layerBranchId].layer.description |
325 | distro_path = os.path.join(distro_path, 'conf/distro') | 328 | distro_path = os.path.join(distro_path, 'conf/distro') |
326 | if os.path.isdir(distro_path): | 329 | if os.path.isdir(distro_path): |
327 | for (dirpath, _, filenames) in os.walk(distro_path): | 330 | for (dirpath, _, filenames) in os.walk(distro_path): |
@@ -334,7 +337,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin): | |||
334 | distro = layerindexlib.Distro(index, None) | 337 | distro = layerindexlib.Distro(index, None) |
335 | distro.define_data(id=distroId, name=fname[:-5], | 338 | distro.define_data(id=distroId, name=fname[:-5], |
336 | description=fname[:-5], | 339 | description=fname[:-5], |
337 | layerbranch=collection_layerbranch[entry]) | 340 | layerbranch=index.layerBranches[layerBranchId]) |
338 | 341 | ||
339 | index.add_element("distros", [distro]) | 342 | index.add_element("distros", [distro]) |
340 | 343 | ||