summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oe/buildhistory_analysis.py41
-rwxr-xr-xscripts/buildhistory-diff8
2 files changed, 29 insertions, 20 deletions
diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py
index 86b5a12347..dd17dd5645 100644
--- a/meta/lib/oe/buildhistory_analysis.py
+++ b/meta/lib/oe/buildhistory_analysis.py
@@ -19,10 +19,11 @@ import bb.utils
19# How to display fields 19# How to display fields
20list_fields = ['DEPENDS', 'RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RREPLACES', 'RCONFLICTS', 'FILES', 'FILELIST', 'USER_CLASSES', 'IMAGE_CLASSES', 'IMAGE_FEATURES', 'IMAGE_LINGUAS', 'IMAGE_INSTALL', 'BAD_RECOMMENDATIONS'] 20list_fields = ['DEPENDS', 'RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RREPLACES', 'RCONFLICTS', 'FILES', 'FILELIST', 'USER_CLASSES', 'IMAGE_CLASSES', 'IMAGE_FEATURES', 'IMAGE_LINGUAS', 'IMAGE_INSTALL', 'BAD_RECOMMENDATIONS']
21list_order_fields = ['PACKAGES'] 21list_order_fields = ['PACKAGES']
22defaultval_fields = ['PKG', 'PKGE', 'PKGV', 'PKGR'] 22defaultval_map = {'PKG': 'PKG', 'PKGE': 'PE', 'PKGV': 'PV', 'PKGR': 'PR'}
23numeric_fields = ['PKGSIZE', 'IMAGESIZE'] 23numeric_fields = ['PKGSIZE', 'IMAGESIZE']
24# Fields to monitor 24# Fields to monitor
25monitor_fields = ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RREPLACES', 'RCONFLICTS', 'PACKAGES', 'FILELIST', 'PKGSIZE', 'IMAGESIZE', 'PKG', 'PKGE', 'PKGV', 'PKGR'] 25monitor_fields = ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RREPLACES', 'RCONFLICTS', 'PACKAGES', 'FILELIST', 'PKGSIZE', 'IMAGESIZE', 'PKG']
26ver_monitor_fields = ['PKGE', 'PKGV', 'PKGR']
26# Percentage change to alert for numeric fields 27# Percentage change to alert for numeric fields
27monitor_numeric_threshold = 10 28monitor_numeric_threshold = 10
28# Image files to monitor (note that image-info.txt is handled separately) 29# Image files to monitor (note that image-info.txt is handled separately)
@@ -94,7 +95,7 @@ class ChangeRecord:
94 else: 95 else:
95 percentchg = 100 96 percentchg = 100
96 out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg) 97 out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg)
97 elif self.fieldname in defaultval_fields: 98 elif self.fieldname in defaultval_map:
98 out = '%s changed from %s to %s' % (self.fieldname, self.oldvalue, self.newvalue) 99 out = '%s changed from %s to %s' % (self.fieldname, self.oldvalue, self.newvalue)
99 if self.fieldname == 'PKG' and '[default]' in self.newvalue: 100 if self.fieldname == 'PKG' and '[default]' in self.newvalue:
100 out += ' - may indicate debian renaming failure' 101 out += ' - may indicate debian renaming failure'
@@ -305,24 +306,32 @@ def compare_pkg_lists(astr, bstr):
305 return (depvera, depverb) 306 return (depvera, depverb)
306 307
307 308
308def compare_dict_blobs(path, ablob, bblob, report_all): 309def compare_dict_blobs(path, ablob, bblob, report_all, report_ver):
309 adict = blob_to_dict(ablob) 310 adict = blob_to_dict(ablob)
310 bdict = blob_to_dict(bblob) 311 bdict = blob_to_dict(bblob)
311 312
312 pkgname = os.path.basename(path) 313 pkgname = os.path.basename(path)
314
313 defaultvals = {} 315 defaultvals = {}
314 defaultvals['PKG'] = pkgname 316 defaultvals['PKG'] = pkgname
315 defaultvals['PKGE'] = adict.get('PE', '0') 317 defaultvals['PKGE'] = '0'
316 defaultvals['PKGV'] = adict.get('PV', '')
317 defaultvals['PKGR'] = adict.get('PR', '')
318 for key in defaultvals:
319 defaultvals[key] = '%s [default]' % defaultvals[key]
320 318
321 changes = [] 319 changes = []
322 keys = list(set(adict.keys()) | set(bdict.keys())) 320 keys = list(set(adict.keys()) | set(bdict.keys()) | set(defaultval_map.keys()))
323 for key in keys: 321 for key in keys:
324 astr = adict.get(key, '') 322 astr = adict.get(key, '')
325 bstr = bdict.get(key, '') 323 bstr = bdict.get(key, '')
324 if key in ver_monitor_fields:
325 monitored = report_ver or astr or bstr
326 else:
327 monitored = key in monitor_fields
328 mapped_key = defaultval_map.get(key, '')
329 if mapped_key:
330 if not astr:
331 astr = '%s [default]' % adict.get(mapped_key, defaultvals.get(key, ''))
332 if not bstr:
333 bstr = '%s [default]' % bdict.get(mapped_key, defaultvals.get(key, ''))
334
326 if astr != bstr: 335 if astr != bstr:
327 if (not report_all) and key in numeric_fields: 336 if (not report_all) and key in numeric_fields:
328 aval = int(astr or 0) 337 aval = int(astr or 0)
@@ -350,18 +359,12 @@ def compare_dict_blobs(path, ablob, bblob, report_all):
350 if ' '.join(alist) == ' '.join(blist): 359 if ' '.join(alist) == ' '.join(blist):
351 continue 360 continue
352 361
353 if key in defaultval_fields: 362 chg = ChangeRecord(path, key, astr, bstr, monitored)
354 if not astr:
355 astr = defaultvals[key]
356 elif not bstr:
357 bstr = defaultvals[key]
358
359 chg = ChangeRecord(path, key, astr, bstr, key in monitor_fields)
360 changes.append(chg) 363 changes.append(chg)
361 return changes 364 return changes
362 365
363 366
364def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False): 367def process_changes(repopath, revision1, revision2='HEAD', report_all=False, report_ver=False):
365 repo = git.Repo(repopath) 368 repo = git.Repo(repopath)
366 assert repo.bare == False 369 assert repo.bare == False
367 commit = repo.commit(revision1) 370 commit = repo.commit(revision1)
@@ -373,7 +376,7 @@ def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False)
373 if path.startswith('packages/'): 376 if path.startswith('packages/'):
374 filename = os.path.basename(d.a_blob.path) 377 filename = os.path.basename(d.a_blob.path)
375 if filename == 'latest': 378 if filename == 'latest':
376 changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all)) 379 changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all, report_ver))
377 elif filename.startswith('latest.'): 380 elif filename.startswith('latest.'):
378 chg = ChangeRecord(path, filename, d.a_blob.data_stream.read(), d.b_blob.data_stream.read(), True) 381 chg = ChangeRecord(path, filename, d.a_blob.data_stream.read(), d.b_blob.data_stream.read(), True)
379 changes.append(chg) 382 changes.append(chg)
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff
index b82240d763..ad50414bce 100755
--- a/scripts/buildhistory-diff
+++ b/scripts/buildhistory-diff
@@ -27,6 +27,12 @@ def main():
27 parser.add_option("-p", "--buildhistory-dir", 27 parser.add_option("-p", "--buildhistory-dir",
28 help = "Specify path to buildhistory directory (defaults to buildhistory/ under cwd)", 28 help = "Specify path to buildhistory directory (defaults to buildhistory/ under cwd)",
29 action="store", dest="buildhistory_dir", default='buildhistory/') 29 action="store", dest="buildhistory_dir", default='buildhistory/')
30 parser.add_option("-v", "--report-version",
31 help = "Report changes in PKGE/PKGV/PKGR even when the values are still the default (PE/PV/PR)",
32 action="store_true", dest="report_ver", default=False)
33 parser.add_option("-a", "--report-all",
34 help = "Report all changes, not just the default significant ones",
35 action="store_true", dest="report_all", default=False)
30 36
31 options, args = parser.parse_args(sys.argv) 37 options, args = parser.parse_args(sys.argv)
32 38
@@ -79,7 +85,7 @@ def main():
79 85
80 import gitdb 86 import gitdb
81 try: 87 try:
82 changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev) 88 changes = oe.buildhistory_analysis.process_changes(options.buildhistory_dir, fromrev, torev, options.report_all, options.report_ver)
83 except gitdb.exc.BadObject as e: 89 except gitdb.exc.BadObject as e:
84 if len(args) == 1: 90 if len(args) == 1:
85 sys.stderr.write("Unable to find previous build revision in buildhistory repository\n\n") 91 sys.stderr.write("Unable to find previous build revision in buildhistory repository\n\n")