summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2018-07-06 11:09:37 +0800
committerRobert Yang <liezhi.yang@windriver.com>2018-07-09 12:06:31 +0800
commita02cf1b6d04658216eadffc817a651dc47fcfbfb (patch)
treef1a91610c448d050e34e609594fdbf43664d61bc
parent5cfdfdca8b9200b5a6e4aa14661b14059a799310 (diff)
downloadopenembedded-core-contrib-a02cf1b6d04658216eadffc817a651dc47fcfbfb.tar.gz
openembedded-core-contrib-a02cf1b6d04658216eadffc817a651dc47fcfbfb.tar.bz2
openembedded-core-contrib-a02cf1b6d04658216eadffc817a651dc47fcfbfb.zip
update_layer.py: avoid calling setup_core_layer_sys_path() when --initial
Fixed: $ update.py -b <new_branch> [snip] NOTE: Starting bitbake server... Traceback (most recent call last): File "update_layer.py", line 471, in main utils.setup_core_layer_sys_path(settings, branch.name) File "/buildarea1/lyang1/layerindex-web/layerindex/utils.py", line 376, in setup_core_layer_sys_path core_layerdir = os.path.join(core_repodir, core_layerbranch.vcs_subdir) AttributeError: 'NoneType' object has no attribute 'vcs_subdir' [snip] This is because core_layerbranch is not in database yet for completely new branch, so it is None and we will get the error. Avoid calling setup_core_layer_sys_path() when "update_layer.py --initial" will fix the problem. And also only add core layer's sys path when it is present, since core layer may not be added yet for completely new branch. Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-rw-r--r--layerindex/update_layer.py19
-rw-r--r--layerindex/utils.py9
2 files changed, 15 insertions, 13 deletions
diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index bbfaba9ac3..81b730a80a 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -426,15 +426,6 @@ def main():
# why won't they just fix that?!)
tinfoil.config_data.setVar('LICENSE', '')
- # Set up for recording patch info
- utils.setup_core_layer_sys_path(settings, branch.name)
- skip_patches = False
- try:
- import oe.recipeutils
- except ImportError:
- logger.warn('Failed to find lib/oe/recipeutils.py in layers - patch information will not be collected')
- skip_patches = True
-
layerconfparser = layerconfparse.LayerConfParse(logger=logger, tinfoil=tinfoil)
layer_config_data = layerconfparser.parse_layer(layerdir)
if not layer_config_data:
@@ -447,6 +438,16 @@ def main():
for i in ["BBFILE_COLLECTIONS", "LAYERVERSION", "LAYERDEPENDS", "LAYERRECOMMENDS"]:
print('%s = "%s"' % (i, utils.get_layer_var(layer_config_data, i, logger)))
sys.exit(0)
+
+ # Set up for recording patch info
+ utils.setup_core_layer_sys_path(settings, branch.name)
+ skip_patches = False
+ try:
+ import oe.recipeutils
+ except ImportError:
+ logger.warn('Failed to find lib/oe/recipeutils.py in layers - patch information will not be collected')
+ skip_patches = True
+
utils.add_dependencies(layerbranch, layer_config_data, logger=logger)
utils.add_recommends(layerbranch, layer_config_data, logger=logger)
layerbranch.save()
diff --git a/layerindex/utils.py b/layerindex/utils.py
index f8c5fd4560..c30038da26 100644
--- a/layerindex/utils.py
+++ b/layerindex/utils.py
@@ -371,10 +371,11 @@ def setup_core_layer_sys_path(settings, branchname):
"""
core_layer = get_layer(settings.CORE_LAYER_NAME)
core_layerbranch = core_layer.get_layerbranch(branchname)
- core_urldir = core_layer.get_fetch_dir()
- core_repodir = os.path.join(settings.LAYER_FETCH_DIR, core_urldir)
- core_layerdir = os.path.join(core_repodir, core_layerbranch.vcs_subdir)
- sys.path.insert(0, os.path.join(core_layerdir, 'lib'))
+ if core_layerbranch:
+ core_urldir = core_layer.get_fetch_dir()
+ core_repodir = os.path.join(settings.LAYER_FETCH_DIR, core_urldir)
+ core_layerdir = os.path.join(core_repodir, core_layerbranch.vcs_subdir)
+ sys.path.insert(0, os.path.join(core_layerdir, 'lib'))
def run_command_interruptible(cmd):
"""