summaryrefslogtreecommitdiffstats
path: root/scripts/buildstats-diff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/buildstats-diff')
-rwxr-xr-xscripts/buildstats-diff86
1 files changed, 31 insertions, 55 deletions
diff --git a/scripts/buildstats-diff b/scripts/buildstats-diff
index ce82dabee9..a128dd324f 100755
--- a/scripts/buildstats-diff
+++ b/scripts/buildstats-diff
@@ -24,7 +24,7 @@ from operator import attrgetter
24# Import oe libs 24# Import oe libs
25scripts_path = os.path.dirname(os.path.realpath(__file__)) 25scripts_path = os.path.dirname(os.path.realpath(__file__))
26sys.path.append(os.path.join(scripts_path, 'lib')) 26sys.path.append(os.path.join(scripts_path, 'lib'))
27from buildstats import BuildStats, diff_buildstats, taskdiff_fields 27from buildstats import BuildStats, diff_buildstats, taskdiff_fields, BSVerDiff
28 28
29 29
30# Setup logging 30# Setup logging
@@ -76,72 +76,48 @@ def read_buildstats(path, multi):
76 76
77def print_ver_diff(bs1, bs2): 77def print_ver_diff(bs1, bs2):
78 """Print package version differences""" 78 """Print package version differences"""
79 pkgs1 = set(bs1.keys())
80 pkgs2 = set(bs2.keys())
81 new_pkgs = pkgs2 - pkgs1
82 deleted_pkgs = pkgs1 - pkgs2
83
84 echanged = []
85 vchanged = []
86 rchanged = []
87 unchanged = []
88 common_pkgs = pkgs2.intersection(pkgs1)
89 if common_pkgs:
90 for pkg in common_pkgs:
91 if bs1[pkg].epoch != bs2[pkg].epoch:
92 echanged.append(pkg)
93 elif bs1[pkg].version != bs2[pkg].version:
94 vchanged.append(pkg)
95 elif bs1[pkg].revision != bs2[pkg].revision:
96 rchanged.append(pkg)
97 else:
98 unchanged.append(pkg)
99 79
100 maxlen = max([len(pkg) for pkg in pkgs1.union(pkgs2)]) 80 diff = BSVerDiff(bs1, bs2)
81
82 maxlen = max([len(r) for r in set(bs1.keys()).union(set(bs2.keys()))])
101 fmt_str = " {:{maxlen}} ({})" 83 fmt_str = " {:{maxlen}} ({})"
102# if unchanged: 84
103# print("\nUNCHANGED PACKAGES:") 85 if diff.new:
104# print("-------------------") 86 print("\nNEW RECIPES:")
105# maxlen = max([len(pkg) for pkg in unchanged]) 87 print("------------")
106# for pkg in sorted(unchanged): 88 for name, val in sorted(diff.new.items()):
107# print(fmt_str.format(pkg, bs2[pkg]['nevr'], maxlen=maxlen)) 89 print(fmt_str.format(name, val.nevr, maxlen=maxlen))
108 90
109 if new_pkgs: 91 if diff.dropped:
110 print("\nNEW PACKAGES:") 92 print("\nDROPPED RECIPES:")
111 print("-------------") 93 print("----------------")
112 for pkg in sorted(new_pkgs): 94 for name, val in sorted(diff.dropped.items()):
113 print(fmt_str.format(pkg, bs2[pkg].nevr, maxlen=maxlen)) 95 print(fmt_str.format(name, val.nevr, maxlen=maxlen))
114
115 if deleted_pkgs:
116 print("\nDELETED PACKAGES:")
117 print("-----------------")
118 for pkg in sorted(deleted_pkgs):
119 print(fmt_str.format(pkg, bs1[pkg].nevr, maxlen=maxlen))
120 96
121 fmt_str = " {0:{maxlen}} {1:<20} ({2})" 97 fmt_str = " {0:{maxlen}} {1:<20} ({2})"
122 if rchanged: 98 if diff.rchanged:
123 print("\nREVISION CHANGED:") 99 print("\nREVISION CHANGED:")
124 print("-----------------") 100 print("-----------------")
125 for pkg in sorted(rchanged): 101 for name, val in sorted(diff.rchanged.items()):
126 field1 = "{} -> {}".format(pkg, bs1[pkg].revision, bs2[pkg].revision) 102 field1 = "{} -> {}".format(val.left.revision, val.right.revision)
127 field2 = "{} -> {}".format(bs1[pkg].nevr, bs2[pkg].nevr) 103 field2 = "{} -> {}".format(val.left.nevr, val.right.nevr)
128 print(fmt_str.format(pkg, field1, field2, maxlen=maxlen)) 104 print(fmt_str.format(name, field1, field2, maxlen=maxlen))
129 105
130 if vchanged: 106 if diff.vchanged:
131 print("\nVERSION CHANGED:") 107 print("\nVERSION CHANGED:")
132 print("----------------") 108 print("----------------")
133 for pkg in sorted(vchanged): 109 for name, val in sorted(diff.vchanged.items()):
134 field1 = "{} -> {}".format(bs1[pkg].version, bs2[pkg].version) 110 field1 = "{} -> {}".format(val.left.version, val.right.version)
135 field2 = "{} -> {}".format(bs1[pkg].nevr, bs2[pkg].nevr) 111 field2 = "{} -> {}".format(val.left.nevr, val.right.nevr)
136 print(fmt_str.format(pkg, field1, field2, maxlen=maxlen)) 112 print(fmt_str.format(name, field1, field2, maxlen=maxlen))
137 113
138 if echanged: 114 if diff.echanged:
139 print("\nEPOCH CHANGED:") 115 print("\nEPOCH CHANGED:")
140 print("--------------") 116 print("--------------")
141 for pkg in sorted(echanged): 117 for name, val in sorted(diff.echanged.items()):
142 field1 = "{} -> {}".format(bs1[pkg].epoch, bs2[pkg].epoch) 118 field1 = "{} -> {}".format(val.left.epoch, val.right.epoch)
143 field2 = "{} -> {}".format(bs1[pkg].nevr, bs2[pkg].nevr) 119 field2 = "{} -> {}".format(val.left.nevr, val.right.nevr)
144 print(fmt_str.format(pkg, field1, field2, maxlen=maxlen)) 120 print(fmt_str.format(name, field1, field2, maxlen=maxlen))
145 121
146 122
147def print_task_diff(bs1, bs2, val_type, min_val=0, min_absdiff=0, sort_by=('absdiff',)): 123def print_task_diff(bs1, bs2, val_type, min_val=0, min_absdiff=0, sort_by=('absdiff',)):