get_current_recipe_layer returns the recipe layer given its
file path.

Signed-off-by: Davide Gardenal <[email protected]>
---
 meta/lib/oe/utils.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 46fc76c261..4e17b1b40e 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -584,3 +584,11 @@ def directory_size(root, blocksize=4096):
         total += sum(roundup(getsize(os.path.join(root, name))) for name in 
files)
         total += roundup(getsize(root))
     return total
+
+def get_current_recipe_layer(d):
+    """
+    Extract the recipe layer from it's path.
+    Returns the layer name.
+    """
+    fdir_name  = d.getVar("FILE_DIRNAME")
+    return fdir_name.split("/")[-3]
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#167341): 
https://lists.openembedded.org/g/openembedded-core/message/167341
Mute This Topic: https://lists.openembedded.org/mt/92043904/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to