def diff_efi(efi1_path, efi2_path): obj_file_splitters = ["obj-rel\\", "INTEL\\"] efi1 = efiparse.parse_file(efi1_path, obj_file_splitters) efi2 = efiparse.parse_file(efi2_path, obj_file_splitters) diff = efiparse.diff(efi1, efi2) # print("Diffing done") print(diff) diff.added.sort(key=lambda sym: sym.size, reverse=True) diff.removed.sort(key=lambda sym: sym.size, reverse=True) diff.changed.sort(key=lambda sym: sym.size_diff, reverse=True) print_seq(diff)
def diff_efi(efi1_path, efi2_path): obj_file_splitters = ["obj-rel\\", "INTEL\\"] efi1 = efiparse.parse_file(efi1_path, obj_file_splitters) efi2 = efiparse.parse_file(efi2_path, obj_file_splitters) diff = efiparse.diff(efi1, efi2) #print("Diffing done") s = str(diff) diff.added.sort(key=lambda sym: sym.size, reverse=True) diff.removed.sort(key=lambda sym: sym.size, reverse=True) diff.changed.sort(key=lambda sym: sym.size_diff, reverse=True) s = s + diff_as_str(diff) return s
def build_and_upload_efi_txt_diff(ver): prev_ver = previous_successful_build_ver(ver) if 0 == prev_ver: return efi_path_curr = get_efi_out(ver) if not efi_path_curr: print("didn't find efi output for %s" % str(ver)) return efi_path_prev = get_efi_out(prev_ver) if not efi_path_prev: print("didn't find efi output for %s" % str(prev_ver)) return obj_file_splitters = ["obj-rel\\", "INTEL\\"] efi1 = efiparse.parse_file(efi_path_prev, obj_file_splitters) efi2 = efiparse.parse_file(efi_path_curr, obj_file_splitters) diff = efiparse.diff(efi1, efi2) s = str(diff) s = s + "\n" + efi_diff_as_txt(diff) s3dir = "sumatrapdf/buildbot/%s/" % str(ver) s3.upload_data_public_with_content_type(s, s3dir + "efi_diff.txt", silent=True)
def main(): # early checks assert os.path.exists(sum_efi_dir()), "Need %s directory" % sum_efi_dir() verify_efi_present() if len(sys.argv) != 3: usage() svn_ver1 = int(sys.argv[1]) svn_ver2 = int(sys.argv[2]) if svn_ver1 == svn_ver2: print("Versions have to be different!") usage() print("Comparing %d to %d" % (svn_ver1, svn_ver2)) build_ver(svn_ver1) build_efi_result(svn_ver1) build_ver(svn_ver2) build_efi_result(svn_ver2) efi1 = efiparse.parse_file(efi_result_file(svn_ver1)) efi2 = efiparse.parse_file(efi_result_file(svn_ver2)) diff = efiparse.diff(efi1, efi2) #print("Diffing done") print(diff) diff.added.sort(key=lambda sym: sym.size, reverse=True) added = diff.added[:30] if len(added) > 0: print("\nAdded symbols:") for sym in added: #sym = diff.syms2.name_to_sym[sym_name] size = sym.size print("%4d : %s" % (size, sym.name)) changed = diff.changed[:20] if len(changed) > 0: print("\nChanged symbols:") for sym_name in changed: print("%s" % sym_name)