@@ -21,7 +21,7 @@ import glob
import bb.tinfoil
from collections import OrderedDict, defaultdict
-from bb.utils import vercmp_string
+from bb.utils import vercmp_string, get_collection_res
# Help us to find places to insert values
recipe_progression = ['SUMMARY', 'DESCRIPTION', 'AUTHOR', 'HOMEPAGE', 'BUGTRACKER', 'SECTION', 'LICENSE', 'LICENSE_FLAGS', 'LIC_FILES_CHKSUM', 'PROVIDES', 'DEPENDS', 'PR', 'PV', 'SRCREV', 'SRCPV', 'SRC_URI', 'S', 'do_fetch()', 'do_unpack()', 'do_patch()', 'EXTRA_OECONF', 'EXTRA_OECMAKE', 'EXTRA_OESCONS', 'do_configure()', 'EXTRA_OEMAKE', 'do_compile()', 'do_install()', 'do_populate_sysroot()', 'INITSCRIPT', 'USERADD', 'GROUPADD', 'PACKAGES', 'FILES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RPROVIDES', 'RREPLACES', 'RCONFLICTS', 'ALLOW_EMPTY', 'populate_packages()', 'do_package()', 'do_deploy()', 'BBCLASSEXTEND']
@@ -928,6 +928,14 @@ def find_layerdir(fn):
return None
return layerdir
+def get_layer_name(fn, d):
+ """ Get the layer name from a filename """
+ pth = os.path.abspath(fn)
+ collection = get_collection_res(d)
+ for k, v in dict(sorted(collection.items(), key=lambda item: item[1], reverse=True)).items():
+ if re.match(v, pth):
+ return k
+ return ""
def replace_dir_vars(path, d):
"""Replace common directory paths with appropriate variable references (e.g. /etc becomes ${sysconfdir})"""
so one can get the layer name from a filepath Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> --- meta/lib/oe/recipeutils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)