summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-10-17 14:15:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-26 15:59:13 +0100
commitf995febd2ebd43774cb1cc5917f3f3c46a744519 (patch)
treea37c415ca70079414f7c2aef271175b2880d68ff /meta
parentbc77ea96adef9977a39704e2bf5caddde0225d63 (diff)
downloadpoky-f995febd2ebd43774cb1cc5917f3f3c46a744519.tar.gz
buildhistory-diff: add ability to report version changes
Add a -v/--report-ver option to report changes in PKGE/PKGV/PKGR even if the value is the same as the default from PE/PV/PR. Also add a -a/--report-all option to report all changes instead of just the default significant ones. Addresses [YOCTO #5263]. (From OE-Core rev: b7de1eaac9eed559b2d68058f5de67de74a6cb58) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/buildhistory_analysis.py41
1 files changed, 22 insertions, 19 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)