summaryrefslogtreecommitdiff
path: root/scripts/buildhistory-diff
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-04-22 12:07:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-06-25 11:48:13 +0100
commit0b5e94e168819134dcda0433c8ae893df4ab13ce (patch)
tree6b0e91abf56d7da60c20fb3f25e547adc0d66a5a /scripts/buildhistory-diff
parent41bd9dbf6f3e0add6a9e2cb20cfcbff44d785ea4 (diff)
downloadopenembedded-core-0b5e94e168819134dcda0433c8ae893df4ab13ce.tar.gz
openembedded-core-0b5e94e168819134dcda0433c8ae893df4ab13ce.tar.bz2
openembedded-core-0b5e94e168819134dcda0433c8ae893df4ab13ce.zip
scripts: consolidate code to find bitbake path
Several of these scripts were using duplicated code (and slightly different methods) to find the path to bitbake and add its lib subdirectory to the Python import path. Add some common code to do this and change the scripts to use it. Fixes [YOCTO #5076]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'scripts/buildhistory-diff')
-rwxr-xr-xscripts/buildhistory-diff28
1 files changed, 12 insertions, 16 deletions
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff
index ad50414bce..dfebcddf72 100755
--- a/scripts/buildhistory-diff
+++ b/scripts/buildhistory-diff
@@ -50,24 +50,20 @@ def main():
parser.print_help()
sys.exit(1)
+ scripts_path = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])))
+ lib_path = scripts_path + '/lib'
+ sys.path = sys.path + [lib_path]
+
+ import scriptpath
+
# Set path to OE lib dir so we can import the buildhistory_analysis module
- basepath = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])) + '/..')
- newpath = basepath + '/meta/lib'
+ scriptpath.add_oe_lib_path()
# Set path to bitbake lib dir so the buildhistory_analysis module can load bb.utils
- if os.path.exists(basepath + '/bitbake/lib/bb'):
- bitbakepath = basepath + '/bitbake'
- else:
- # look for bitbake/bin dir in PATH
- bitbakepath = None
- 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, '..'))
- break
- if not bitbakepath:
- sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
- sys.exit(1)
-
- sys.path[0:0] = [newpath, bitbakepath + '/lib']
+ bitbakepath = scriptpath.add_bitbake_lib_path()
+ if not bitbakepath:
+ sys.stderr.write("Unable to find bitbake by searching parent directory of this script or PATH\n")
+ sys.exit(1)
+
import oe.buildhistory_analysis
fromrev = 'build-minus-1'