wic: add find_artifact() to get a specific bitbake variable
authorJoão Henrique Ferreira de Freitas <joaohf@gmail.com>
Sat, 5 Apr 2014 02:14:10 +0000 (23:14 -0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 13 May 2014 18:35:11 +0000 (19:35 +0100)
This helper is used by source plugins to get specific bitbake
variable.

(From OE-Core rev: b8e51f73bc8e67ca60b7dd8d67091257aad62efd)

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/mic/utils/oe/misc.py

index 5436a0a..16c250a 100644 (file)
@@ -142,6 +142,20 @@ def find_bitbake_env_lines(image_name):
 
     return bitbake_env_lines
 
+def find_artifact(bitbake_env_lines, variable):
+    """
+    Gather the build artifact for the current image (the image_name
+    e.g. core-image-minimal) for the current MACHINE set in local.conf
+    """
+    retval = ""
+
+    for line in bitbake_env_lines.split('\n'):
+        if (get_line_val(line, variable)):
+            retval = get_line_val(line, variable)
+            break
+
+    return retval
+
 def get_line_val(line, key):
     """
     Extract the value from the VAR="val" string