summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-08-02 10:23:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-06 15:29:45 +0100
commitc0149ac6c4859a05a7a1f7310a9bd981caea8f2d (patch)
tree113778634ce63a91ea9d11b656171e0997f3ea35 /meta/lib
parent78d8faf4e16400f9f89c39917f14c03a49a09dcc (diff)
downloadpoky-c0149ac6c4859a05a7a1f7310a9bd981caea8f2d.tar.gz
classes/buildhistory: save preinst/postinst/prerm/postrm
Write the value of these package script variables into the packageinfo so that any changes to them can be tracked (in separate files since they are multi-line). Inspired by an earlier patch from Andreas Müller <schnitzeltony@googlemail.com> (From OE-Core rev: 988a417c857c01c87de6ba9602968059cf8d830f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/buildhistory_analysis.py50
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: