| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
use strict; |
| 4 |
|
| 5 |
use File::Copy; |
| 6 |
use File::Compare; |
| 7 |
|
| 8 |
my $tdir = $ENV{'HOME'}."/tcl"; |
| 9 |
my $otcl = "$tdir/Tix4.1.0.003"; |
| 10 |
my $ntcl = "$tdir/Tix4.1.0.005"; |
| 11 |
|
| 12 |
open(FIXUP,">Fixup"); |
| 13 |
|
| 14 |
sub mergedir |
| 15 |
{ |
| 16 |
foreach (@_) |
| 17 |
{ |
| 18 |
die "No $_\n" unless (-d $_); |
| 19 |
} |
| 20 |
my ($ptk,$old,$new) = @_; |
| 21 |
my %done; |
| 22 |
opendir(DIR,$new) || die "Cannot open $new:$!"; |
| 23 |
my $file; |
| 24 |
while (defined($file = readdir(DIR))) |
| 25 |
{ |
| 26 |
if ($file =~ /\.[ch]$/) |
| 27 |
{ |
| 28 |
my $nf = "$new/$file"; |
| 29 |
next unless -r $nf; |
| 30 |
my $of = "$old/$file"; |
| 31 |
my $pf = "$ptk/$file"; |
| 32 |
unless (-r $pf) |
| 33 |
{ |
| 34 |
copy($nf,$pf); |
| 35 |
my $code = system('p4','add',$pf); |
| 36 |
die "Cannot add $pf\n" if $code; |
| 37 |
print "$pf added\n"; |
| 38 |
next; |
| 39 |
} |
| 40 |
$of = "/dev/null" unless (-r $of); |
| 41 |
if (compare($of,$nf)) |
| 42 |
{ |
| 43 |
# Tcl/Tk version has changed |
| 44 |
if (compare($nf,$pf)) |
| 45 |
{ |
| 46 |
my $code = system('p4','edit',$pf); |
| 47 |
die "Cannot edit $pf\n" if $code; |
| 48 |
$code = system('merge',$pf,$of,$nf); |
| 49 |
if ($code) |
| 50 |
{ |
| 51 |
print "$pf needs fixing\n"; |
| 52 |
print FIXUP "$pf\n"; |
| 53 |
} |
| 54 |
else |
| 55 |
{ |
| 56 |
print "$pf merged okay\n"; |
| 57 |
} |
| 58 |
} |
| 59 |
else |
| 60 |
{ |
| 61 |
print "cmp $nf $pf - idential to source\n"; |
| 62 |
} |
| 63 |
} |
| 64 |
else |
| 65 |
{ |
| 66 |
print "cmp $of $nf - unchanged in source\n"; |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
closedir(DIR); |
| 71 |
} |
| 72 |
|
| 73 |
mergedir("tixGeneric","$otcl/generic","$ntcl/generic"); |
| 74 |
mergedir("tixUnix","$otcl/unix","$ntcl/unix"); |
| 75 |
mergedir("tixWin","$otcl/win","$ntcl/win"); |
| 76 |
|
| 77 |
close(FIXUP); |