[packages/rsnapshot] - include rsnapreport.pl

arekm arekm at pld-linux.org
Tue Dec 4 11:26:12 CET 2018


commit e491cada7eed27a466c641f0092f6b2de285e927
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Dec 4 11:26:04 2018 +0100

    - include rsnapreport.pl

 bug-207.patch  | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 rsnapshot.spec | 13 +++++++--
 2 files changed, 99 insertions(+), 3 deletions(-)
---
diff --git a/rsnapshot.spec b/rsnapshot.spec
index 84ef6c4..3ca1c09 100644
--- a/rsnapshot.spec
+++ b/rsnapshot.spec
@@ -8,6 +8,7 @@ License:	GPL v2+
 Group:		Daemons
 Source0:	http://www.rsnapshot.org/downloads/%{name}-%{version}.tar.gz
 # Source0-md5:	860382f19e38fc649f9447397b54e442
+Patch0:		bug-207.patch
 URL:		http://www.rsnapshot.org/
 BuildRequires:	rpm-perlprov
 Requires:	rsync
@@ -22,6 +23,7 @@ w oparciu o rsynca.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %configure \
@@ -34,6 +36,8 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+cp -p utils/rsnapreport.pl $RPM_BUILD_ROOT%{_bindir}
+
 mv -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf{.default,}
 
 %clean
@@ -42,6 +46,9 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS ChangeLog README.md
-%attr(755,root,root) %{_bindir}/*
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
-%{_mandir}/man1/*
+%attr(755,root,root) %{_bindir}/rsnapreport.pl
+%attr(755,root,root) %{_bindir}/rsnapshot
+%attr(755,root,root) %{_bindir}/rsnapshot-diff
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/rsnapshot.conf
+%{_mandir}/man1/rsnapshot-diff.1*
+%{_mandir}/man1/rsnapshot.1*
diff --git a/bug-207.patch b/bug-207.patch
new file mode 100644
index 0000000..a0c908c
--- /dev/null
+++ b/bug-207.patch
@@ -0,0 +1,89 @@
+From 79e25dc83bc234357cf3dbbfa6694e61abd30e6b Mon Sep 17 00:00:00 2001
+From: Guillaume Delacour <gui at iroqwa.org>
+Date: Tue, 14 Jul 2015 00:24:02 +0200
+Subject: [PATCH] Update rsnapreport.pl utility script to work with rsync >=
+ 3.1.0 stats and bytes changes.
+
+---
+ utils/rsnapreport.pl | 32 +++++++++++++++++++-------------
+ 1 file changed, 19 insertions(+), 13 deletions(-)
+
+diff --git a/utils/rsnapreport.pl b/utils/rsnapreport.pl
+index 2249566..83fb6ca 100644
+--- a/utils/rsnapreport.pl
++++ b/utils/rsnapreport.pl
+@@ -1,7 +1,7 @@
+ #!/usr/bin/env perl
+ # this script prints a pretty report from rsnapshot output
+ # in the rsnapshot.conf you must set
+-# verbose >= 3
++# verbose >= 4
+ # and add --stats to rsync_long_args
+ # then setup crontab 'rsnapshot daily 2>&1 | rsnapreport.pl | mail -s"SUBJECT" backupadm at adm.com
+ # don't forget the 2>&1 or your errors will be lost to stderr
+@@ -41,14 +41,14 @@ ()
+ 		my $filest = $bkdata{$source}{'files_tran'};
+ 		my $filelistgentime = $bkdata{$source}{'file_list_gen_time'};
+ 		my $filelistxfertime = $bkdata{$source}{'file_list_trans_time'};
+-		my $bytes= $bkdata{$source}{'file_size'}/1000000; # convert to MB
+-		my $bytest= $bkdata{$source}{'file_tran_size'}/1000000; # convert to MB
++		my $bytes = $bkdata{$source}{'file_size'}/1000000; # convert to MB
++		my $bytest = $bkdata{$source}{'file_tran_size'}/1000000; # convert to MB
+ 		$source =~ s/^[^\@]+\@//; # remove username
+-format BREPORTHEAD =
++		format BREPORTHEAD =
+ SOURCE                          TOTAL FILES   FILES TRANS      TOTAL MB     MB TRANS   LIST GEN TIME  FILE XFER TIME
+ --------------------------------------------------------------------------------------------------------------------
+ .
+-format BREPORTBODY =
++		format BREPORTBODY =
+ @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<	@>>>>>>>>>>   @>>>>>>>>>> @#########.## @########.##   @>>>>>>>>>>>>  @>>>>>>>>>>>>>
+ $source,                        $files,       $filest,    $bytes,       $bytest,       $filelistgentime, $filelistxfertime
+ .
+@@ -62,7 +62,7 @@ ($)
+ 	push(@$lines,$line);
+ 	return shift @$lines;
+ }
+-	
++
+ 
+ my @rsnapout = ();
+ 
+@@ -83,24 +83,30 @@ ($)
+ 		#print $source;
+ 		while($line = nextLine(\@rsnapout)){
+   			# this means we are missing stats info
+-			if($line =~ /^[\/\w]+\/rsync/){ 
++			if($line =~ /^[\/\w]+\/rsync/){
+ 				unshift(@rsnapout,$line);
+ 				push(@errors,"$source NO STATS DATA");
+-				last;  
++				last;
+ 			}
+ 			# stat record
+ 			if($line =~ /^total size is\s+\d+/){ last; } # this ends the rsync stats record
+-			elsif($line =~ /Number of files:\s+(\d+)/){
++			# Number of files: 1,325 (reg: 387, dir: 139, link: 799)
++			elsif($line =~ /Number of files:\s+([\d,]+)/){
+ 				$bkdata{$source}{'files'}=$1;
++				$bkdata{$source}{'files'}=~ s/,//g;
+ 			}
+-			elsif($line =~ /Number of files transferred:\s+(\d+)/){
+-				$bkdata{$source}{'files_tran'}=$1;
++			# Number of regular files transferred: 1
++			elsif($line =~ /Number of (regular )?files transferred:\s+([\d,]+)/){
++				$bkdata{$source}{'files_tran'}=$2;
+ 			}
+-			elsif($line =~ /Total file size:\s+(\d+)/){
++			# Total file size: 1,865,857 bytes
++			elsif($line =~ /Total file size:\s+([\d,]+)/){
+ 				$bkdata{$source}{'file_size'}=$1;
++				$bkdata{$source}{'file_size'}=~ s/,//g;
+ 			}
+-			elsif($line =~ /Total transferred file size:\s+(\d+)/){
++			elsif($line =~ /Total transferred file size:\s+([\d,]+)/){
+ 				$bkdata{$source}{'file_tran_size'}=$1;
++				$bkdata{$source}{'file_tran_size'}=~ s/,//g;
+ 			}
+ 			elsif($line =~ /File list generation time:\s+(.+)/){
+ 				$bkdata{$source}{'file_list_gen_time'}=$1;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rsnapshot.git/commitdiff/e491cada7eed27a466c641f0092f6b2de285e927



More information about the pld-cvs-commit mailing list