X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FTar.pm;h=24df54b1901cdb3e56f6e74680a025b1eee9ae18;hp=8cc2c0f8abb66b0fb908ae17e695ce63bd7c56b4;hb=f9796d809e6a7d4ed2c356f0f32f1a3d628d3d1f;hpb=e4bf7ab080e172b74b3d64c196a72d0ff5d315c5 diff --git a/lib/BackupPC/Xfer/Tar.pm b/lib/BackupPC/Xfer/Tar.pm index 8cc2c0f..24df54b 100644 --- a/lib/BackupPC/Xfer/Tar.pm +++ b/lib/BackupPC/Xfer/Tar.pm @@ -11,7 +11,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2003 Craig Barratt +# Copyright (C) 2001-2009 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 @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta3, released 3 Dec 2006. +# Version 3.2.0, released 31 Jul 2010. # # See http://backuppc.sourceforge.net. # @@ -39,35 +39,7 @@ package BackupPC::Xfer::Tar; use strict; use Encode qw/from_to encode/; - -sub new -{ - my($class, $bpc, $args) = @_; - - $args ||= {}; - my $t = bless { - bpc => $bpc, - conf => { $bpc->Conf }, - host => "", - hostIP => "", - shareName => "", - pipeRH => undef, - pipeWH => undef, - badFiles => [], - %$args, - }, $class; - - return $t; -} - -sub args -{ - my($t, $args) = @_; - - foreach my $arg ( keys(%$args) ) { - $t->{$arg} = $args->{$arg}; - } -} +use base qw(BackupPC::Xfer::Protocol); sub useTar { @@ -101,8 +73,7 @@ sub start if ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) { - $file = $2 if ( $file =~ m{^(\./+|/+)(.*)}s ); - $file = "./$file"; + $file = "./$2" if ( $file =~ m{^(\./+|/+)(.*)}s ); $file = encode($conf->{ClientCharset}, $file) if ( $conf->{ClientCharset} ne "" ); push(@fileList, "--exclude=$file"); @@ -244,7 +215,7 @@ sub readOutput # # Ignore annoying log message on incremental for tar 1.15.x # - if ( !/: file is unchanged; not dumped$/ ) { + if ( !/: file is unchanged; not dumped$/ && !/: socket ignored$/ ) { $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{xferErrCnt}++; } @@ -271,18 +242,6 @@ sub readOutput return 1; } -sub abort -{ - my($t, $reason) = @_; - my @xferPid = $t->xferPid; - - $t->{abort} = 1; - $t->{abortReason} = $reason; - if ( @xferPid ) { - kill($t->{bpc}->sigName2num("INT"), @xferPid); - } -} - sub setSelectMask { my($t, $FDreadRef) = @_; @@ -290,53 +249,4 @@ sub setSelectMask vec($$FDreadRef, fileno($t->{pipeTar}), 1) = 1; } -sub errStr -{ - my($t) = @_; - - return $t->{_errStr}; -} - -sub xferPid -{ - my($t) = @_; - - return ($t->{xferPid}); -} - -sub logMsg -{ - my($t, $msg) = @_; - - push(@{$t->{_logMsg}}, $msg); -} - -sub logMsgGet -{ - my($t) = @_; - - return shift(@{$t->{_logMsg}}); -} - -# -# Returns a hash ref giving various status information about -# the transfer. -# -sub getStats -{ - my($t) = @_; - - return { map { $_ => $t->{$_} } - qw(byteCnt fileCnt xferErrCnt xferBadShareCnt xferBadFileCnt - xferOK hostAbort hostError lastOutputLine) - }; -} - -sub getBadFiles -{ - my($t) = @_; - - return @{$t->{badFiles}}; -} - 1;