/[d-i]/trunk/installer/doc/manual/doc-check
ViewVC logotype

Contents of /trunk/installer/doc/manual/doc-check

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15196 - (show annotations) (download)
Wed May 12 06:29:39 2004 UTC (9 years ago) by fjpop-guest
File size: 2920 byte(s)
Manual: correction in doc-check; thanks to KURASAWA Nozomu
1 #!/usr/bin/perl -w
2
3 # This script checks if the translations of the documents are up to date.
4 # When called with "-d" option, it also prints what has changed in the
5 # original since last translation
6 # When called with "-s" option, it also shows all files that are marked
7 # untranslated
8
9 # SYNOPSIS:
10 # ./doc-check [-d] [-s] [-v] [-V] [lang]
11 #
12 # (uses $lang set below if lang is not given on commandline)
13
14 use Getopt::Std;
15 use File::Find;
16 $opt_d = $opt_s = $opt_v = $opt_V = 0;
17 getopts('dsvV');
18 # You may set this to your default language code
19 $lang = shift || "pl";
20
21 sub checkdiff
22 {
23 my ($plfname, $enfname) = (@_);
24 my ($plrev, $enrev, $untrans) = getrev($plfname, $enfname);
25 $plrev and $enrev or return;
26 if ( "$plrev" ne "$enrev" ) {
27 if ($untrans) {
28 print "$enfname : $plrev -> $enrev (untranslated)\n";
29 } else {
30 print "$enfname : $plrev -> $enrev\n";
31 }
32 if ($opt_d) {
33 my $s = "svn diff -r $plrev:$enrev $enfname";
34 warn "running $s:\n" if ($opt_V);
35 system($s);
36 }
37 } else {
38 if ($untrans && $opt_s) {
39 print "$plfname: untranslated\n";
40 }
41 }
42 }
43
44 sub getrev
45 {
46 my ($plfname, $enfname) = (@_);
47 my ($plrev, $enrev, $untrans, $notconverted) = (0, 0, 0, 0);
48
49 warn "checking $plfname:\n" if $opt_v;
50 open FILE, $plfname or warn "$plfname: $!\n" and return;
51 while (<FILE>) {
52 if (/<!--\s*original version\D*([\d\.]+)\s*-->/) {
53 $plrev = $1;
54 last;
55 }
56 if (/<!--\s*original version\D*(\d+)\s*untranslated\s*-->/) {
57 $plrev = $1;
58 $untrans = 1;
59 last;
60 }
61 # Also check for revision comments of original documents
62 if (/<!--\s*\$Id: \S+ (\d+) /) {
63 $plrev = $1;
64 $notconverted = 1;
65 $untrans = 1;
66 last;
67 }
68 # Also support CVS style revision comments (depreciated)
69 if (/<!--\s*original document: en\/\S+, revision ([\d\.]+)\s*-->/) {
70 $plrev = $1;
71 last;
72 }
73 }
74 warn "checking $enfname:\n" if $opt_v;
75 open FILE, $enfname or warn "$enfname: $!\n" and return;
76 while (<FILE>) {
77 if (/\$Id: \S+ (\d+) /) {
78 $enrev = $1;
79 last;
80 }
81 # Also support CVS style revision comments (depreciated)
82 if (/\$Revision: (\d+) \$/) {
83 $enrev = $1;
84 last;
85 }
86 }
87 close FILE;
88 warn "failed to find revision for $plfname\n" unless $plrev;
89 warn "failed to find revision for $enfname\n" unless $enrev;
90 if ($notconverted) {
91 warn "$plfname: contains revision comment for original document\n";
92 warn " use 'rev-update' to convert\n";
93 }
94 return ($plrev, $enrev, $untrans);
95 }
96
97 sub process
98 {
99 my $enfname = $File::Find::name;
100 return unless $enfname =~ m/\.xml$/;
101 my $plfname = $enfname;
102 $plfname =~ s,^en/,$lang/,;
103 checkdiff($plfname, $enfname);
104 }
105 File::Find::find({ wanted => \&process, no_chdir => 1 }, 'en');
106 checkdiff("build/install.$lang.xml", "build/install.en.xml");
107 #checkdiff("release-notes.$lang.sgml","release-notes.sgml");
108 #checkdiff("index.$lang.html.m4","index.en.html.m4");
109 #checkdiff("dselect-beginner.$lang.sgml","dselect-beginner.sgml");

Properties

Name Value
svn:executable *
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.5