X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=makeDist;h=2e9e8841130e13aa6b0909a885ff3e48a7d46b95;hp=ad21c6f263a1492f7a6f16e8ec7ba1de246b4cfa;hb=1015740e2b58fc43d7cf49881f190a9612e73fff;hpb=3f3d4f4adbd990e15969d9cbc5e99e89e613e502 diff --git a/makeDist b/makeDist index ad21c6f..2e9e884 100755 --- a/makeDist +++ b/makeDist @@ -1,4 +1,4 @@ -#!/bin/perl +#!/usr/bin/env perl # # makeDist: Build a BackupPC distribution # @@ -14,7 +14,7 @@ # # 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 @@ -37,12 +37,13 @@ # 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,14 +54,11 @@ die("BackupPC::Lib->new failed\n") umask(0022); -my $Version = "3.1.0"; -my $ReleaseDate = "15 Apr 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 @@ -73,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 @@ -112,25 +109,52 @@ 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.pm lib/BackupPC/Xfer/Archive.pm - lib/BackupPC/Xfer/BackupPCd.pm - lib/BackupPC/Xfer/Smb.pm - lib/BackupPC/Xfer/Tar.pm + lib/BackupPC/Xfer/Ftp.pm + lib/BackupPC/Xfer/Protocol.pm lib/BackupPC/Xfer/Rsync.pm lib/BackupPC/Xfer/RsyncDigest.pm lib/BackupPC/Xfer/RsyncFileIO.pm + lib/BackupPC/Xfer/Smb.pm + lib/BackupPC/Xfer/Tar.pm lib/BackupPC/Zip/FileMember.pm + lib/Net/FTP/AutoReconnect.pm + lib/Net/FTP/RetrHandle.pm cgi-bin/BackupPC_Admin ); 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 <{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, @@ -165,10 +190,23 @@ $ConfVars->{BlackoutHourEnd} = 2; $ConfVars->{BlackoutWeekDays} = 2; $ConfVars->{RsyncLogLevel} = 2; +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 ) { + 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(); } @@ -191,13 +229,14 @@ if ( $errCnt ) { rmtree($DistDir, 0, 0); mkpath($DistDir, 0, 0777); -foreach my $dir ( qw(bin doc conf images init.d/src cgi-bin +foreach my $dir ( qw(bin doc conf images init.d/src cgi-bin httpd/src lib/BackupPC/CGI lib/BackupPC/Config lib/BackupPC/Lang lib/BackupPC/Storage lib/BackupPC/Xfer lib/BackupPC/Zip + lib/Net/FTP ) ) { mkpath("$DistDir/$dir", 0, 0777); } @@ -227,12 +266,14 @@ 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 init.d/src/slackware-backuppc init.d/src/solaris-backuppc init.d/src/suse-backuppc + httpd/src/BackupPC.conf doc/BackupPC.pod doc/BackupPC.html README @@ -292,6 +333,8 @@ 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\.]+',/ ) { @@ -556,7 +599,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 pt_br.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);