rpms/fwbackups/F-8 fwbackups-1.43.2rc2-backend_fixes.patch, NONE, 1.1 fwbackups.spec, 1.16, 1.17

Stewart Adam (firewing) fedora-extras-commits at redhat.com
Thu Jul 10 17:20:16 UTC 2008


Author: firewing

Update of /cvs/extras/rpms/fwbackups/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21611/F-8

Modified Files:
	fwbackups.spec 
Added Files:
	fwbackups-1.43.2rc2-backend_fixes.patch 
Log Message:
Fix errors relating to backend.py


fwbackups-1.43.2rc2-backend_fixes.patch:

--- NEW FILE fwbackups-1.43.2rc2-backend_fixes.patch ---
--- src/fwbackups/backend.py.old	2008-05-31 17:38:32.000000000 -0400
+++ src/fwbackups/backend.py	2008-07-10 02:03:41.000000000 -0400
@@ -116,26 +116,24 @@
     """
     if os.path.exists(folder):
       if not os.path.isdir(folder): # what if the user gave a file?
-        error = _('Destination `%s\' exists but is not a folder!.') % folder
-        self.logger.logmsg('ERROR', error)
-        #raise EngineError(error)
-        return False
-    else: # try to create the folder
-      if not (self.engine == 'rsync' and self.incremental == True):
-        try:
-          os.mkdir(folder, 0755)
-          self.logger.logmsg('DEBUG', _('Created destination folder `%s\'') % folder)
-        except:
-          error = _('The destination folder `%s\' could not be created.') % folder
-          self.logger.logmsg('ERROR', error)
-          #raise EngineError(error)
-          return False
-    
-      if not fwbackups.CheckPerms(folder): # make sure it's writable
-        error = _('You do not have read and write permissions on the destination `%s\'' % folder)
+        self.logger.logmsg('WARNING', _('Destination `%s\' exists but is not a folder! Removing.') % folder)
+        shutil_modded.rmtree(path=folder, onerror=self.onError)
+    # try to create the folder
+    if not (self.engine == 'rsync' and self.incremental == True):
+      try:
+        os.mkdir(folder, 0755)
+        self.logger.logmsg('DEBUG', _('Created destination folder `%s\'') % folder)
+      except:
+        error = _('The destination folder `%s\' could not be created.') % folder
         self.logger.logmsg('ERROR', error)
         #raise EngineError(error)
         return False
+  
+    if not fwbackups.CheckPerms(folder): # make sure it's writable
+      error = _('You do not have read and write permissions on the destination `%s\'' % folder)
+      self.logger.logmsg('ERROR', error)
+      #raise EngineError(error)
+      return False
     return True
 
   def removeIfExists(self, treefile):
@@ -314,7 +312,7 @@
       # non recursive - Skip dirs
       if self.recursive == False and os.path.isdir(path):
         continue # move on to next file
-      paths.append("'%s'" % '\'\\\'\''.join(path.split('\''))) # wrap it in quotes for command line, and escape other '
+      paths.append("'%s'" % '\'\\\'\''.join(path.split('\''))) # wrap it in quotes for command line, and escape other single quote
     if paths == []:
       self.logger.logmsg('WARNING', _('After parsing options, there are no paths to backup!') + ' paths == []')
       return False, -1
@@ -595,8 +593,9 @@
           shutil_modded.copytree_fullpaths(i, self.dest)
           self.current += 1
         else:
-          self.logger.logmsg('DEBUG', _('Running command: nice -n %(a)i %(b)s %(c)s %(d)s' % {'a': self.nice, 'b': command, 'c': i, 'd': self.dest}))
-          sub = fwbackups.executeSub('nice -n %i %s %s %s' % (self.nice, command, i, self.dest), env=self.environment, shell=True)
+          splitdest = '\'\\\'\''.join(self.dest.split('\'')) # wrap it in quotes for command line, and escape other single quote
+          self.logger.logmsg('DEBUG', _("Running command: nice -n %(a)i %(b)s %(c)s '%(d)s'" % {'a': self.nice, 'b': command, 'c': i, 'd': splitdest}))
+          sub = fwbackups.executeSub("nice -n %i %s %s '%s'" % (self.nice, command, i, splitdest), env=self.environment, shell=True)
           self.pids.append(sub.pid)
           self.logger.logmsg('DEBUG', _('Starting subprocess with PID %s') % sub.pid)
           # Sleep while not done.
@@ -748,14 +747,18 @@
         oldbackups.append(i)
     # ...And remove them.
     oldbackups.reverse()
-    if self.engine == 'rsync' and self.incremental == True:
+    if self.engine == 'rsync' and self.incremental == True and oldbackups:
       for i in oldbackups[:-1]:
         self.logger.logmsg('DEBUG', _('Removing old backup `%s\'') % i)
         shutil_modded.rmtree(path=ConvertPath('%s/%s' % (self.folderdest, i)), onerror=self.onError)
-      
-      source = ConvertPath('%s/%s' % (self.folderdest, oldbackups[-1]))
-      self.logger.logmsg('DEBUG', _('Moving  `%s\' to `%s\'') % (source, self.dest))
-      shutil_modded.move(source, self.dest)
+      oldIncrementalBackup = ConvertPath('%s/%s' % (self.folderdest, oldbackups[-1]))
+      if not oldIncrementalBackup.endswith('.tar') and not oldIncrementalBackup.endswith('.tar.gz') and \
+         not oldIncrementalBackup.endswith('.tar.bz2'): # oldIncrementalBackup = rsync
+        self.logger.logmsg('DEBUG', _('Moving  `%s\' to `%s\'') % (oldIncrementalBackup, self.dest))
+        shutil_modded.move(oldIncrementalBackup, self.dest)
+      else: # source = is not a rsync backup - remove it and start fresh
+        self.logger.logmsg('DEBUG', _('`%s\' is not an rsync backup - removing.') % oldIncrementalBackup)
+        shutil_modded.rmtree(path=oldIncrementalBackup, onerror=self.onError)
     else:
       for i in oldbackups[self.tokeep:]:
         self.logger.logmsg('DEBUG', _('Removing old backup `%s\'') % i)


Index: fwbackups.spec
===================================================================
RCS file: /cvs/extras/rpms/fwbackups/F-8/fwbackups.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- fwbackups.spec	22 Jun 2008 17:41:49 -0000	1.16
+++ fwbackups.spec	10 Jul 2008 17:18:38 -0000	1.17
@@ -6,7 +6,7 @@
 Name:              fwbackups
 Version:           1.43.2
 #Release:           1%{?dist}
-Release:           0.4.%{pretag}%{?dist}
+Release:           0.5.%{pretag}%{?dist}
 BuildArch:         noarch
 Summary:           A feature-rich user backup program
 Group:             Applications/Archiving
@@ -15,6 +15,7 @@
 #Source0:           http://www.diffingo.com/downloads/fwbackups/fwbackups-%{version}.tar.gz
 Source0:           http://www.diffingo.com/downloads/fwbackups/fwbackups-%{version}%{pretag}.tar.gz
 Patch0:            fwbackups-1.43.2rc2-import-lowercase.patch
+Patch1:            fwbackups-1.43.2rc2-backend_fixes.patch
 BuildRoot:         %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:     desktop-file-utils
@@ -41,6 +42,7 @@
 %prep
 %setup -q -n %{name}-%{version}%{pretag}
 
+%patch1
 # uncomment me as needed
 pushd src/fwbackups
 %patch0
@@ -80,6 +82,9 @@
 %doc AUTHORS COPYING ChangeLog NEWS TODO README
 
 %changelog
+* Thu Jul 10 2008 Stewart Adam <s.adam at diffingo.com> 1.43.2-0.5.rc2
+- Add patch to backend.py to fix errors with the rsync backend
+
 * Sun Jun 22 2008 Stewart Adam <s.adam at diffingo.com> 1.43.2-0.4.rc2
 - Add patch to fix _import() functions
 




More information about the scm-commits mailing list