tag 698995 +patch
thanks

Hi,

Attached is a patch that adds support to open cbr archives with unar. I
simply replaced the unrar support with unar, as this gets rid of an
unfree suggests.

It would probably be better to rewrite comix to use libarchive, but
that's quite a bit more work.

-- 
Cheers,
Sven Arvidsson
http://www.whiz.se
PGP Key ID 6FAB5CD5


diff -urp comix-4.0.4/debian/changelog comix-4.0.4-patch/debian/changelog
--- comix-4.0.4/debian/changelog	2015-04-04 20:56:16.000000000 +0200
+++ comix-4.0.4-patch/debian/changelog	2015-04-04 20:59:13.068719082 +0200
@@ -1,3 +1,12 @@
+comix (4.0.4-2) UNRELEASED; urgency=medium
+
+  [ Sven Arvidsson ]
+  * Apply patch to use unar in place of unrar (Closes: #698995).
+  * Recommends unar in place of suggesting non-free unrar (Closes: #415915).
+  * Update description to mention unar.
+
+ -- Sven Arvidsson <s...@whiz.se>  Sat, 04 Apr 2015 20:41:36 +0200
+
 comix (4.0.4-1) unstable; urgency=low
 
   * New upstream release
diff -urp comix-4.0.4/debian/control comix-4.0.4-patch/debian/control
--- comix-4.0.4/debian/control	2015-04-04 20:56:16.000000000 +0200
+++ comix-4.0.4-patch/debian/control	2015-04-04 20:59:23.532917509 +0200
@@ -9,7 +9,8 @@ Standards-Version: 3.7.2
 Package: comix
 Architecture: all
 Depends: ${misc:Depends}, python (>= 2.4), python-gtk2 (>= 2.12), python-imaging (>= 1.1.5)
-Suggests: unrar, python (>=2.5)|python-sqllite2
+Recommends: unar
+Suggests: python (>=2.5)|python-sqllite2
 Description: GTK Comic Book Viewer
  Comix is a comic book viewer. It reads zip, rar, tar, tar.gz and 
  tar.bz2 archives (often called .cbz, .cbr and .cbt) as well as
@@ -37,7 +38,7 @@ Description: GTK Comic Book Viewer
    * Translated to English, Swedish, Simplified Chinese, Spanish,
      Brazilian Portuguese and German.
    * Reads the JPEG, PNG, TIFF, GIF, BMP, ICO, XPM and XBM image formats.
-   * Reads ZIP and tar archives natively, and RAR archives through the unrar
+   * Reads ZIP and tar archives natively, and RAR archives through the unar
      program.
    * Runs on Linux, FreeBSD, NetBSD and virtually any other UNIX-like OS.
    * More!
Only in comix-4.0.4-patch/debian: .pc
diff -urp comix-4.0.4/src/archive.py comix-4.0.4-patch/src/archive.py
--- comix-4.0.4/src/archive.py	2009-04-03 19:11:43.000000000 +0200
+++ comix-4.0.4-patch/src/archive.py	2015-04-04 20:55:21.628330407 +0200
@@ -14,6 +14,7 @@ import process
 ZIP, RAR, TAR, GZIP, BZIP2 = range(5)
 
 _rar_exec = None
+_rar_list = None
 
 
 class Extractor:
@@ -57,19 +58,20 @@ class Extractor:
             self._files = self._tfile.getnames()
         elif self._type == RAR:
             global _rar_exec
+            global _rar_list
             if _rar_exec is None:
-                _rar_exec = _get_rar_exec()
+                _rar_exec, _rar_list = _get_rar_exec()
                 if _rar_exec is None:
                     print '! Could not find RAR file extractor.'
                     dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING,
                         gtk.BUTTONS_CLOSE,
                         _("Could not find RAR file extractor!"))
                     dialog.format_secondary_markup(
-                        _("You need either the <i>rar</i> or the <i>unrar</i> program installed in order to read RAR (.cbr) files."))
+                        _("You need the <i>unar</i> program installed in order to read RAR (.cbr) files."))
                     dialog.run()
                     dialog.destroy()
                     return None
-            proc = process.Process([_rar_exec, 'vb', '--', src])
+            proc = process.Process([_rar_list, '--', src])
             fd = proc.spawn()
             self._files = [name.rstrip(os.linesep) for name in fd.readlines()]
             fd.close()
@@ -173,8 +175,7 @@ class Extractor:
                     print '! Non-local tar member:', name, '\n'
             elif self._type == RAR:
                 if _rar_exec is not None:
-                    proc = process.Process([_rar_exec, 'x', '-kb', '-p-',
-                        '-o-', '-inul', '--', self._src, name, self._dst])
+                    proc = process.Process([_rar_exec, '-q', '-f', '-o', self._dst, '--', self._src, name])
                     proc.spawn()
                     proc.wait()
                 else:
@@ -331,7 +332,8 @@ def _get_rar_exec():
     """Return the name of the RAR file extractor executable, or None if
     no such executable is found.
     """
-    for command in ('unrar', 'rar'):
-        if process.Process([command]).spawn() is not None:
-            return command
-    return None
+    commands = ('unar', 'lsar')
+    if process.Process(commands[1]).spawn() is not None:
+        return commands
+    else:
+        return (None, None)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to