Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [wic][PATCH] wic: extended list of paths in find_binary_path
Date: Sat,  4 Apr 2015 20:20:28 +0300	[thread overview]
Message-ID: <1428168028-6476-1-git-send-email-ed.bartosh@linux.intel.com> (raw)

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@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



             reply	other threads:[~2015-04-04 17:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-04 17:20 Ed Bartosh [this message]
2015-04-04 18:34 ` [wic][PATCH] wic: extended list of paths in find_binary_path Otavio Salvador
2015-04-04 21:34   ` Ed Bartosh
2015-04-05 19:13     ` Philip Balister
2015-04-06 17:43   ` [wic][PATCH] wic: use native parted Ed Bartosh
2015-04-06 18:20     ` Otavio Salvador
2015-04-05 19:16 ` [wic][PATCH] wic: extended list of paths in find_binary_path Philip Balister
2015-04-06 12:00   ` Otavio Salvador
2015-04-06 14:15     ` Ed Bartosh
2015-04-06 14:28       ` Otavio Salvador
2015-04-07 10:52         ` Ed Bartosh
2015-04-07 11:23           ` Otavio Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428168028-6476-1-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox