File: compare

package info (click to toggle)
fsvs 1.1.16-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,344 kB
  • ctags: 1,133
  • sloc: ansic: 14,472; sh: 6,793; perl: 631; makefile: 337
file content (47 lines) | stat: -rwxr-xr-x 1,094 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl

$s=shift;
$d=shift;
($s && $d) || die "Which directories to compare???\n";

# !! crashes syntax highlightning in vim
$expect_fail= ! !(shift());

# find /tmp/fsvs-test-1000/wc-1/ -printf "% y%04m %7s %5G %5U %T+ %P\0\t%l\0\n"
# strace -o /tmp/asdga -f -tt 
$cmd=qq'LANG=C rsync -ain --delete "$s" "$d" -c';
@changes=();
for (`$cmd`)
{
# Ignore empty lines.
	next if m(^\s*$);

# ignore root directory
  next if m(\.d......... \./\s*$);

# ignore mtime of links
  next if m(\.L\.\.t\.\.\.\.\.\. .* -> );

# everything else is a change.
	push @changes, $_;
#.L..t...... typechange/device-symlink -> device-1
#>fc........ typechange/dir-file
#.L..t...... typechange/file-symlink -> file-1
#cL+++++++++ typechange/symlink-symlink -> symlink-1
}

$SIG{"__DIE__"} = sub { print STDERR '$ ',$cmd,"\n",@changes,@_; exit 1; };

if ($expect_fail && @changes)
{
	print "----- expected differences\n";
# pass output for further processing
	print @changes;
	exit 0;
}

die "----- Differences were found\n" if @changes;

print "----- comparison of directory gave no differences\n";
exit 0;