Skip to contentSkip to conversation

wic/engine: Add files/wic to the search path

PATCH New Richard Purdie 1 participant 2 messages Apr 5

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 wic/engine: Add files/wic to the search path

Going forward, "files/wic" is the logical place for layers to place wic files to fit in with usual layer file layouts. Add this to the search path.

---
 src/wic/engine.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/wic/engine.py +2 -1
index e12eee8..3612017 100644
@@ -46,6 +46,7 @@ def verify_build_env():
 CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts
 SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR
 WIC_DIR = "wic"
+WIC_FILES_DIR = "files/wic"
 
 def build_canned_image_list(path):
     layers_path = get_bitbake_var("BBLAYERS")
@@ -53,7 +54,7 @@ def build_canned_image_list(path):
 
     if layers_path is not None:
         for layer_path in layers_path.split():
-            for wks_path in (WIC_DIR, SCRIPTS_CANNED_IMAGE_DIR):
+            for wks_path in (WIC_FILES_DIR, WIC_DIR, SCRIPTS_CANNED_IMAGE_DIR):
                 cpath = os.path.join(layer_path, wks_path)
                 if os.path.isdir(cpath):
                     canned_wks_layer_dirs.append(cpath)
#1 lore raw

PATCH 2/2 wic/engine: Simplify search paths

Drop "wic" and "scripts/lib/wic/canned-wks" as search paths and just use "files/wic" as the default location for files. Also use BBPATH, not BBLAYERS, which aligns with the search paths in OE-Core's classes by default.

---
 src/wic/engine.py | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
src/wic/engine.py +5 -15
index 3612017..dcc3527 100644
@@ -43,24 +43,14 @@ def verify_build_env():
     return True
 
 
-CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts
-SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR
-WIC_DIR = "wic"
-WIC_FILES_DIR = "files/wic"
-
 def build_canned_image_list(path):
-    layers_path = get_bitbake_var("BBLAYERS")
+    bbpath = (get_bitbake_var("BBPATH") or "").split(":")
     canned_wks_layer_dirs = []
 
-    if layers_path is not None:
-        for layer_path in layers_path.split():
-            for wks_path in (WIC_FILES_DIR, WIC_DIR, SCRIPTS_CANNED_IMAGE_DIR):
-                cpath = os.path.join(layer_path, wks_path)
-                if os.path.isdir(cpath):
-                    canned_wks_layer_dirs.append(cpath)
-
-    cpath = os.path.join(path, CANNED_IMAGE_DIR)
-    canned_wks_layer_dirs.append(cpath)
+    for layer_path in bbpath:
+        cpath = os.path.join(layer_path, 'files', 'wic')
+        if os.path.isdir(cpath):
+            canned_wks_layer_dirs.append(cpath)
 
     return canned_wks_layer_dirs