From effd76af7d79346f85227972584f43a8e346f8a3 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 3 Sep 2019 16:07:58 +1200 Subject: [PATCH] recipeparse: handle recipes at root of repository You'd think this is very unlikely to happen, but back in meta-openembedded commit 415e213ad75ec9a93171c963395a1c4b92c6233b and the commits preceding it, a recipe was added to the root of the repository and then moved into place, and os.path.relpath() does not like to be called with a blank path and thus raises an exception. To avoid the exception, get the relative path to the filename and then chop that off instead of the other way around. Signed-off-by: Paul Eggleton --- layerindex/recipeparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layerindex/recipeparse.py b/layerindex/recipeparse.py index 3990091..6748116 100644 --- a/layerindex/recipeparse.py +++ b/layerindex/recipeparse.py @@ -146,7 +146,7 @@ def detect_file_type(path, subdir_start): if typename in ['recipe', 'bbappend', 'incfile']: if subdir_start: - filepath = os.path.relpath(os.path.dirname(path), subdir_start) + filepath = os.path.dirname(os.path.relpath(path, subdir_start)) else: filepath = os.path.dirname(path) return (typename, filepath, os.path.basename(path))