"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "bin/BackupPC_fixupBackupSummary" between
BackupPC-4.3.2.tar.gz and BackupPC-4.4.0.tar.gz

About: BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX PCs and laptops to a server’s disk (http/cgi user interface).

BackupPC_fixupBackupSummary  (BackupPC-4.3.2):BackupPC_fixupBackupSummary  (BackupPC-4.4.0)
skipping to change at line 32 skipping to change at line 32
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
#======================================================================== #========================================================================
# #
# Version 4.3.2, released 17 Feb 2020. # Version 4.4.0, released 20 Jun 2020.
# #
# See http://backuppc.sourceforge.net. # See http://backuppc.sourceforge.net.
# #
#======================================================================== #========================================================================
use strict; use strict;
no utf8; no utf8;
use lib "__INSTALLDIR__/lib"; use lib "__INSTALLDIR__/lib";
use Getopt::Std; use Getopt::Std;
use Data::Dumper; use Data::Dumper;
use Time::ParseDate; use Time::ParseDate;
use BackupPC::Lib; use BackupPC::Lib;
use BackupPC::XS; use BackupPC::XS;
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
my $TopDir = $bpc->TopDir(); my $TopDir = $bpc->TopDir();
my $BinDir = $bpc->BinDir(); my $BinDir = $bpc->BinDir();
my %Conf = $bpc->Conf(); my %Conf = $bpc->Conf();
my $Hosts = $bpc->HostInfoRead(); my $Hosts = $bpc->HostInfoRead();
my @hostList; my @hostList;
our(%backupInfo); our(%backupInfo);
my %opts; my %opts;
if ( !getopts("l", \%opts) ) { if ( !getopts("l", \%opts) ) {
skipping to change at line 126 skipping to change at line 128
next if ( !-f "$dir/$bkupNum/backupInfo" ); next if ( !-f "$dir/$bkupNum/backupInfo" );
# #
# Read backup info # Read backup info
# #
%backupInfo = (); %backupInfo = ();
print(" Reading $dir/$bkupNum/backupInfo\n"); print(" Reading $dir/$bkupNum/backupInfo\n");
if ( !(my $ret = do "$dir/$bkupNum/backupInfo") ) { if ( !(my $ret = do "$dir/$bkupNum/backupInfo") ) {
print(" couldn't parse $dir/$bkupNum/backupInfo: $@\n") if $@ ; print(" couldn't parse $dir/$bkupNum/backupInfo: $@\n") if $@ ;
print(" couldn't do $dir/$bkupNum/backupInfo: $!\n") print(" couldn't do $dir/$bkupNum/backupInfo: $!\n")
unless defined $ret; unless defined $ret;
print(" couldn't run $dir/$bkupNum/backupInfo\n"); print(" couldn't run $dir/$bkupNum/backupInfo\n");
next; next;
} }
if ( !keys(%backupInfo) || !defined($backupInfo{num}) ) { if ( !keys(%backupInfo) || !defined($backupInfo{num}) ) {
print(" $dir/$bkupNum/backupInfo is empty\n"); print(" $dir/$bkupNum/backupInfo is empty\n");
next; next;
} }
%{$BkupFromInfo->{$backupInfo{num}}} = %backupInfo; %{$BkupFromInfo->{$backupInfo{num}}} = %backupInfo;
} }
} }
# #
# Read through LOG files from oldest to newest # Read through LOG files from oldest to newest
# #
@LogFiles = sort({-M "$dir/$a" <=> -M "$dir/$b"} @LogFiles); @LogFiles = sort({ -M "$dir/$a" <=> -M "$dir/$b" } @LogFiles);
my $startTime; my $startTime;
my $fillFromNum; my $fillFromNum;
foreach my $file ( @LogFiles ) { foreach my $file ( @LogFiles ) {
my $f = BackupPC::XS::FileZIO::open("$dir/$file", 0, $file =~ /\.z/); my $f = BackupPC::XS::FileZIO::open("$dir/$file", 0, $file =~ /\.z/);
if ( !defined($f) ) { if ( !defined($f) ) {
print("$host: unable to open file $dir/$file\n"); print("$host: unable to open file $dir/$file\n");
next; next;
} }
print(" Reading $file\n"); print(" Reading $file\n");
while ( (my $str = $f->readLine()) ne "" ) { while ( (my $str = $f->readLine()) ne "" ) {
if ( $str =~ /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (full|incr|part ial) backup started / ) { if ( $str =~ /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (full|incr|part ial) backup started / ) {
$startTime = parsedate($1); $startTime = parsedate($1);
next; next;
} }
next if ( $str !~ /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (full|incr next
|partial) backup (\d+) complete, (\d+) files, (\d+) bytes, (\d+) xferErrs \((\d+ if ( $str !~
) bad files, (\d+) bad shares, (\d+) other\)/ ); /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (full|incr|partial) back
up (\d+) complete, (\d+) files, (\d+) bytes, (\d+) xferErrs \((\d+) bad files, (
\d+) bad shares, (\d+) other\)/
);
my $type = $2; my $type = $2;
my $bkupNum = $3; my $bkupNum = $3;
my $nFilesTotal = $4; my $nFilesTotal = $4;
my $sizeTotal = $5; my $sizeTotal = $5;
my $xferErrs = $6; my $xferErrs = $6;
my $badFiles = $7; my $badFiles = $7;
my $badShare = $8; my $badShare = $8;
my $endTime = parsedate($1); my $endTime = parsedate($1);
print(" Got $type backup $bkupNum at $endTime\n"); print(" Got $type backup $bkupNum at $endTime\n");
next if ( !-d "$dir/$bkupNum" ); next if ( !-d "$dir/$bkupNum" );
$BkupFromLOG->{$bkupNum} = { $BkupFromLOG->{$bkupNum} = {
num => $bkupNum, num => $bkupNum,
type => $type, type => $type,
startTime => $startTime, startTime => $startTime,
endTime => $endTime, endTime => $endTime,
size => $sizeTotal, size => $sizeTotal,
nFiles => $nFilesTotal, nFiles => $nFilesTotal,
xferErrs => $xferErrs, xferErrs => $xferErrs,
xferBadFile => $badFiles, xferBadFile => $badFiles,
xferBadShare => $badShare, xferBadShare => $badShare,
nFilesExist => 0, nFilesExist => 0,
sizeExist => 0, sizeExist => 0,
sizeExistComp => 0, sizeExistComp => 0,
tarErrs => 0, tarErrs => 0,
compress => $Conf{CompressLevel}, compress => $Conf{CompressLevel},
noFill => $type eq "incr" ? 1 : 0, noFill => $type eq "incr" ? 1 : 0,
level => $type eq "incr" ? 1 : 0, level => $type eq "incr" ? 1 : 0,
mangle => 1, mangle => 1,
fillFromNum => $fillFromNum, fillFromNum => $fillFromNum,
}; };
$fillFromNum = $bkupNum if ( $type eq "full" ); $fillFromNum = $bkupNum if ( $type eq "full" );
} }
} }
# #
# Now merge any info from $BkupFromInfo and $BkupFromLOG # Now merge any info from $BkupFromInfo and $BkupFromLOG
# that is missing from @Backups. # that is missing from @Backups.
# #
# First, anything in @Backups overrides the other data # First, anything in @Backups overrides the other data
skipping to change at line 231 skipping to change at line 237
print(" Adding info for backup $bkupNum from backupInfo file\n"); print(" Adding info for backup $bkupNum from backupInfo file\n");
push(@Backups, $BkupFromInfo->{$bkupNum}); push(@Backups, $BkupFromInfo->{$bkupNum});
delete($BkupNums->{$bkupNum}); delete($BkupNums->{$bkupNum});
$changes++; $changes++;
} }
foreach my $bkupNum ( keys(%$BkupNums) ) { foreach my $bkupNum ( keys(%$BkupNums) ) {
print(" *** No info for backup number $bkupNum\n"); print(" *** No info for backup number $bkupNum\n");
} }
if ( $changes ) { if ( $changes ) {
@Backups = sort({$a->{num} <=> $b->{num}} @Backups); @Backups = sort({ $a->{num} <=> $b->{num} } @Backups);
# print Dumper \@Backups; # print Dumper \@Backups;
$bpc->BackupInfoWrite($host, @Backups); $bpc->BackupInfoWrite($host, @Backups);
} else { } else {
print(" No changes for host $host\n"); print(" No changes for host $host\n");
} }
} }
 End of changes. 9 change blocks. 
26 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)