File: tixmerge

package info (click to toggle)
perl-tk 1%3A804.028-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 33,564 kB
  • ctags: 35,262
  • sloc: ansic: 349,396; perl: 51,360; sh: 17,904; makefile: 5,728; asm: 3,565; ada: 1,681; pascal: 1,089; cpp: 1,006; yacc: 883; cs: 879
file content (77 lines) | stat: -rwxr-xr-x 1,579 bytes parent folder | download | duplicates (14)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/local/bin/perl -w

use strict;

use File::Copy;
use File::Compare;

my $tdir = $ENV{'HOME'}."/tcl";
my $otcl = "$tdir/Tix4.1.0.003";
my $ntcl = "$tdir/Tix4.1.0.005";

open(FIXUP,">Fixup");

sub mergedir
{
 foreach (@_)
  {
   die "No $_\n" unless (-d $_);
  }
 my ($ptk,$old,$new) = @_;
 my %done;
 opendir(DIR,$new) || die "Cannot open $new:$!";
 my $file;
 while (defined($file = readdir(DIR)))
  {
   if ($file =~ /\.[ch]$/)
    {
     my $nf = "$new/$file";
     next unless -r $nf;
     my $of = "$old/$file";
     my $pf = "$ptk/$file";
     unless (-r $pf)
      {
       copy($nf,$pf);
       my $code = system('p4','add',$pf);
       die "Cannot add $pf\n" if $code;
       print "$pf added\n";
       next;
      }
     $of = "/dev/null" unless (-r $of);
     if (compare($of,$nf))
      {
       # Tcl/Tk version has changed
       if (compare($nf,$pf))
        {
         my $code = system('p4','edit',$pf);
         die "Cannot edit $pf\n" if $code;
         $code = system('merge',$pf,$of,$nf);
         if ($code)
          {
           print "$pf needs fixing\n";
           print FIXUP "$pf\n";
          }
         else
          {
           print "$pf merged okay\n";
          }
        }
       else
        {
         print "cmp $nf $pf - idential to source\n";
        }
      }
     else
      {
       print "cmp $of $nf - unchanged in source\n";
      }
    }
  }
 closedir(DIR);
}

mergedir("tixGeneric","$otcl/generic","$ntcl/generic");
mergedir("tixUnix","$otcl/unix","$ntcl/unix");
mergedir("tixWin","$otcl/win","$ntcl/win");

close(FIXUP);