diff options
-rw-r--r-- | meta/lib/oe/buildhistory_analysis.py | 11 | ||||
-rwxr-xr-x | scripts/buildhistory-diff | 21 |
2 files changed, 27 insertions, 5 deletions
diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py index d09911cb07..c0fa339e36 100644 --- a/meta/lib/oe/buildhistory_analysis.py +++ b/meta/lib/oe/buildhistory_analysis.py | |||
@@ -13,6 +13,7 @@ import os.path | |||
13 | import difflib | 13 | import difflib |
14 | import git | 14 | import git |
15 | import re | 15 | import re |
16 | import bb.utils | ||
16 | 17 | ||
17 | 18 | ||
18 | # How to display fields | 19 | # How to display fields |
@@ -55,8 +56,13 @@ class ChangeRecord: | |||
55 | prefix = '' | 56 | prefix = '' |
56 | 57 | ||
57 | def pkglist_split(pkgs): | 58 | def pkglist_split(pkgs): |
58 | pkgit = re.finditer(r'[a-zA-Z0-9.+-]+( \([><=]+ [^ )]+\))?', pkgs, 0) | 59 | depver = bb.utils.explode_dep_versions(pkgs) |
59 | pkglist = [p.group(0) for p in pkgit] | 60 | pkglist = [] |
61 | for k,v in depver.iteritems(): | ||
62 | if v: | ||
63 | pkglist.append("%s (%s)" % (k,v)) | ||
64 | else: | ||
65 | pkglist.append(k) | ||
60 | return pkglist | 66 | return pkglist |
61 | 67 | ||
62 | if self.fieldname in list_fields or self.fieldname in list_order_fields: | 68 | if self.fieldname in list_fields or self.fieldname in list_order_fields: |
@@ -68,6 +74,7 @@ class ChangeRecord: | |||
68 | bitems = self.newvalue.split() | 74 | bitems = self.newvalue.split() |
69 | removed = list(set(aitems) - set(bitems)) | 75 | removed = list(set(aitems) - set(bitems)) |
70 | added = list(set(bitems) - set(aitems)) | 76 | added = list(set(bitems) - set(aitems)) |
77 | |||
71 | if removed or added: | 78 | if removed or added: |
72 | out = '%s:%s%s' % (self.fieldname, ' removed "%s"' % ' '.join(removed) if removed else '', ' added "%s"' % ' '.join(added) if added else '') | 79 | out = '%s:%s%s' % (self.fieldname, ' removed "%s"' % ' '.join(removed) if removed else '', ' added "%s"' % ' '.join(added) if added else '') |
73 | else: | 80 | else: |
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff index 6b344ebfaf..9936a4b605 100755 --- a/scripts/buildhistory-diff +++ b/scripts/buildhistory-diff | |||
@@ -6,7 +6,7 @@ | |||
6 | # Author: Paul Eggleton <paul.eggleton@linux.intel.com> | 6 | # Author: Paul Eggleton <paul.eggleton@linux.intel.com> |
7 | 7 | ||
8 | import sys | 8 | import sys |
9 | import os.path | 9 | import os |
10 | 10 | ||
11 | # Ensure PythonGit is installed (buildhistory_analysis needs it) | 11 | # Ensure PythonGit is installed (buildhistory_analysis needs it) |
12 | try: | 12 | try: |
@@ -24,8 +24,23 @@ def main(): | |||
24 | sys.exit(1) | 24 | sys.exit(1) |
25 | 25 | ||
26 | # Set path to OE lib dir so we can import the buildhistory_analysis module | 26 | # Set path to OE lib dir so we can import the buildhistory_analysis module |
27 | newpath = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])) + '/../meta/lib') | 27 | basepath = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])) + '/..') |
28 | sys.path = sys.path + [newpath] | 28 | newpath = basepath + '/meta/lib' |
29 | # Set path to bitbake lib dir so the buildhistory_analysis module can load bb.utils | ||
30 | if os.path.exists(basepath + '/bitbake/lib/bb'): | ||
31 | bitbakepath = basepath + '/bitbake' | ||
32 | else: | ||
33 | # look for bitbake/bin dir in PATH | ||
34 | bitbakepath = None | ||
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, '..')) | ||
38 | break | ||
39 | if not bitbakepath: | ||
40 | print("Unable to find bitbake by searching parent directory of this script or PATH") | ||
41 | sys.exit(1) | ||
42 | |||
43 | sys.path.extend([newpath, bitbakepath + '/lib']) | ||
29 | import oe.buildhistory_analysis | 44 | import oe.buildhistory_analysis |
30 | 45 | ||
31 | if len(sys.argv) > 3: | 46 | if len(sys.argv) > 3: |