Updated CVS_README
[BackupPC.git] / makeDist
index edc3c43..af1092a 100755 (executable)
--- a/makeDist
+++ b/makeDist
 #
 #           dist/BackupPC-$Version.tar.gz.
 #
+#   Often the language files are not up to date, and makeDist
+#   exits after complaining about the lang files being inconsistent.
+#   Use the -l option to turn off that behavior.
+#
 # AUTHOR
 #   Craig Barratt <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2001-2004  Craig Barratt
+#   Copyright (C) 2001-2006  Craig Barratt
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -42,15 +46,17 @@ use Getopt::Std;
 
 umask(0022);
 
-my $Version     = "2.1.0";
-my $ReleaseDate = "20 Jun 2004";
+my $Version     = "3.0.0alpha";
+my $ReleaseDate = "23 Jan 2006";
 my $DistDir     = "dist/BackupPC-$Version";
 
 my @PerlSrc = qw(
     bin/BackupPC
     bin/BackupPC_archive
     bin/BackupPC_archiveHost
+    bin/BackupPC_attribPrint
     bin/BackupPC_dump
+    bin/BackupPC_fixupBackupSummary
     bin/BackupPC_link
     bin/BackupPC_nightly
     bin/BackupPC_restore
@@ -59,19 +65,23 @@ my @PerlSrc = qw(
     bin/BackupPC_trashClean
     bin/BackupPC_tarExtract
     bin/BackupPC_tarCreate
+    bin/BackupPC_tarPCCopy
     bin/BackupPC_compressPool
     bin/BackupPC_zipCreate
     bin/BackupPC_zcat
     lib/BackupPC/Attrib.pm
+    lib/BackupPC/Config.pm
     lib/BackupPC/FileZIO.pm
     lib/BackupPC/Lib.pm
     lib/BackupPC/PoolWrite.pm
+    lib/BackupPC/Storage.pm
     lib/BackupPC/View.pm
     lib/BackupPC/CGI/AdminOptions.pm
     lib/BackupPC/CGI/Archive.pm
     lib/BackupPC/CGI/ArchiveInfo.pm
     lib/BackupPC/CGI/Browse.pm
     lib/BackupPC/CGI/DirHistory.pm
+    lib/BackupPC/CGI/EditConfig.pm
     lib/BackupPC/CGI/EmailSummary.pm
     lib/BackupPC/CGI/GeneralInfo.pm
     lib/BackupPC/CGI/HostInfo.pm
@@ -87,13 +97,17 @@ my @PerlSrc = qw(
     lib/BackupPC/CGI/StopServer.pm
     lib/BackupPC/CGI/Summary.pm
     lib/BackupPC/CGI/View.pm
+    lib/BackupPC/Config/Meta.pm
     lib/BackupPC/Lang/de.pm
     lib/BackupPC/Lang/en.pm
     lib/BackupPC/Lang/es.pm
     lib/BackupPC/Lang/fr.pm
     lib/BackupPC/Lang/it.pm
     lib/BackupPC/Lang/nl.pm
+    lib/BackupPC/Lang/pt_br.pm
+    lib/BackupPC/Storage/Text.pm
     lib/BackupPC/Xfer/Archive.pm
+    lib/BackupPC/Xfer/BackupPCd.pm
     lib/BackupPC/Xfer/Smb.pm
     lib/BackupPC/Xfer/Tar.pm
     lib/BackupPC/Xfer/Rsync.pm
@@ -119,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;
 
@@ -164,7 +185,9 @@ mkpath($DistDir, 0, 0777);
 
 foreach my $dir ( qw(bin doc conf images init.d/src cgi-bin
                     lib/BackupPC/CGI
+                    lib/BackupPC/Config
                     lib/BackupPC/Lang
+                    lib/BackupPC/Storage
                     lib/BackupPC/Xfer
                     lib/BackupPC/Zip
                ) ) {
@@ -195,6 +218,7 @@ foreach my $file ( (@PerlSrc,
                init.d/src/gentoo-backuppc
                init.d/src/gentoo-backuppc.conf
                init.d/src/linux-backuppc
+               init.d/src/slackware-backuppc
                init.d/src/solaris-backuppc
                init.d/src/suse-backuppc
                doc/BackupPC.pod
@@ -261,14 +285,16 @@ sub InstallFile
            } elsif ( /^use lib ".*BackupPC\/lib";/
                    || /^use lib "\/home\/pcbackup\/install\/lib";/ ) {
                print OUT "use lib \"__INSTALLDIR__/lib\";\n";
-           } elsif ( $file =~ /Lib.pm/ && /(.*TopDir *=> .*)'.*',/ ) {
-               print OUT "$1'__TOPDIR__',\n";
-           } elsif ( $file =~ /Lib.pm/ && /(.*Version *=> .*)'[\w\d\.]+',/ ) {
-               print OUT "$1'$Version',\n";
-           } elsif ( $file =~ /Lib.pm/ && /(.*BinDir *=> .*)'.*',/ ) {
-               print OUT "$1'__INSTALLDIR__',\n";
-           } elsif ( $file =~ /Lib.pm/ && /(.*LibDir *=> .*)'.*',/ ) {
-               print OUT "$1'__INSTALLDIR__',\n";
+           } elsif ( $file =~ /Lib.pm/ && /^(\s*\$topDir\s*=\s*)'.*'(\s*if\s.*)/ ) {
+               print OUT "$1'__TOPDIR__'$2\n";
+           } elsif ( $file =~ /Lib.pm/ && /^(\s*\$installDir\s*=\s*)'.*'(\s*if\s.*)/ ) {
+               print OUT "$1'__INSTALLDIR__'$2\n";
+            } elsif ( $file =~ /Lib.pm/ && /^(\s*my \$useFHS\s*=\s*)\d;/ ) {
+                print OUT "${1}0;\n";
+           } elsif ( $file =~ /configure.pl/ && /__CONFIGURE_BIN_LIST__/ ) {
+               print OUT "        ", join("\n        ", grep(/^bin\//, @PerlSrc)), "\n";
+           } elsif ( $file =~ /configure.pl/ && /__CONFIGURE_LIB_LIST__/ ) {
+               print OUT "        ", join("\n        ", grep(/^lib\//, @PerlSrc)), "\n";
            } elsif ( $file =~ /BackupPC_Admin/ && /(my *\$installDir *= *)'.*'/ ) {
                print OUT "$1'__INSTALLDIR__/lib';\n";
            } else {
@@ -363,7 +389,7 @@ sub CheckConfigParams
                 } else {
                     $vars->{$1}++;
                 }/eg;
-            s/UserCommandRun\("([^"]*)"\)/if ( !defined($vars->{$1}) ) {
+            s/UserCommandRun\("([^"]*)"/if ( !defined($vars->{$1}) ) {
                     print("Unexpected Conf var $1 in $file\n");
                     $errors++;
                 } else {
@@ -380,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
@@ -397,7 +485,9 @@ sub CheckLangUsage
        open(F, $file) || die("can't open $file");
        binmode(F);
        while ( <F> ) {
+           next if ( /^\s*#/ );
            s/\$Lang->{([^}]*)}/$vars->{$1} = 1;/eg;
+           s/(text|comment)\s*=>\s*"(CfgEdit_.*)"/$vars->{$2} = 1;/eg;
        }
        close(F);
     }
@@ -454,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++;
            }
        }