| 1 | #!/usr/bin/perl |
1 | #!/usr/bin/perl |
| 2 | |
2 | |
| 3 | use strict; |
3 | use strict; |
| 4 | use warnings; |
4 | use warnings; |
|
|
5 | |
|
|
6 | my $cvs_header_line = '\$' . 'CVSHeader'; |
| 5 | |
7 | |
| 6 | foreach my $arg (@ARGV) { |
8 | foreach my $arg (@ARGV) { |
| 7 | my ($conf_file, $dist_file); |
9 | my ($conf_file, $dist_file); |
| 8 | |
10 | |
| 9 | if ($arg =~ /^(.*)\.dist$/) { |
11 | if ($arg =~ /^(.*)\.dist$/) { |
| … | |
… | |
| 22 | if ($conf_version eq $dist_version) { |
24 | if ($conf_version eq $dist_version) { |
| 23 | print "$conf_file is up-to-date at version $conf_version.\n"; |
25 | print "$conf_file is up-to-date at version $conf_version.\n"; |
| 24 | next; |
26 | next; |
| 25 | } |
27 | } |
| 26 | |
28 | |
|
|
29 | print "conf_version=$conf_version dist_version=$dist_version\n"; |
| 27 | system "cvs diff -r '$conf_version' -r '$dist_version' '$dist_file'" |
30 | #system "cvs diff -r '$conf_version' -r '$dist_version' '$dist_file'" |
| 28 | . "| patch '$conf_file'"; |
31 | # . "| patch '$conf_file'"; |
| 29 | } |
32 | } |
| 30 | |
33 | |
| 31 | sub cvs_version { |
34 | sub cvs_version { |
| 32 | my ($file) = @_; |
35 | my ($file) = @_; |
| 33 | open my $fh, "<", $file or die "couldn't open $file for reading: $!\n"; |
36 | open my $fh, "<", $file or die "couldn't open $file for reading: $!\n"; |
| 34 | my $line; |
37 | my $line; |
| 35 | while (my $line = <$fh>) { |
38 | while (my $line = <$fh>) { |
| 36 | if ($line =~ /\$CVSHeader: .*?(1(?:\.\d+)+).*?\$/) { |
39 | if ($line =~ /$cvs_header_line.*?(1(?:\.\d+)+)/) { |
| 37 | return $1; |
40 | return $1; |
| 38 | } |
41 | } |
| 39 | } |
42 | } |
| 40 | } |
43 | } |