* Added multi-level incrementals. Still needs testing.
[BackupPC.git] / lib / BackupPC / Xfer / Rsync.pm
index 338ca56..80d47a6 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 2.1.0beta1, released 9 Apr 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -55,9 +55,10 @@ BEGIN {
        #
        # Note: also update configure.pl when this version number is changed!
        #
-        if ( $File::RsyncP::VERSION < 0.50 ) {
+        if ( $File::RsyncP::VERSION < 0.52 ) {
             $RsyncLibOK = 0;
-            $RsyncLibErr = "File::RsyncP module version too old: need 0.50";
+            $RsyncLibErr = "File::RsyncP module version"
+                         . " ($File::RsyncP::VERSION) too old: need 0.52";
         } else {
             $RsyncLibOK = 1;
         }
@@ -141,24 +142,11 @@ sub start
     } else {
        #
        # Turn $conf->{BackupFilesOnly} and $conf->{BackupFilesExclude}
-       # into a hash of arrays of files.
+       # into a hash of arrays of files, and $conf->{RsyncShareName}
+       # to an array
        #
-       $conf->{RsyncShareName} = [ $conf->{RsyncShareName} ]
-                       unless ref($conf->{RsyncShareName}) eq "ARRAY";
-       foreach my $param qw(BackupFilesOnly BackupFilesExclude) {
-           next if ( !defined($conf->{$param}) );
-           if ( ref($conf->{$param}) eq "ARRAY" ) {
-               $conf->{$param} = {
-                       $conf->{RsyncShareName}[0] => $conf->{$param}
-               };
-           } elsif ( ref($conf->{$param}) eq "HASH" ) {
-               # do nothing
-           } else {
-               $conf->{$param} = {
-                       $conf->{RsyncShareName}[0] => [ $conf->{$param} ]
-               };
-           }
-       }
+       $bpc->backupFileConfFix($conf, "RsyncShareName");
+
         if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) {
             my(@inc, @exc, %incDone, %excDone);
             foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) {
@@ -232,8 +220,9 @@ sub start
                $logMsg = "full backup started for directory $t->{shareName}";
            }
         } else {
-            $incrDate = $bpc->timeStamp($t->{lastFull} - 3600, 1);
-            $logMsg = "incr backup started back to $incrDate for directory"
+            $incrDate = $bpc->timeStamp($t->{incrBaseTime}, 1);
+            $logMsg = "incr backup started back to $incrDate"
+                    . " (backup #$t->{incrBaseBkupNum}) for directory"
                     . " $t->{shareName}";
         }
         
@@ -251,10 +240,13 @@ sub start
        $rsyncClientCmd = $conf->{RsyncClientCmd};
         $argList = ['--server', '--sender', @$rsyncArgs,
                               '.', $t->{shareNameSlash}];
+       eval {
+           $argList = File::RsyncP->excludeStrip($argList);
+       };
        $fioArgs = {
            client     => $t->{client},
            share      => $t->{shareName},
-           viewNum    => $t->{lastFullBkupNum},
+           viewNum    => $t->{incrBaseBkupNum},
             partialNum => $t->{partialNum},
        };
     }
@@ -312,6 +304,7 @@ sub start
        pidHandler   => sub {
                            $t->{pidHandler}(@_);
                        },
+        clientCharset => $conf->{ClientCharset},
        fio          => BackupPC::Xfer::RsyncFileIO->new({
                            xfer       => $t,
                            bpc        => $t->{bpc},
@@ -324,6 +317,8 @@ sub start
                                              $str .= "\n";
                                              $t->{XferLOG}->write(\$str);
                                          },
+                           cacheCheckProb => $conf->{RsyncCsumCacheVerifyProb},
+                            clientCharset  => $conf->{ClientCharset},
                            %$fioArgs,
                      }),
     });