diff options
-rw-r--r-- | bitbake/lib/toaster/toastergui/api.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index b4cdc335ef..a06ffc00dc 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py | |||
@@ -11,7 +11,7 @@ import os | |||
11 | import re | 11 | import re |
12 | import logging | 12 | import logging |
13 | import json | 13 | import json |
14 | import subprocess | 14 | import glob |
15 | from collections import Counter | 15 | from collections import Counter |
16 | 16 | ||
17 | from orm.models import Project, ProjectTarget, Build, Layer_Version | 17 | from orm.models import Project, ProjectTarget, Build, Layer_Version |
@@ -234,13 +234,11 @@ class XhrSetDefaultImageUrl(View): | |||
234 | 234 | ||
235 | def scan_layer_content(layer,layer_version): | 235 | def scan_layer_content(layer,layer_version): |
236 | # if this is a local layer directory, we can immediately scan its content | 236 | # if this is a local layer directory, we can immediately scan its content |
237 | if layer.local_source_dir: | 237 | if os.path.isdir(layer.local_source_dir): |
238 | try: | 238 | try: |
239 | # recipes-*/*/*.bb | 239 | # recipes-*/*/*.bb |
240 | cmd = '%s %s' % ('ls', os.path.join(layer.local_source_dir,'recipes-*/*/*.bb')) | 240 | recipes_list = glob.glob(os.path.join(layer.local_source_dir, 'recipes-*/*/*.bb')) |
241 | recipes_list = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read() | 241 | for recipe in recipes_list: |
242 | recipes_list = recipes_list.decode("utf-8").strip() | ||
243 | if recipes_list and 'No such' not in recipes_list: | ||
244 | for recipe in recipes_list.split('\n'): | 242 | for recipe in recipes_list.split('\n'): |
245 | recipe_path = recipe[recipe.rfind('recipes-'):] | 243 | recipe_path = recipe[recipe.rfind('recipes-'):] |
246 | recipe_name = recipe[recipe.rfind('/')+1:].replace('.bb','') | 244 | recipe_name = recipe[recipe.rfind('/')+1:].replace('.bb','') |
@@ -260,6 +258,9 @@ def scan_layer_content(layer,layer_version): | |||
260 | 258 | ||
261 | except Exception as e: | 259 | except Exception as e: |
262 | logger.warning("ERROR:scan_layer_content: %s" % e) | 260 | logger.warning("ERROR:scan_layer_content: %s" % e) |
261 | else: | ||
262 | logger.warning("ERROR: wrong path given") | ||
263 | raise KeyError("local_source_dir") | ||
263 | 264 | ||
264 | class XhrLayer(View): | 265 | class XhrLayer(View): |
265 | """ Delete, Get, Add and Update Layer information | 266 | """ Delete, Get, Add and Update Layer information |