X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=makeDist;h=c247b84b18f484dc0c3270fdba2f002d9aa8fb83;hp=26799479eaef30bfbc31e07e5d8a0c6102122417;hb=fda25dc88a63ccac1c80efa2e4994bf0725ca9b7;hpb=523fdef21f0ca0d691a0b8c95ca76b18a1adb60a diff --git a/makeDist b/makeDist index 2679947..c247b84 100755 --- a/makeDist +++ b/makeDist @@ -20,7 +20,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2006 Craig Barratt +# Copyright (C) 2001-2007 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 @@ -43,17 +43,25 @@ 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.1.0"; +my $ReleaseDate = "25 Nov 2007"; my $DistDir = "dist/BackupPC-$Version"; my @PerlSrc = qw( bin/BackupPC bin/BackupPC_archive bin/BackupPC_archiveHost + bin/BackupPC_archiveStart bin/BackupPC_attribPrint bin/BackupPC_dump bin/BackupPC_fixupBackupSummary @@ -92,6 +100,7 @@ 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 @@ -104,7 +113,9 @@ my @PerlSrc = qw( lib/BackupPC/Lang/fr.pm lib/BackupPC/Lang/it.pm lib/BackupPC/Lang/nl.pm + lib/BackupPC/Lang/pl.pm lib/BackupPC/Lang/pt_br.pm + lib/BackupPC/Lang/zh_CN.pm lib/BackupPC/Storage/Text.pm lib/BackupPC/Xfer/Archive.pm lib/BackupPC/Xfer/BackupPCd.pm @@ -133,13 +144,21 @@ $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; +$ConfVars->{ClientCharsetLegacy} = 2; # actually used # # These config parameters are used in the code to be backward compatible, @@ -201,13 +220,17 @@ pod2html("doc/BackupPC.pod", "--outfile=doc/BackupPC.html"); foreach my $file ( (@PerlSrc, - , + , + , qw( conf/config.pl conf/hosts conf/BackupPC_stnd.css + conf/BackupPC_stnd_orig.css + conf/sorttable.js init.d/README init.d/src/debian-backuppc + init.d/src/freebsd-backuppc init.d/src/gentoo-backuppc init.d/src/gentoo-backuppc.conf init.d/src/linux-backuppc @@ -240,7 +263,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"); @@ -253,24 +276,15 @@ sub InstallFile s/__RELEASEDATE__/$ReleaseDate/g; if ( $file =~ /BackupPC\.html$/ ) { # - # fixup for perl 5.6.x + # fixup for conf links # - if ( !/A NAME="item_(%|_)24Conf/i ) { + if ( !/A NAME="item_(%|_)conf/i ) { s/\$Conf{([^}]*)}/ defined($ConfName{$1}) - ? "\L\E\$Conf{$1}<\/A>" + ? "\L\E\$Conf{$1}<\/A>" : "\$Conf{$1}"/eg; } - s/<(A NAME="item_(%|_)24Conf(%|_)7B(.*?)(%|_)7D).*?">/\L/ig; s/^
/

/; - # - # Fixup for perl 5.8.x first one no longer needed after - # fix in CSS) - # -# if ( /^<\/dt>/ ) { -# $_ .= ; -# s/^(<\/dt>\n

)/$1

/s; -# } s/^

  • <\/li>/
  • /; } if ( /__CONFIGPOD__/ ) { @@ -282,8 +296,12 @@ sub InstallFile 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*ConfDir\s*=\>\s*\$confDir eq.*)'.*'(.*)/ ) { + print OUT "$1'__CONFDIR__'$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__/ ) { @@ -337,10 +355,8 @@ sub config2pod s/([^;])\s*$/$1 .../; } push(@conf, $_); - my $text = "\$Conf{$var}"; - $text =~ s/\s+/_/sg; - $text =~ s{(\W)}{sprintf("%%%02X", ord($1) )}gxe; - $text = substr($text, 0, 50); + my $text = "_conf_${var}_"; + $text =~ s{[\W\s]}{_}g; $ConfName{$var} = "item_$text"; } elsif ( /^$/ ) { if ( $str ne "" && @conf ) { @@ -399,6 +415,87 @@ 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 ( ) { + 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 ( ) { + 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 @@ -411,13 +508,15 @@ sub CheckLangUsage foreach my $file ( ( qw(cgi-bin/BackupPC_Admin bin/BackupPC_sendEmail), - + , + , ) ) { open(F, $file) || die("can't open $file"); binmode(F); while ( ) { next if ( /^\s*#/ ); s/\$Lang->{([^}]*)}/$vars->{$1} = 1;/eg; + s/(text|comment)\s*=>\s*"(CfgEdit_.*)"/$vars->{$2} = 1;/eg; } close(F); } @@ -430,7 +529,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"); @@ -463,7 +562,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) ) { + foreach my $lang ( qw(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); @@ -474,7 +573,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++; } }