Skip to contentSkip to conversation

update.py: fix splitting on _ when getting class inheritance

PATCH New Paul Eggleton 1 participant 1 message Nov 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update.py: fix splitting on _ when getting class inheritance

The code to populate the inherits information was using a function designed to get the recipe name from a file path, but unlike recipe filenames, the underscore isn't treated as special in class filenames and in fact it's quite common to use underscores there; we were ending up with items in the inherit list such as "populate" and "rootfs". Use the standard python os.path functions to do the splitting instead and avoid this.

---
 layerindex/update.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
layerindex/update.py +1 -1
index 1e96da6..7497743 100755
@@ -68,7 +68,7 @@ def update_recipe_file(data, path, recipe, layerdir_start, repodir):
         # Handle recipe inherits for this recipe
         gr = set(data.getVar("__inherit_cache", True) or [])
         lr = set(envdata.getVar("__inherit_cache", True) or [])
-        recipe.inherits = ' '.join(sorted({split_recipe_fn(r)[0] for r in lr if r not in gr}))
+        recipe.inherits = ' '.join(sorted({os.path.splitext(os.path.basename(r))[0] for r in lr if r not in gr}))
         recipe.save()
 
         # Get file dependencies within this layer
Signature · 1 line
2.1.0