[oe-commits] Paul Eggleton : lib/oe/recipeutils: fix replace_dir_vars to return the correct variables

git at git.openembedded.org git at git.openembedded.org
Mon Jul 20 09:42:08 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 95c54512c9fcdbaa419891e46fd99102722ba3d8
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=95c54512c9fcdbaa419891e46fd99102722ba3d8

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Tue Jul 14 22:56:00 2015 +0100

lib/oe/recipeutils: fix replace_dir_vars to return the correct variables

If we sort by length of name here we get the variables we are interested
in first. I've tested this with all of the variables we care about (the
ones at the top of bitbake.conf) and it returns the right results.

This fixes the failures we've been seeing in the oe-selftest
test_recipetool_appendfile_* tests.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 meta/lib/oe/recipeutils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index bd812cc..78d6926 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -617,7 +617,8 @@ def find_layerdir(fn):
 def replace_dir_vars(path, d):
     """Replace common directory paths with appropriate variable references (e.g. /etc becomes ${sysconfdir})"""
     dirvars = {}
-    for var in d:
+    # Sort by length so we get the variables we're interested in first
+    for var in sorted(d.keys(), key=len):
         if var.endswith('dir') and var.lower() == var:
             value = d.getVar(var, True)
             if value.startswith('/') and not '\n' in value and value not in dirvars:



More information about the Openembedded-commits mailing list