diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/buildhistory_analysis.py | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py index 29dc4a9ecf..6c6a085d19 100644 --- a/meta/lib/oe/buildhistory_analysis.py +++ b/meta/lib/oe/buildhistory_analysis.py | |||
@@ -90,6 +90,18 @@ class ChangeRecord: | |||
90 | else: | 90 | else: |
91 | percentchg = 100 | 91 | percentchg = 100 |
92 | out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg) | 92 | out = '%s changed from %s to %s (%s%d%%)' % (self.fieldname, self.oldvalue or "''", self.newvalue or "''", '+' if percentchg > 0 else '', percentchg) |
93 | elif self.fieldname in ['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm']: | ||
94 | if self.oldvalue and self.newvalue: | ||
95 | out = '%s changed:\n ' % self.fieldname | ||
96 | elif self.newvalue: | ||
97 | out = '%s added:\n ' % self.fieldname | ||
98 | elif self.oldvalue: | ||
99 | out = '%s cleared:\n ' % self.fieldname | ||
100 | alines = self.oldvalue.splitlines() | ||
101 | blines = self.newvalue.splitlines() | ||
102 | diff = difflib.unified_diff(alines, blines, self.fieldname, self.fieldname, lineterm='') | ||
103 | out += '\n '.join(list(diff)[2:]) | ||
104 | out += '\n --' | ||
93 | elif self.fieldname in img_monitor_files: | 105 | elif self.fieldname in img_monitor_files: |
94 | if outer: | 106 | if outer: |
95 | prefix = 'Changes to %s ' % self.path | 107 | prefix = 'Changes to %s ' % self.path |
@@ -330,7 +342,12 @@ def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False) | |||
330 | for d in diff.iter_change_type('M'): | 342 | for d in diff.iter_change_type('M'): |
331 | path = os.path.dirname(d.a_blob.path) | 343 | path = os.path.dirname(d.a_blob.path) |
332 | if path.startswith('packages/'): | 344 | if path.startswith('packages/'): |
333 | changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all)) | 345 | filename = os.path.basename(d.a_blob.path) |
346 | if filename == 'latest': | ||
347 | changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all)) | ||
348 | elif filename.startswith('latest.'): | ||
349 | chg = ChangeRecord(path, filename, d.a_blob.data_stream.read(), d.b_blob.data_stream.read(), True) | ||
350 | changes.append(chg) | ||
334 | elif path.startswith('images/'): | 351 | elif path.startswith('images/'): |
335 | filename = os.path.basename(d.a_blob.path) | 352 | filename = os.path.basename(d.a_blob.path) |
336 | if filename in img_monitor_files: | 353 | if filename in img_monitor_files: |
@@ -356,6 +373,37 @@ def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False) | |||
356 | elif filename == 'image-info.txt': | 373 | elif filename == 'image-info.txt': |
357 | changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all)) | 374 | changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all)) |
358 | 375 | ||
376 | # Look for added preinst/postinst/prerm/postrm | ||
377 | # (without reporting newly added recipes) | ||
378 | addedpkgs = [] | ||
379 | addedchanges = [] | ||
380 | for d in diff.iter_change_type('A'): | ||
381 | path = os.path.dirname(d.b_blob.path) | ||
382 | if path.startswith('packages/'): | ||
383 | filename = os.path.basename(d.b_blob.path) | ||
384 | if filename == 'latest': | ||
385 | addedpkgs.append(path) | ||
386 | elif filename.startswith('latest.'): | ||
387 | chg = ChangeRecord(path, filename[7:], '', d.b_blob.data_stream.read(), True) | ||
388 | addedchanges.append(chg) | ||
389 | for chg in addedchanges: | ||
390 | found = False | ||
391 | for pkg in addedpkgs: | ||
392 | if chg.path.startswith(pkg): | ||
393 | found = True | ||
394 | break | ||
395 | if not found: | ||
396 | changes.append(chg) | ||
397 | |||
398 | # Look for cleared preinst/postinst/prerm/postrm | ||
399 | for d in diff.iter_change_type('D'): | ||
400 | path = os.path.dirname(d.a_blob.path) | ||
401 | if path.startswith('packages/'): | ||
402 | filename = os.path.basename(d.a_blob.path) | ||
403 | if filename != 'latest' and filename.startswith('latest.'): | ||
404 | chg = ChangeRecord(path, filename[7:], d.a_blob.data_stream.read(), '', True) | ||
405 | changes.append(chg) | ||
406 | |||
359 | # Link related changes | 407 | # Link related changes |
360 | for chg in changes: | 408 | for chg in changes: |
361 | if chg.monitored: | 409 | if chg.monitored: |