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).
This commit is contained in:
Denver Gingerich 2011-05-20 11:24:13 -04:00
parent 31e2c78e8c
commit 1208e8b7da

View file

@ -188,8 +188,8 @@ foreach my $ii (@orgFiles, @comparedFiles) {
if defined $origH{$ii} and defined $comparedH{$ii}; if defined $origH{$ii} and defined $comparedH{$ii};
} }
my(@o, @c); my(@o, @c);
@o = keys %final; @o = sort(keys %final);
@c = keys %final; @c = sort(keys %final);
my $origFiles2sha1 = MD5SumFiles($origDir, \@o, $origTempFile); my $origFiles2sha1 = MD5SumFiles($origDir, \@o, $origTempFile);
my $comparedFiles2sha1 = MD5SumFiles($comparedDir, \@c, $comparedTempFile); 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"); system("/bin/echo 'File contents comparisons (diff):' >> $diffOutputFile 2>&1");
if ($DO_DIFF) { if ($DO_DIFF) {
foreach my $file (keys %final) { foreach my $file (sort(keys %final)) {
if ($origFiles2sha1->{$file} ne $comparedFiles2sha1->{$file}) { if ($origFiles2sha1->{$file} ne $comparedFiles2sha1->{$file}) {
system( system(
"/usr/bin/diff -u \"$origDir/$file\" \"$comparedDir/$file\" >> $diffOutputFile 2>&1"); "/usr/bin/diff -u \"$origDir/$file\" \"$comparedDir/$file\" >> $diffOutputFile 2>&1");