summaryrefslogtreecommitdiff
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:48:48 +0100
commitb7de1eaac9eed559b2d68058f5de67de74a6cb58 (patch)
tree93ac31d11fd47b4181fde6c5c47309bb1e8a12cb /meta
parentef2ee68778be8e5336cd33ab6551bce1d56047b6 (diff)
downloadopenembedded-core-b7de1eaac9eed559b2d68058f5de67de74a6cb58.tar.gz
openembedded-core-b7de1eaac9eed559b2d68058f5de67de74a6cb58.tar.bz2
openembedded-core-b7de1eaac9eed559b2d68058f5de67de74a6cb58.zip
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]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
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
# How to display fields
list_fields = ['DEPENDS', 'RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RREPLACES', 'RCONFLICTS', 'FILES', 'FILELIST', 'USER_CLASSES', 'IMAGE_CLASSES', 'IMAGE_FEATURES', 'IMAGE_LINGUAS', 'IMAGE_INSTALL', 'BAD_RECOMMENDATIONS']
list_order_fields = ['PACKAGES']
-defaultval_fields = ['PKG', 'PKGE', 'PKGV', 'PKGR']
+defaultval_map = {'PKG': 'PKG', 'PKGE': 'PE', 'PKGV': 'PV', 'PKGR': 'PR'}
numeric_fields = ['PKGSIZE', 'IMAGESIZE']
# Fields to monitor
-monitor_fields = ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RREPLACES', 'RCONFLICTS', 'PACKAGES', 'FILELIST', 'PKGSIZE', 'IMAGESIZE', 'PKG', 'PKGE', 'PKGV', 'PKGR']
+monitor_fields = ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RREPLACES', 'RCONFLICTS', 'PACKAGES', 'FILELIST', 'PKGSIZE', 'IMAGESIZE', 'PKG']
+ver_monitor_fields = ['PKGE', 'PKGV', 'PKGR']
# Percentage change to alert for numeric fields
monitor_numeric_threshold = 10
# Image files to monitor (note that image-info.txt is handled separately)
@@ -94,7 +95,7 @@ class ChangeRecord:
else:
percentchg = 100
out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg)
- elif self.fieldname in defaultval_fields:
+ elif self.fieldname in defaultval_map:
out = '%s changed from %s to %s' % (self.fieldname, self.oldvalue, self.newvalue)
if self.fieldname == 'PKG' and '[default]' in self.newvalue:
out += ' - may indicate debian renaming failure'
@@ -305,24 +306,32 @@ def compare_pkg_lists(astr, bstr):
return (depvera, depverb)
-def compare_dict_blobs(path, ablob, bblob, report_all):
+def compare_dict_blobs(path, ablob, bblob, report_all, report_ver):
adict = blob_to_dict(ablob)
bdict = blob_to_dict(bblob)
pkgname = os.path.basename(path)
+
defaultvals = {}
defaultvals['PKG'] = pkgname
- defaultvals['PKGE'] = adict.get('PE', '0')
- defaultvals['PKGV'] = adict.get('PV', '')
- defaultvals['PKGR'] = adict.get('PR', '')
- for key in defaultvals:
- defaultvals[key] = '%s [default]' % defaultvals[key]
+ defaultvals['PKGE'] = '0'
changes = []
- keys = list(set(adict.keys()) | set(bdict.keys()))
+ keys = list(set(adict.keys()) | set(bdict.keys()) | set(defaultval_map.keys()))
for key in keys:
astr = adict.get(key, '')
bstr = bdict.get(key, '')
+ if key in ver_monitor_fields:
+ monitored = report_ver or astr or bstr
+ else:
+ monitored = key in monitor_fields
+ mapped_key = defaultval_map.get(key, '')
+ if mapped_key:
+ if not astr:
+ astr = '%s [default]' % adict.get(mapped_key, defaultvals.get(key, ''))
+ if not bstr:
+ bstr = '%s [default]' % bdict.get(mapped_key, defaultvals.get(key, ''))
+
if astr != bstr:
if (not report_all) and key in numeric_fields:
aval = int(astr or 0)
@@ -350,18 +359,12 @@ def compare_dict_blobs(path, ablob, bblob, report_all):
if ' '.join(alist) == ' '.join(blist):
continue
- if key in defaultval_fields:
- if not astr:
- astr = defaultvals[key]
- elif not bstr:
- bstr = defaultvals[key]
-
- chg = ChangeRecord(path, key, astr, bstr, key in monitor_fields)
+ chg = ChangeRecord(path, key, astr, bstr, monitored)
changes.append(chg)
return changes
-def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False):
+def process_changes(repopath, revision1, revision2='HEAD', report_all=False, report_ver=False):
repo = git.Repo(repopath)
assert repo.bare == False
commit = repo.commit(revision1)
@@ -373,7 +376,7 @@ def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False)
if path.startswith('packages/'):
filename = os.path.basename(d.a_blob.path)
if filename == 'latest':
- changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all))
+ changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all, report_ver))
elif filename.startswith('latest.'):
chg = ChangeRecord(path, filename, d.a_blob.data_stream.read(), d.b_blob.data_stream.read(), True)
changes.append(chg)