summaryrefslogtreecommitdiffstats
path: root/scripts/contrib
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:23:47 +0100
commit926a11748696c955b9684c9cac3a2e65e51528fc (patch)
tree4c5889d74ffcfe58b935aefb351ede25bd10f703 /scripts/contrib
parent1370927687cdc7bbc1de329744b33771345e395f (diff)
downloadpoky-926a11748696c955b9684c9cac3a2e65e51528fc.tar.gz
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] (From OE-Core rev: 9e749c430f97b1a30cdf0c13dacd2a985ef7b433) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib')
-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
23import getopt 23import getopt
24import os 24import os
25 25
26def search_bitbakepath():
27 bitbakepath = ""
28
29 # Search path to bitbake lib dir in order to load bb modules
30 if os.path.exists(os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib/bb')):
31 bitbakepath = os.path.join(os.path.dirname(sys.argv[0]), '../../bitbake/lib')
32 bitbakepath = os.path.abspath(bitbakepath)
33 else:
34 # Look for bitbake/bin dir in PATH
35 for pth in os.environ['PATH'].split(':'):
36 if os.path.exists(os.path.join(pth, '../lib/bb')):
37 bitbakepath = os.path.abspath(os.path.join(pth, '../lib'))
38 break
39 if not bitbakepath:
40 sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
41 sys.exit(1)
42 return bitbakepath
43
26# For importing the following modules 44# For importing the following modules
27sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), '../../bitbake/lib')) 45sys.path.insert(0, search_bitbakepath())
28import bb.cache 46import bb.cache
29import bb.cooker 47import bb.cooker
30import bb.providers 48import bb.providers
@@ -39,12 +57,12 @@ OPTION:
39 -p, --prefer list pkgs with preferred version 57 -p, --prefer list pkgs with preferred version
40 58
41EXAMPLE: 59EXAMPLE:
42list-packageconfig-flags.py poky/meta poky/meta-yocto 60list-packageconfig-flags.py
43list-packageconfig-flags.py -f poky/meta poky/meta-yocto 61list-packageconfig-flags.py -f
44list-packageconfig-flags.py -a poky/meta poky/meta-yocto 62list-packageconfig-flags.py -a
45list-packageconfig-flags.py -p poky/meta poky/meta-yocto 63list-packageconfig-flags.py -p
46list-packageconfig-flags.py -f -p poky/meta poky/meta-yocto 64list-packageconfig-flags.py -f -p
47list-packageconfig-flags.py -a -p poky/meta poky/meta-yocto 65list-packageconfig-flags.py -a -p
48''' 66'''
49 67
50def usage(): 68def usage():