fix warning about rollback
[BackupPC.git] / makeDist
index 28071a2..ebc7a66 100755 (executable)
--- a/makeDist
+++ b/makeDist
 #
 #   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.
+#   Use the -nolangCheck option to turn off that behavior.
 #
 # AUTHOR
 #   Craig Barratt <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2001-2007  Craig Barratt
+#   Copyright (C) 2001-2010  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
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 #========================================================================
-#
 
 use strict;
 use File::Path;
 use File::Copy;
-use Getopt::Std;
+use Getopt::Long;
+use Data::Dumper;
+
 use lib "./lib";
 use BackupPC::Lib;
 use BackupPC::Config::Meta qw(:all);
@@ -53,10 +54,6 @@ die("BackupPC::Lib->new failed\n")
 
 umask(0022);
 
-my $Version     = "3.2.0";
-my $ReleaseDate = "31 Dec 2008";
-my $DistDir     = "dist/BackupPC-$Version";
-
 my @PerlSrc = qw(
     bin/BackupPC
     bin/BackupPC_archive
@@ -74,7 +71,6 @@ my @PerlSrc = qw(
     bin/BackupPC_tarExtract
     bin/BackupPC_tarCreate
     bin/BackupPC_tarPCCopy
-    bin/BackupPC_compressPool
     bin/BackupPC_zipCreate
     bin/BackupPC_zcat
     lib/BackupPC/Attrib.pm
@@ -107,6 +103,7 @@ my @PerlSrc = qw(
     lib/BackupPC/CGI/Summary.pm
     lib/BackupPC/CGI/View.pm
     lib/BackupPC/Config/Meta.pm
+    lib/BackupPC/Lang/cz.pm
     lib/BackupPC/Lang/de.pm
     lib/BackupPC/Lang/en.pm
     lib/BackupPC/Lang/es.pm
@@ -119,7 +116,6 @@ my @PerlSrc = qw(
     lib/BackupPC/Storage/Text.pm
     lib/BackupPC/Xfer.pm
     lib/BackupPC/Xfer/Archive.pm
-    lib/BackupPC/Xfer/BackupPCd.pm
     lib/BackupPC/Xfer/Ftp.pm
     lib/BackupPC/Xfer/Protocol.pm
     lib/BackupPC/Xfer/Rsync.pm
@@ -134,11 +130,32 @@ my @PerlSrc = qw(
 );
 
 my %opts;
-if ( !getopts("l", \%opts) || @ARGV != 0 ) {
-    print("usage: $0 [-l]\n");
+$opts{langCheck}   = 1;
+$opts{syntaxCheck} = 1;
+if ( !GetOptions(
+                 \%opts,
+                 "langCheck!",
+                 "syntaxCheck!",
+                 "version=s",
+                 "releasedate=s",
+           ) || @ARGV != 0
+             || !defined($opts{version})
+        ) {
+    print STDERR <<EOF;
+usage: $0 [--nolangCheck] [--nosyntaxCheck] [--releasedate 'DD MMM YYYY'] --version X.Y.Z
+EOF
     exit(1);
 }
 
+my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime();
+$year += 1900;
+
+my @month_abbr  = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
+
+my $Version     = $opts{version} || "3.2.0";
+my $ReleaseDate = $opts{releasedate} || "$mday $month_abbr[$mon] $year";
+my $DistDir     = "dist/BackupPC-$Version";
+
 #
 # Check config parameters
 #
@@ -174,14 +191,23 @@ $ConfVars->{BlackoutHourEnd}   = 2;
 $ConfVars->{BlackoutWeekDays}  = 2;
 $ConfVars->{RsyncLogLevel}     = 2;
 
-system("perl -Ilib -c conf/config.pl >& /dev/null")
-                && die("$0: conf/config.pl contains a syntax error\n");
+if ( $opts{syntaxCheck} ) {
+    system("perl -Ilib -c conf/config.pl >& /dev/null")
+            && die("$0: conf/config.pl contains a syntax error (or someone killed me)\n");
+}
 foreach my $file ( @PerlSrc ) {
-    system("perl -Ilib -c $file >& /dev/null")
-                && die("$0: $file contains a syntax error\n");
+    if ( $opts{syntaxCheck} ) {
+        system("perl -Ilib -c $file >& /dev/null")
+            && die("$0: $file contains a syntax error (or someone killed me)\n");
+    }
+    #
+    # Skip checking of bundled libraries not explicitly part of
+    # BackupPC
+    #
+    next if ( $file =~ m/lib\/Net\/FTP/ );
     $errCnt += CheckConfigParams($file, $ConfVars, 1);
 }
-if ( !$opts{l} ) {
+if ( !$opts{langCheck} ) {
     $errCnt += CheckLangUsage();
     $errCnt += CheckLangTags();
 }
@@ -218,6 +244,7 @@ foreach my $dir ( qw(bin doc conf images init.d/src cgi-bin httpd/src
 
 my %ConfName;
 my $ConfPod = config2pod();
+
 rmtree("doc", 0, 0);
 mkpath("doc", 0, 0777);
 InstallFile("doc-src/BackupPC.pod", "doc/BackupPC.pod");
@@ -232,6 +259,7 @@ pod2html("doc/BackupPC.pod",
 foreach my $file ( (@PerlSrc,
            <images/*.gif>,
            <images/*.png>,
+           <images/*.ico>,
            qw(
                conf/config.pl
                conf/hosts
@@ -241,6 +269,7 @@ foreach my $file ( (@PerlSrc,
                init.d/README
                init.d/src/debian-backuppc
                init.d/src/freebsd-backuppc
+               init.d/src/freebsd-backuppc2
                init.d/src/gentoo-backuppc
                init.d/src/gentoo-backuppc.conf
                init.d/src/linux-backuppc
@@ -274,7 +303,7 @@ sub InstallFile
     my($file, $dest) = @_;
 
     unlink($dest) if ( -d $dest );
-    if ( $file =~ /\.gif/ || $file =~ /\.png/ ) {
+    if ( $file =~ /\.gif/ || $file =~ /\.png/ || $file =~ /\.ico/ ) {
         die("can't copy($file, $dest)\n") unless copy($file, $dest);
     } else {
        open(FILE, $file)   || die("can't open $file for reading\n");
@@ -289,10 +318,10 @@ sub InstallFile
                #
                # fixup for conf links
                #
-               if ( !/A NAME="item_(%|_)conf/i ) {
+               if ( !/a name="_conf/i ) {
                    s/\$Conf{([^}]*)}/
                        defined($ConfName{$1})
-                           ? "\L<a href=\"#$ConfName{$1}\">\E\$Conf{$1}<\/A>"
+                           ? "\L<a href=\"#$ConfName{$1}\">\E\$Conf{$1}<\/a>"
                            : "\$Conf{$1}"/eg;
                }
                s/^<DD>/<DD><P>/;
@@ -368,7 +397,7 @@ sub config2pod
             push(@conf, $_);
             my $text = "_conf_${var}_";
             $text =~ s{[\W\s]}{_}g;
-            $ConfName{$var} = "item_$text";
+            $ConfName{$var} = "$text";
         } elsif ( /^$/ ) {
             if ( $str ne "" && @conf ) {
                 $out .= "=item " . join("\n\n=item ", @conf) . "\n\n";
@@ -573,7 +602,7 @@ sub CheckLangTags
     my($en, $enVars) = LangParse("lib/BackupPC/Lang/en.pm");
     my($errors);
 
-    foreach my $lang ( qw(fr.pm de.pm es.pm it.pm nl.pm pl.pm pt_br.pm zh_CN.pm) ) {
+    foreach my $lang ( qw(cz.pm fr.pm de.pm es.pm it.pm nl.pm pl.pm pt_br.pm zh_CN.pm) ) {
        my($d, $dVars) = LangParse("lib/BackupPC/Lang/$lang");
        foreach my $v1 ( @$en ) {
            my $v2 = shift(@$d);