h-c: add headings for each type of comparison
Without headings, it's non-obvious which sections correspond to which comparisons in the output file. This information was printed to standard output, but not to the output file. So I added this information to the output file as well. My knowledge of Perl is limited so I just used system("/bin/echo .."); for now. It would be good to fix that later. I've added a copyright notice for myself, since this change is probably significant enough to be copyrightable.
This commit is contained in:
parent
19e762da5f
commit
b04949af1a
1 changed files with 15 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
# hierarchy-comparison -*- Perl -*-
|
||||
# Possible bug: only -type f and -type d are checked
|
||||
# Copyright (C) 2001, 2002, 2003, 2004, 2008 Bradley M. Kuhn <bkuhn@ebb.org>
|
||||
# Copyright (C) 2011 Denver Gingerich <denver@ossguy.com>
|
||||
#
|
||||
# This software's license gives you freedom; you can copy, convey,
|
||||
# propogate, redistribute and/or modify this program under the terms of
|
||||
|
@ -122,6 +123,8 @@ my(@comparedNonRegular) = FindAndSortOutput("NON-REGULAR", $comparedDir,
|
|||
$comparedTempFile, $ignoreRegex,
|
||||
"^/?($origDir|$comparedDir)/?");
|
||||
|
||||
# TODO: use the right Perl mechanism instead of /bin/echo (ossguy)
|
||||
system("/bin/echo Directory comparison: >> $diffOutputFile 2>&1");
|
||||
system(
|
||||
"/usr/bin/diff -u $origTempFile $comparedTempFile >> $diffOutputFile 2>&1");
|
||||
|
||||
|
@ -147,6 +150,10 @@ my(@orgFiles) = FindAndSortOutput("FILES", $origDir, $origTempFile,
|
|||
my(@comparedFiles) = FindAndSortOutput("FILES", $comparedDir,
|
||||
$comparedTempFile, $ignoreRegex, "^/?($origDir|$comparedDir)/?");
|
||||
|
||||
# TODO: use the right Perl mechanism instead of /bin/echo (ossguy)
|
||||
system("/bin/echo >> $diffOutputFile 2>&1");
|
||||
system("/bin/echo File hierarchy comparison: >> $diffOutputFile 2>&1");
|
||||
|
||||
system(
|
||||
"/usr/bin/diff -u $origTempFile $comparedTempFile >> $diffOutputFile 2>&1");
|
||||
|
||||
|
@ -187,12 +194,20 @@ my(@o, @c);
|
|||
my $origFiles2sha1 = MD5SumFiles($origDir, \@o, $origTempFile);
|
||||
my $comparedFiles2sha1 = MD5SumFiles($comparedDir, \@c, $comparedTempFile);
|
||||
|
||||
# TODO: use the right Perl mechanism instead of /bin/echo (ossguy)
|
||||
system("/bin/echo >> $diffOutputFile 2>&1");
|
||||
system("/bin/echo 'File contents comparisons (MD5):' >> $diffOutputFile 2>&1");
|
||||
|
||||
system(
|
||||
"/usr/bin/diff -u $origTempFile $comparedTempFile >> $diffOutputFile 2>&1");
|
||||
|
||||
$diffExitCode = $?;
|
||||
unlink($origTempFile, $comparedTempFile);
|
||||
|
||||
# TODO: use the right Perl mechanism instead of /bin/echo (ossguy)
|
||||
system("/bin/echo >> $diffOutputFile 2>&1");
|
||||
system("/bin/echo 'File contents comparisons (diff):' >> $diffOutputFile 2>&1");
|
||||
|
||||
if ($DO_DIFF) {
|
||||
foreach my $file (keys %final) {
|
||||
if ($origFiles2sha1->{$file} ne $comparedFiles2sha1->{$file}) {
|
||||
|
|
Loading…
Reference in a new issue