From f72b2a1bda35a99292063c1cc6ff563b397e190d Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 20 Mar 2012 16:06:25 +0000 Subject: buildhistory_analysis: hide version number increases in dependencies If an item in RDEPENDS or RRECOMMENDS only increases in its version number then don't report it as a change, since we don't care about it. This significantly reduces the noise after upgrades. Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- meta/lib/oe/buildhistory_analysis.py | 51 +++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) (limited to 'meta/lib') diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py index c0fa339e36..a828f28421 100644 --- a/meta/lib/oe/buildhistory_analysis.py +++ b/meta/lib/oe/buildhistory_analysis.py @@ -55,8 +55,7 @@ class ChangeRecord: else: prefix = '' - def pkglist_split(pkgs): - depver = bb.utils.explode_dep_versions(pkgs) + def pkglist_combine(depver): pkglist = [] for k,v in depver.iteritems(): if v: @@ -67,8 +66,9 @@ class ChangeRecord: if self.fieldname in list_fields or self.fieldname in list_order_fields: if self.fieldname in ['RDEPENDS', 'RRECOMMENDS']: - aitems = pkglist_split(self.oldvalue) - bitems = pkglist_split(self.newvalue) + (depvera, depverb) = compare_pkg_lists(self.oldvalue, self.newvalue) + aitems = pkglist_combine(depvera) + bitems = pkglist_combine(depverb) else: aitems = self.oldvalue.split() bitems = self.newvalue.split() @@ -239,6 +239,45 @@ def compare_lists(alines, blines): return filechanges +def split_version(s): + """Split a version string into its constituent parts (PE, PV, PR) + FIXME: this is a duplicate of a new function in bitbake/lib/bb/utils - + we should switch to that once we can bump the minimum bitbake version + """ + s = s.strip(" <>=") + e = 0 + if s.count(':'): + e = int(s.split(":")[0]) + s = s.split(":")[1] + r = "" + if s.count('-'): + r = s.rsplit("-", 1)[1] + s = s.rsplit("-", 1)[0] + v = s + return (e, v, r) + + +def compare_pkg_lists(astr, bstr): + depvera = bb.utils.explode_dep_versions(astr) + depverb = bb.utils.explode_dep_versions(bstr) + + # Strip out changes where the version has increased + remove = [] + for k in depvera: + if k in depverb: + dva = depvera[k] + dvb = depverb[k] + if dva != dvb: + if bb.utils.vercmp(split_version(dva), split_version(dvb)) < 0: + remove.append(k) + + for k in remove: + depvera.pop(k) + depverb.pop(k) + + return (depvera, depverb) + + def compare_dict_blobs(path, ablob, bblob, report_all): adict = blob_to_dict(ablob) bdict = blob_to_dict(bblob) @@ -259,6 +298,10 @@ def compare_dict_blobs(path, ablob, bblob, report_all): if percentchg < monitor_numeric_threshold: continue elif (not report_all) and key in list_fields: + if key in ['RDEPENDS', 'RRECOMMENDS']: + (depvera, depverb) = compare_pkg_lists(astr, bstr) + if depvera == depverb: + continue alist = astr.split() alist.sort() blist = bstr.split() -- cgit v1.2.3