]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/recipeutils: fix a few issues in find_layerdir()
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 13 Jul 2016 21:04:21 +0000 (09:04 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 20 Jul 2016 09:24:53 +0000 (10:24 +0100)
* Allow the function to be called with the base layer path (in which
  case it will just return the same path)
* Ensure that the function doesn't recurse indefinitely if it's called
  on a file that's not inside a layer
* Correct the doc comment for accuracy

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oe/recipeutils.py

index e3c4b8a759575f095ed942c03fb640ea1c1034ff..cb4ed53d0f194caf99d7e3f11fbab33583bb873f 100644 (file)
@@ -728,14 +728,16 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False,
 
 
 def find_layerdir(fn):
-    """ Figure out relative path to base of layer for a file (e.g. a recipe)"""
-    pth = os.path.dirname(fn)
+    """ Figure out the path to the base of the layer containing a file (e.g. a recipe)"""
+    pth = fn
     layerdir = ''
     while pth:
         if os.path.exists(os.path.join(pth, 'conf', 'layer.conf')):
             layerdir = pth
             break
         pth = os.path.dirname(pth)
+        if pth == '/':
+            return None
     return layerdir