Patchwork [2/3] wic: add find_artifact() to get a specific bitbake variable

login
register
mail settings
Submitter João Henrique Freitas
Date April 5, 2014, 2:14 a.m.
Message ID <1396664051-11430-3-git-send-email-joaohf@gmail.com>
Download mbox | patch
Permalink /patch/70175/
State Accepted
Commit bc10da01f35ade81b68533ef5015a6def7c88d7c
Headers show

Comments

João Henrique Freitas - April 5, 2014, 2:14 a.m.
This helper is used by source plugins to get specific bitbake
variable.

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 scripts/lib/mic/utils/oe/misc.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch

diff --git a/scripts/lib/mic/utils/oe/misc.py b/scripts/lib/mic/utils/oe/misc.py
index 5436a0a..16c250a 100644
--- a/scripts/lib/mic/utils/oe/misc.py
+++ b/scripts/lib/mic/utils/oe/misc.py
@@ -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