Updates in preparation for 3.0.0beta2:
[BackupPC.git] / makeDist
index fc16eef..2234b5d 100755 (executable)
--- a/makeDist
+++ b/makeDist
@@ -43,11 +43,18 @@ use strict;
 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.0beta2";
+my $ReleaseDate = "11 Nov 2006";
 my $DistDir     = "dist/BackupPC-$Version";
 
 my @PerlSrc = qw(
@@ -209,11 +216,13 @@ pod2html("doc/BackupPC.pod",
         "--outfile=doc/BackupPC.html");
 
 foreach my $file ( (@PerlSrc,
-           <images/*>,
+           <images/*.gif>,
+           <images/*.png>,
            qw(
                conf/config.pl
                conf/hosts
                conf/BackupPC_stnd.css
+               conf/BackupPC_stnd_orig.css
                init.d/README
                init.d/src/debian-backuppc
                init.d/src/gentoo-backuppc
@@ -248,7 +257,7 @@ sub InstallFile
     my($file, $dest) = @_;
 
     unlink($dest) if ( -d $dest );
-    if ( $file =~ /\.gif/ ) {
+    if ( $file =~ /\.gif/ || $file =~ /\.png/ ) {
         die("can't copy($file, $dest)\n") unless copy($file, $dest);
     } else {
        open(FILE, $file)   || die("can't open $file for reading\n");
@@ -292,6 +301,8 @@ sub InstallFile
                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__/ ) {
@@ -435,6 +446,25 @@ sub CheckMetaDataVsConfig
         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;
 }
 
@@ -481,7 +511,8 @@ sub CheckLangUsage
 
     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);
@@ -501,7 +532,7 @@ sub CheckLangUsage
             s/#.*//g;
             s/\$Lang{([^}]*)}/
                    my $var = $1;
-                   next if ( $var =~ m{^(Reason_|Status_|backupType_)} );
+                   next if ( $var =~ m{^(Reason_|Status_|backupType_|Disabled_)} );
                    next if ( $var eq "Documentation" );
                     if ( !defined($vars->{$var}) ) {
                         print("Unexpected Lang var $var in $f\n");