← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~antmak/duplicity/0.7-par2-fix into lp:duplicity

 

antmak has proposed merging lp:~antmak/duplicity/0.7-par2-fix into lp:duplicity.

Commit message:
Added user defined verbatim options for par2

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~antmak/duplicity/0.7-par2-fix/+merge/219184

Useful fix for verbatim par2cmdline options (like as "-t" in par2-tbb version)
-- 
https://code.launchpad.net/~antmak/duplicity/0.7-par2-fix/+merge/219184
Your team duplicity-team is requested to review the proposed merge of lp:~antmak/duplicity/0.7-par2-fix into lp:duplicity.
=== modified file 'duplicity/backends/par2backend.py'
--- duplicity/backends/par2backend.py	2014-04-28 02:49:39 +0000
+++ duplicity/backends/par2backend.py	2014-05-12 12:50:19 +0000
@@ -39,6 +39,11 @@
         except AttributeError:
             self.redundancy = 10
 
+        try:
+            self.common_options = globals.par2_options + "-q -q"
+        except AttributeError:
+            self.common_options = "-q -q"
+
         self.wrapped_backend = backend.get_backend_object(parsed_url.url_string)
 
         for attr in ['_get', '_put', '_list', '_delete', '_delete_list',
@@ -67,7 +72,7 @@
         source_symlink.setdata()
 
         log.Info("Create Par2 recovery files")
-        par2create = 'par2 c -r%d -n1 -q -q %s' % (self.redundancy, source_symlink.get_canonical())
+        par2create = 'par2 c -r%d -n1 %s %s' % (self.redundancy, self.common_options, source_symlink.get_canonical())
         out, returncode = pexpect.run(par2create, -1, True)
         source_symlink.delete()
         files_to_transfer = []
@@ -106,7 +111,7 @@
             par2file = par2temp.append(remote_filename + '.par2')
             self.wrapped_backend._get(par2file.get_filename(), par2file)
 
-            par2verify = 'par2 v -q -q %s %s' % (par2file.get_canonical(), local_path_temp.get_canonical())
+            par2verify = 'par2 v %s %s %s' % (self.common_options, par2file.get_canonical(), local_path_temp.get_canonical())
             out, returncode = pexpect.run(par2verify, -1, True)
 
             if returncode:
@@ -118,7 +123,7 @@
                     file = par2temp.append(filename)
                     self.wrapped_backend._get(filename, file)
 
-                par2repair = 'par2 r -q -q %s %s' % (par2file.get_canonical(), local_path_temp.get_canonical())
+                par2repair = 'par2 r %s %s %s' % (self.common_options, par2file.get_canonical(), local_path_temp.get_canonical())
                 out, returncode = pexpect.run(par2repair, -1, True)
 
                 if returncode:

=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py	2014-04-28 02:49:39 +0000
+++ duplicity/commandline.py	2014-05-12 12:50:19 +0000
@@ -449,7 +449,10 @@
                                                    old_fn_deprecation(s)))
 
     # Level of Redundancy in % for Par2 files
-    parser.add_option("--par2-redundancy", type="int", metavar=_("number"))
+    parser.add_option("--par2-redundancy", type = "int", metavar = _("number"))
+
+    # Verbatim par2 options
+    parser.add_option("--par2-options", action = "extend", metavar = _("options"))
 
     # Used to display the progress for the full and incremental backup operations
     parser.add_option("--progress", action = "store_true")

=== modified file 'duplicity/globals.py'
--- duplicity/globals.py	2014-04-22 15:01:38 +0000
+++ duplicity/globals.py	2014-05-12 12:50:19 +0000
@@ -285,5 +285,8 @@
 # Level of Redundancy in % for Par2 files
 par2_redundancy = 10
 
+# Verbatim par2 other options
+par2_options = ""
+
 # Whether to enable gio backend
 use_gio = False


Follow ups