← Back to team overview

duplicity-team team mailing list archive

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

 

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

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.6-par2-fix/+merge/219144

Useful fix for verbatim par2cmdline options (like as "-t" in par2-tbb version)
-- 
https://code.launchpad.net/~antmak/duplicity/0.6-par2-fix/+merge/219144
Your team duplicity-team is requested to review the proposed merge of lp:~antmak/duplicity/0.6-par2-fix into lp:duplicity/0.6-series.
=== modified file 'duplicity/backends/~par2wrapperbackend.py'
--- duplicity/backends/~par2wrapperbackend.py	2014-05-07 12:51:00 +0000
+++ duplicity/backends/~par2wrapperbackend.py	2014-05-12 07:33:15 +0000
@@ -39,6 +39,11 @@
             self.redundancy = 10
 
         try:
+            self.common_options = globals.par2_options + "-q -q"
+        except AttributeError:
+            self.common_options = "-q -q"
+
+        try:
             url_string = self.parsed_url.url_string.lstrip('par2+')
             self.wrapped_backend = backend.get_backend(url_string)
         except:
@@ -62,7 +67,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 = run(par2create, -1, True)
         source_symlink.delete()
         files_to_transfer = []
@@ -99,7 +104,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 = run(par2verify, -1, True)
 
             if returncode:
@@ -110,7 +115,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 = run(par2repair, -1, True)
 
                 if returncode:

=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py	2014-05-07 12:51:00 +0000
+++ duplicity/commandline.py	2014-05-12 07:33:15 +0000
@@ -452,7 +452,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-05-07 12:51:00 +0000
+++ duplicity/globals.py	2014-05-12 07:33:15 +0000
@@ -284,3 +284,6 @@
 
 # Level of Redundancy in % for Par2 files
 par2_redundancy = 10
+
+# Verbatim par2 other options
+par2_options = ""


Follow ups