summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-11-28 19:28:03 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-16 10:23:23 +0000
commit46e787b248f7f68351113b5040115130e23b72c3 (patch)
tree8d10708f7c96eea22c2a555c14cb0facf6c9d648
parentc21cec84886d9c70396e9be0ceb9a8ef300b54be (diff)
downloadpoky-46e787b248f7f68351113b5040115130e23b72c3.tar.gz
buildhistory-diff: report directory renames
The script detects directory renaming if two different directories with the same set of files are added and removed. [YOCTO #10691] (From OE-Core rev: 944db779a9f45cbeeebc976c00da37a517eea237) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/buildhistory_analysis.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/meta/lib/oe/buildhistory_analysis.py b/meta/lib/oe/buildhistory_analysis.py
index b6c0265c15..19b3bc437c 100644
--- a/meta/lib/oe/buildhistory_analysis.py
+++ b/meta/lib/oe/buildhistory_analysis.py
@@ -69,7 +69,22 @@ class ChangeRecord:
69 pkglist.append(k) 69 pkglist.append(k)
70 return pkglist 70 return pkglist
71 71
72 def detect_renamed_dirs(aitems, bitems):
73 adirs = set(map(os.path.dirname, aitems))
74 bdirs = set(map(os.path.dirname, bitems))
75 files_ab = [(name, sorted(os.path.basename(item) for item in aitems if os.path.dirname(item) == name)) \
76 for name in adirs - bdirs]
77 files_ba = [(name, sorted(os.path.basename(item) for item in bitems if os.path.dirname(item) == name)) \
78 for name in bdirs - adirs]
79 renamed_dirs = [(dir1, dir2) for dir1, files1 in files_ab for dir2, files2 in files_ba if files1 == files2]
80 # remove files that belong to renamed dirs from aitems and bitems
81 for dir1, dir2 in renamed_dirs:
82 aitems = [item for item in aitems if os.path.dirname(item) not in (dir1, dir2)]
83 bitems = [item for item in bitems if os.path.dirname(item) not in (dir1, dir2)]
84 return renamed_dirs, aitems, bitems
85
72 if self.fieldname in list_fields or self.fieldname in list_order_fields: 86 if self.fieldname in list_fields or self.fieldname in list_order_fields:
87 renamed_dirs = []
73 if self.fieldname in ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RREPLACES', 'RCONFLICTS']: 88 if self.fieldname in ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RREPLACES', 'RCONFLICTS']:
74 (depvera, depverb) = compare_pkg_lists(self.oldvalue, self.newvalue) 89 (depvera, depverb) = compare_pkg_lists(self.oldvalue, self.newvalue)
75 aitems = pkglist_combine(depvera) 90 aitems = pkglist_combine(depvera)
@@ -77,16 +92,29 @@ class ChangeRecord:
77 else: 92 else:
78 aitems = self.oldvalue.split() 93 aitems = self.oldvalue.split()
79 bitems = self.newvalue.split() 94 bitems = self.newvalue.split()
95 if self.fieldname == 'FILELIST':
96 renamed_dirs, aitems, bitems = detect_renamed_dirs(aitems, bitems)
97
80 removed = list(set(aitems) - set(bitems)) 98 removed = list(set(aitems) - set(bitems))
81 added = list(set(bitems) - set(aitems)) 99 added = list(set(bitems) - set(aitems))
82 100
101 lines = []
102 if renamed_dirs:
103 for dfrom, dto in renamed_dirs:
104 lines.append('directory renamed %s -> %s' % (dfrom, dto))
83 if removed or added: 105 if removed or added:
84 if removed and not bitems: 106 if removed and not bitems:
85 out = '%s: removed all items "%s"' % (self.fieldname, ' '.join(removed)) 107 lines.append('removed all items "%s"' % ' '.join(removed))
86 else: 108 else:
87 out = '%s:%s%s' % (self.fieldname, ' removed "%s"' % ' '.join(removed) if removed else '', ' added "%s"' % ' '.join(added) if added else '') 109 if removed:
110 lines.append('removed "%s"' % ' '.join(removed))
111 if added:
112 lines.append('added "%s"' % ' '.join(added))
88 else: 113 else:
89 out = '%s changed order' % self.fieldname 114 lines.append('changed order')
115
116 out = '%s: %s' % (self.fieldname, ', '.join(lines))
117
90 elif self.fieldname in numeric_fields: 118 elif self.fieldname in numeric_fields:
91 aval = int(self.oldvalue or 0) 119 aval = int(self.oldvalue or 0)
92 bval = int(self.newvalue or 0) 120 bval = int(self.newvalue or 0)