summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2013-08-28 12:30:01 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-30 16:18:02 +0100
commit9e749c430f97b1a30cdf0c13dacd2a985ef7b433 (patch)
treeca30334937fae6d11567502608a593b7d5e9bc98 /scripts
parentf74e456772fc80c2333fbdf57c629a18412375e8 (diff)
downloadopenembedded-core-9e749c430f97b1a30cdf0c13dacd2a985ef7b433.tar.gz
openembedded-core-9e749c430f97b1a30cdf0c13dacd2a985ef7b433.tar.bz2
openembedded-core-9e749c430f97b1a30cdf0c13dacd2a985ef7b433.zip
list-packageconfig-flags.py: fix searching bitbake module failed
Run list-packageconfig-flags.py on wrlinux's platform in which the oe-core layer and bitbake layer in different directories: ---- ../layers/oe-core/scripts/contrib/list-packageconfig-flags.py Traceback (most recent call last): File "../layers/oe-core/scripts/contrib/list-packageconfig-flags.py", line 28, in <module> import bb.cache ImportError: No module named bb.cache ---- The script import bb module from bitbake lib dir, the previous lib dir was hardcode and only worked on poky but not for others. In this situation, look for bitbake/bin dir in PATH could fix this issue. [YOCTO #5060] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/contrib/list-packageconfig-flags.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py
index 149922dc53..371033a3d8 100755
--- a/scripts/contrib/list-packageconfig-flags.py
+++ b/scripts/contrib/list-packageconfig-flags.py
@@ -23,8 +23,26 @@ import sys
import getopt
import os
+def search_bitbakepath():
+ bitbakepath = ""
+
+ # Search path to bitbake lib dir in order to load bb modules
+ if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib/bb')):
+ bitbakepath = os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib')
+ bitbakepath = os.path.abspath(bitbakepath)
+ else:
+ # Look for bitbake/bin dir in PATH
+ for pth in os.environ['PATH'].split(':'):
+ if os.path.exists(os.path.join(pth, '../lib/bb')):
+ bitbakepath = os.path.abspath(os.path.join(pth, '../lib'))
+ break
+ if not bitbakepath:
+ sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
+ sys.exit(1)
+ return bitbakepath
+
# For importing the following modules
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '../../bitbake/lib'))
+sys.path.insert(0, search_bitbakepath())
import bb.cache
import bb.cooker
import bb.providers
@@ -39,12 +57,12 @@ OPTION:
-p, --prefer list pkgs with preferred version
EXAMPLE:
-list-packageconfig-flags.py poky/meta poky/meta-yocto
-list-packageconfig-flags.py -f poky/meta poky/meta-yocto
-list-packageconfig-flags.py -a poky/meta poky/meta-yocto
-list-packageconfig-flags.py -p poky/meta poky/meta-yocto
-list-packageconfig-flags.py -f -p poky/meta poky/meta-yocto
-list-packageconfig-flags.py -a -p poky/meta poky/meta-yocto
+list-packageconfig-flags.py
+list-packageconfig-flags.py -f
+list-packageconfig-flags.py -a
+list-packageconfig-flags.py -p
+list-packageconfig-flags.py -f -p
+list-packageconfig-flags.py -a -p
'''
def usage():