summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/buildhistory_analysis.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-05-09 16:57:48 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-10 11:37:16 +0100
commite42f0acf46897515ae14c3b3c12632ccb2a378f2 (patch)
tree1c20e5768964b43eb2f88c1d128e2845c3178711 /meta/lib/oe/buildhistory_analysis.py
parent68f441e303f9a1aa37f6d4606a9fe5a94998880f (diff)
downloadpoky-e42f0acf46897515ae14c3b3c12632ccb2a378f2.tar.gz
classes/buildhistory: track contents of selected files in images
Add a BUILDHISTORY_IMAGE_FILES variable specifying a space-separated list of files within an image to copy into buildhistory, so that changes to them can be tracked. Typically this would be used for configuration files, and by default this includes /etc/passwd and /etc/group, but the user is free to extend this list by setting the variable in local.conf. Implements [YOCTO #4154]. (From OE-Core rev: ed6bb6e3db518082d3a9c45d548bc1339be2c5ca) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/buildhistory_analysis.py')
-rw-r--r--meta/lib/oe/buildhistory_analysis.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py
index 2306bcb4bf..86b5a12347 100644
--- a/meta/lib/oe/buildhistory_analysis.py
+++ b/meta/lib/oe/buildhistory_analysis.py
@@ -52,7 +52,10 @@ class ChangeRecord:
52 52
53 def _str_internal(self, outer): 53 def _str_internal(self, outer):
54 if outer: 54 if outer:
55 prefix = '%s: ' % self.path 55 if '/image-files/' in self.path:
56 prefix = '%s: ' % self.path.split('/image-files/')[0]
57 else:
58 prefix = '%s: ' % self.path
56 else: 59 else:
57 prefix = '' 60 prefix = ''
58 61
@@ -107,16 +110,21 @@ class ChangeRecord:
107 diff = difflib.unified_diff(alines, blines, self.fieldname, self.fieldname, lineterm='') 110 diff = difflib.unified_diff(alines, blines, self.fieldname, self.fieldname, lineterm='')
108 out += '\n '.join(list(diff)[2:]) 111 out += '\n '.join(list(diff)[2:])
109 out += '\n --' 112 out += '\n --'
110 elif self.fieldname in img_monitor_files: 113 elif self.fieldname in img_monitor_files or '/image-files/' in self.path:
111 if outer: 114 fieldname = self.fieldname
112 prefix = 'Changes to %s ' % self.path 115 if '/image-files/' in self.path:
113 out = '(%s):\n ' % self.fieldname 116 fieldname = os.path.join('/' + self.path.split('/image-files/')[1], self.fieldname)
117 out = 'Changes to %s:\n ' % fieldname
118 else:
119 if outer:
120 prefix = 'Changes to %s ' % self.path
121 out = '(%s):\n ' % self.fieldname
114 if self.filechanges: 122 if self.filechanges:
115 out += '\n '.join(['%s' % i for i in self.filechanges]) 123 out += '\n '.join(['%s' % i for i in self.filechanges])
116 else: 124 else:
117 alines = self.oldvalue.splitlines() 125 alines = self.oldvalue.splitlines()
118 blines = self.newvalue.splitlines() 126 blines = self.newvalue.splitlines()
119 diff = difflib.unified_diff(alines, blines, self.fieldname, self.fieldname, lineterm='') 127 diff = difflib.unified_diff(alines, blines, fieldname, fieldname, lineterm='')
120 out += '\n '.join(list(diff)) 128 out += '\n '.join(list(diff))
121 out += '\n --' 129 out += '\n --'
122 else: 130 else:
@@ -393,6 +401,9 @@ def process_changes(repopath, revision1, revision2 = 'HEAD', report_all = False)
393 changes.append(chg) 401 changes.append(chg)
394 elif filename == 'image-info.txt': 402 elif filename == 'image-info.txt':
395 changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all)) 403 changes.extend(compare_dict_blobs(path, d.a_blob, d.b_blob, report_all))
404 elif '/image-files/' in path:
405 chg = ChangeRecord(path, filename, d.a_blob.data_stream.read(), d.b_blob.data_stream.read(), True)
406 changes.append(chg)
396 407
397 # Look for added preinst/postinst/prerm/postrm 408 # Look for added preinst/postinst/prerm/postrm
398 # (without reporting newly added recipes) 409 # (without reporting newly added recipes)