Updated CVS_README
[BackupPC.git] / makeDist
index 2679947..af1092a 100755 (executable)
--- a/makeDist
+++ b/makeDist
@@ -133,11 +133,18 @@ $errCnt += CheckConfigParams("conf/config.pl", $ConfVars, 0);
 
 $errCnt += CheckConfigParams("doc-src/BackupPC.pod", $ConfVars, 1);
 
+$errCnt += CheckMetaDataVsConfig($ConfVars, "lib/BackupPC/Config/Meta.pm");
+
+$errCnt += CheckEditorVsConfig($ConfVars, "lib/BackupPC/CGI/EditConfig.pm");
+
 #
 # These config parameters are not used in the code, so ignore them.
 #
 $ConfVars->{BackupPCUser} = 2;
 $ConfVars->{CgiDir}       = 2;
+$ConfVars->{TopDir}       = 2;
+$ConfVars->{LogDir}       = 2;
+$ConfVars->{ConfDir}      = 2;
 $ConfVars->{InstallDir}   = 2;
 $ConfVars->{CgiImageDir}  = 2;
 
@@ -399,6 +406,68 @@ sub CheckConfigParams
     return $errors;
 }
 
+sub CheckMetaDataVsConfig
+{
+    my($confVars, $file) = @_;
+    my $done = {};
+    my $errors;
+
+    #
+    # Check that the meta file mentions all the config
+    # parameters
+    #
+    open(F, $file) || die("can't open $file");
+
+    while ( <F> ) {
+        next if ( !/^\s{4}(\w+)\s+=>/ );
+        if ( $confVars->{$1} ) {
+            $done->{$1} = 1;
+            next;
+        }
+        next if ( $1 eq "Hosts" );
+        print("$file has $1 but missing from conf/config.pl\n");
+        $errors++;
+    }
+    close(F);
+    foreach my $v ( keys(%$confVars) ) {
+        next if ( $done->{$v} );
+        print("$file missing $v from conf/config.pl\n");
+        $errors++;
+    }
+    return $errors;
+}
+
+sub CheckEditorVsConfig
+{
+    my($confVars, $file) = @_;
+    my $done = {};
+    my $errors;
+
+    #
+    # Check that the config editor file mentions all the config
+    # parameters
+    #
+    open(F, $file) || die("can't open $file");
+
+    while ( <F> ) {
+        next if ( !/name\s*=>\s*"(\w+)"/ );
+        if ( $confVars->{$1} ) {
+            $done->{$1} = 1;
+            next;
+        }
+        next if ( $1 eq "Hosts" );
+        print("$file has $1 but missing from conf/config.pl\n");
+        $errors++;
+    }
+    close(F);
+    foreach my $v ( keys(%$confVars) ) {
+        next if ( $done->{$v} );
+        print("$file missing $v from conf/config.pl\n");
+        $errors++;
+    }
+    return $errors;
+}
+
 #
 # Make sure that every lang variable in cgi-bin/BackupPC_Admin matches
 # the strings in each lib/BackupPC/Lang/*.pm file.  This makes sure
@@ -418,6 +487,7 @@ sub CheckLangUsage
        while ( <F> ) {
            next if ( /^\s*#/ );
            s/\$Lang->{([^}]*)}/$vars->{$1} = 1;/eg;
+           s/(text|comment)\s*=>\s*"(CfgEdit_.*)"/$vars->{$2} = 1;/eg;
        }
        close(F);
     }
@@ -474,7 +544,11 @@ sub CheckLangTags
            my $t1 = LangTextStrip($v1->{val});
            my $t2 = LangTextStrip($v2->{val});
            if ( $t1 ne $t2 ) {
-               print("$v1->{var}: got en.pm $t1\nvs $lang $t2\n\n");
+                my $i;
+                for ( $i = 0 ; $i < length($t1) ; $i++ ) {
+                    last if ( substr($t1, 0, $i) ne substr($t2, 0, $i) );
+                }
+               print("$v1->{var}: ($i) got en.pm $t1\nvs $lang $t2\n\n");
                $errors++;
            }
        }