From 1208e8b7dac6add275893edfaae47a4a089b7818 Mon Sep 17 00:00:00 2001 From: Denver Gingerich Date: Fri, 20 May 2011 11:24:13 -0400 Subject: [PATCH] h-c: sort the list of files used for file compare Sorting the list of files used for file comparisons (MD5 sums and actually diffs) makes the output much easier to deal with, especially for C&CS checkers. It groups all the files in a given directory together so that one can more easily deal with all these files at once. This is useful for comparing differences in particular components, especially ones like BusyBox whose files exist mostly in a single directory and have the same checksums (since they all point to one binary). --- hierarchy-comparison | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hierarchy-comparison b/hierarchy-comparison index 3bfab2b..d3039f1 100755 --- a/hierarchy-comparison +++ b/hierarchy-comparison @@ -188,8 +188,8 @@ foreach my $ii (@orgFiles, @comparedFiles) { if defined $origH{$ii} and defined $comparedH{$ii}; } my(@o, @c); -@o = keys %final; -@c = keys %final; +@o = sort(keys %final); +@c = sort(keys %final); my $origFiles2sha1 = MD5SumFiles($origDir, \@o, $origTempFile); my $comparedFiles2sha1 = MD5SumFiles($comparedDir, \@c, $comparedTempFile); @@ -212,7 +212,7 @@ system("/bin/echo >> $diffOutputFile 2>&1"); system("/bin/echo 'File contents comparisons (diff):' >> $diffOutputFile 2>&1"); if ($DO_DIFF) { - foreach my $file (keys %final) { + foreach my $file (sort(keys %final)) { if ($origFiles2sha1->{$file} ne $comparedFiles2sha1->{$file}) { system( "/usr/bin/diff -u \"$origDir/$file\" \"$comparedDir/$file\" >> $diffOutputFile 2>&1");