[OE-core] [wic][PATCH] wic: extended list of paths in find_binary_path

Ed Bartosh ed.bartosh at linux.intel.com
Sat Apr 4 17:20:28 UTC 2015


wic requires tools that are not always possible to find in $PATH.
This causes wic to fail with confusing errors like this:
 External command 'parted' not found, exiting.
   (Please install 'parted' on your host system)

Adding ~/bin/, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin,
/sbin and /bin to the list of paths makes find_binary_path to
produce more reliable results.

[YOCTO #7122]

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 scripts/lib/wic/utils/fs_related.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/lib/wic/utils/fs_related.py b/scripts/lib/wic/utils/fs_related.py
index ea9f85c..832a44a 100644
--- a/scripts/lib/wic/utils/fs_related.py
+++ b/scripts/lib/wic/utils/fs_related.py
@@ -32,13 +32,16 @@ from wic.utils.errors import *
 from wic.utils.oe.misc import *
 
 def find_binary_path(binary):
+    paths = []
     if os.environ.has_key("PATH"):
         paths = os.environ["PATH"].split(":")
-    else:
-        paths = []
-        if os.environ.has_key("HOME"):
-            paths += [os.environ["HOME"] + "/bin"]
-        paths += ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"]
+    if os.environ.has_key("HOME"):
+        path = os.path.join(os.environ["HOME"], "bin")
+        if path not in paths:
+            paths.append(path)
+    for path in ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"]:
+        if path not in paths:
+            paths.append(path)
 
     for path in paths:
         bin_path = "%s/%s" % (path, binary)
-- 
2.1.4




More information about the Openembedded-core mailing list