Skip to content

Commit 75c175a

Browse files
committed
REL: add more detail to md5 comparison
1 parent 298b951 commit 75c175a

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

chb/cmdline/relationalcmds.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,17 +748,46 @@ def relational_compare_md5s_cmd(args: argparse.Namespace) -> NoReturn:
748748
elif comparison[f] == "new":
749749
newfns.append(f)
750750

751+
md5sdict: Dict[str, Tuple[List[str], List[str]]] = {}
752+
753+
for (f, md5) in md5s1.items():
754+
md5sdict.setdefault(md5, ([], []))
755+
md5sdict[md5][0].append(f)
756+
757+
for (f, md5) in md5s2.items():
758+
md5sdict.setdefault(md5, ([], []))
759+
md5sdict[md5][1].append(f)
760+
751761
print("Md5 comparison")
752762
print("=" * 80)
753763
print("Equal: " + str(eqcount))
754764
print("")
755-
print("Different: " + ", ".join(neq))
765+
print("Different: " + str(len(neq)) + "\n" + ", ".join(neq))
756766
print("")
757-
print("Missing: " + ", ".join(missing))
767+
print("Missing: " + str(len(missing)) + "\n" + ", ".join(missing))
758768
print("")
759-
print("New functions: " + ", ".join(newfns))
769+
print("New functions: " + str(len(newfns)) + "\n" + ", ".join(newfns))
760770
print("")
761771

772+
print("\nmd5 mapping")
773+
for (md5, t) in sorted(md5sdict.items()):
774+
print(md5 + " " + str(t))
775+
776+
count = 0
777+
countall = 0
778+
print("\nmd5s that appear in both")
779+
for (md5, t) in sorted(md5sdict.items()):
780+
if len(t[0]) > 0 and len(t[1]) > 0:
781+
count += 1
782+
if len(t[0]) == len(t[1]):
783+
countall += len(t[0])
784+
else:
785+
print(" *** lengths are different")
786+
print(str(t[0]) + " ===> " + str(t[1]))
787+
788+
print("\nPartial matches: " + str(count))
789+
print("All matches: " + str(countall))
790+
762791
exit(0)
763792

764793

0 commit comments

Comments
 (0)