summaryrefslogtreecommitdiffstats
path: root/scripts/lib/image
diff options
context:
space:
mode:
authorJoão Henrique Ferreira de Freitas <joaohf@gmail.com>2014-05-14 22:37:27 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-05-21 09:09:02 +0100
commit8af57a6ca269203b79aacfa3048dc177df2cf6ac (patch)
treea53f926b7cf65529c3792335a133179246b708e6 /scripts/lib/image
parentac9707c501f5cd9e390854dc40589a9e755ffbd2 (diff)
downloadast2050-yocto-poky-8af57a6ca269203b79aacfa3048dc177df2cf6ac.zip
ast2050-yocto-poky-8af57a6ca269203b79aacfa3048dc177df2cf6ac.tar.gz
wic: add support to look in all layers and get .wks file
.wks file are looked in 'scripts/lib/image/canned-wks' directory on all BBLAYERS variable returned by bitbake environment. If found, it will be used. The user could create your own .wks and keep it inside its layers. For now the path must be <layer-dir>/scripts/lib/image/canned-wks. (From OE-Core rev: 1f3e312211f277a1befd707a59a0c0a9bf6cbcbc) Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/image')
-rw-r--r--scripts/lib/image/engine.py72
1 files changed, 43 insertions, 29 deletions
diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index 311737a..3bda1bf 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -90,6 +90,20 @@ def find_artifacts(image_name):
CANNED_IMAGE_DIR = "lib/image/canned-wks" # relative to scripts
+SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR
+
+def build_canned_image_list(dl):
+ layers_path = get_bitbake_var("BBLAYERS")
+ canned_wks_layer_dirs = []
+
+ for layer_path in layers_path.split():
+ path = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR)
+ canned_wks_layer_dirs.append(path)
+
+ path = os.path.join(dl, CANNED_IMAGE_DIR)
+ canned_wks_layer_dirs.append(path)
+
+ return canned_wks_layer_dirs
def find_canned_image(scripts_path, wks_file):
"""
@@ -97,15 +111,16 @@ def find_canned_image(scripts_path, wks_file):
Return False if not found
"""
- canned_wks_dir = os.path.join(scripts_path, CANNED_IMAGE_DIR)
-
- for root, dirs, files in os.walk(canned_wks_dir):
- for file in files:
- if file.endswith("~") or file.endswith("#"):
- continue
- if file.endswith(".wks") and wks_file + ".wks" == file:
- fullpath = os.path.join(canned_wks_dir, file)
- return fullpath
+ layers_canned_wks_dir = build_canned_image_list(scripts_path)
+
+ for canned_wks_dir in layers_canned_wks_dir:
+ for root, dirs, files in os.walk(canned_wks_dir):
+ for file in files:
+ if file.endswith("~") or file.endswith("#"):
+ continue
+ if file.endswith(".wks") and wks_file + ".wks" == file:
+ fullpath = os.path.join(canned_wks_dir, file)
+ return fullpath
return None
@@ -113,32 +128,31 @@ def list_canned_images(scripts_path):
"""
List the .wks files in the canned image dir, minus the extension.
"""
- canned_wks_dir = os.path.join(scripts_path, CANNED_IMAGE_DIR)
-
- for root, dirs, files in os.walk(canned_wks_dir):
- for file in files:
- if file.endswith("~") or file.endswith("#"):
- continue
- if file.endswith(".wks"):
- fullpath = os.path.join(canned_wks_dir, file)
- f = open(fullpath, "r")
- lines = f.readlines()
- for line in lines:
- desc = ""
- idx = line.find("short-description:")
- if idx != -1:
- desc = line[idx + len("short-description:"):].strip()
- break
- basename = os.path.splitext(file)[0]
- print " %s\t\t%s" % (basename, desc)
+ layers_canned_wks_dir = build_canned_image_list(scripts_path)
+
+ for canned_wks_dir in layers_canned_wks_dir:
+ for root, dirs, files in os.walk(canned_wks_dir):
+ for file in files:
+ if file.endswith("~") or file.endswith("#"):
+ continue
+ if file.endswith(".wks"):
+ fullpath = os.path.join(canned_wks_dir, file)
+ f = open(fullpath, "r")
+ lines = f.readlines()
+ for line in lines:
+ desc = ""
+ idx = line.find("short-description:")
+ if idx != -1:
+ desc = line[idx + len("short-description:"):].strip()
+ break
+ basename = os.path.splitext(file)[0]
+ print " %s\t\t%s" % (basename.ljust(30), desc)
def list_canned_image_help(scripts_path, fullpath):
"""
List the help and params in the specified canned image.
"""
- canned_wks_dir = os.path.join(scripts_path, CANNED_IMAGE_DIR)
-
f = open(fullpath, "r")
lines = f.readlines()
found = False
OpenPOWER on IntegriCloud