mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
scripts/buildstats-diff: move more code to lib/buildstats.py
More refactoring of buildstats-diff script. Move recipe version comparison functionality to scripts/lib/buildstats.py. This patch also compasses some wording changes, i.e. changing 'package' to 'recipe'. [YOCTO #11382] (From OE-Core rev: 2f8942d6830258fcbe1925f12ba1516def32d132) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
81aef784fd
commit
a80f5e761c
@@ -15,7 +15,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from collections import namedtuple
|
||||
from collections import namedtuple,OrderedDict
|
||||
from statistics import mean
|
||||
|
||||
|
||||
@@ -307,3 +307,32 @@ def diff_buildstats(bs1, bs2, stat_attr, min_val=None, min_absdiff=None):
|
||||
tasks_diff.append(TaskDiff(pkg, pkg_op, task, task_op, val1, val2,
|
||||
val2-val1, reldiff))
|
||||
return tasks_diff
|
||||
|
||||
|
||||
class BSVerDiff(object):
|
||||
"""Class representing recipe version differences between two buildstats"""
|
||||
def __init__(self, bs1, bs2):
|
||||
RecipeVerDiff = namedtuple('RecipeVerDiff', 'left right')
|
||||
|
||||
recipes1 = set(bs1.keys())
|
||||
recipes2 = set(bs2.keys())
|
||||
|
||||
self.new = dict([(r, bs2[r]) for r in sorted(recipes2 - recipes1)])
|
||||
self.dropped = dict([(r, bs1[r]) for r in sorted(recipes1 - recipes2)])
|
||||
self.echanged = {}
|
||||
self.vchanged = {}
|
||||
self.rchanged = {}
|
||||
self.unchanged = {}
|
||||
|
||||
common = recipes2.intersection(recipes1)
|
||||
if common:
|
||||
for recipe in common:
|
||||
rdiff = RecipeVerDiff(bs1[recipe], bs2[recipe])
|
||||
if bs1[recipe].epoch != bs2[recipe].epoch:
|
||||
self.echanged[recipe] = rdiff
|
||||
elif bs1[recipe].version != bs2[recipe].version:
|
||||
self.vchanged[recipe] = rdiff
|
||||
elif bs1[recipe].revision != bs2[recipe].revision:
|
||||
self.rchanged[recipe] = rdiff
|
||||
else:
|
||||
self.unchanged[recipe] = rdiff
|
||||
|
||||
Reference in New Issue
Block a user