use File::Path;
use File::Copy;
use Getopt::Std;
+use lib "./lib";
+use BackupPC::Lib;
+use BackupPC::Config::Meta qw(:all);
+
+my $bpc;
+die("BackupPC::Lib->new failed\n")
+ if ( !($bpc = BackupPC::Lib->new(".", ".", "./conf", 1)) );
umask(0022);
-my $Version = "3.0.0alpha";
-my $ReleaseDate = "23 Jan 2006";
+my $Version = "3.0.0beta1";
+my $ReleaseDate = "30 Jul 2006";
my $DistDir = "dist/BackupPC-$Version";
my @PerlSrc = qw(
lib/BackupPC/CGI/RestoreFile.pm
lib/BackupPC/CGI/RestoreInfo.pm
lib/BackupPC/CGI/Restore.pm
+ lib/BackupPC/CGI/RSS.pm
lib/BackupPC/CGI/StartServer.pm
lib/BackupPC/CGI/StartStopBackup.pm
lib/BackupPC/CGI/StopServer.pm
$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.
#
print OUT "$1'__INSTALLDIR__'$2\n";
} elsif ( $file =~ /Lib.pm/ && /^(\s*my \$useFHS\s*=\s*)\d;/ ) {
print OUT "${1}0;\n";
+ } elsif ( $file =~ /Lib.pm/ && /(.*Version *=> .*)'[\w\d\.]+',/ ) {
+ print OUT "$1'$Version',\n";
} elsif ( $file =~ /configure.pl/ && /__CONFIGURE_BIN_LIST__/ ) {
print OUT " ", join("\n ", grep(/^bin\//, @PerlSrc)), "\n";
} elsif ( $file =~ /configure.pl/ && /__CONFIGURE_LIB_LIST__/ ) {
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++;
+ }
+
+ #
+ # Do extra checks that the CgiUserConfigEdit hash in the Meta
+ # file matches the config file
+ #
+ foreach my $p ( keys(%{$ConfigMeta{CgiUserConfigEdit}{child}}) ) {
+ if ( !defined($bpc->{Conf}{CgiUserConfigEdit}{$p}) ) {
+ print("lib/BackupPC/Config/Meta.pm has $p in CgiUserConfigEdit,"
+ . " but conf/config.pl CgiUserConfigEdit does not\n");
+ $errors++;
+ }
+ }
+ foreach my $p ( keys(%{$bpc->{Conf}{CgiUserConfigEdit}}) ) {
+ if ( !defined($ConfigMeta{CgiUserConfigEdit}{child}{$p}) ) {
+ print("conf/config.pl CgiUserConfigEdit has $p, but"
+ . " lib/BackupPC/Config/Meta.pm does not\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
foreach my $file ( (
qw(cgi-bin/BackupPC_Admin bin/BackupPC_sendEmail),
- <lib/BackupPC/CGI/*pm>
+ <lib/BackupPC/CGI/*pm>,
+ <lib/BackupPC/Lang/en.pm>,
) ) {
open(F, $file) || die("can't open $file");
binmode(F);