1 |
commit: 3945684939f5ad1650c6a6ade404b966cc69343e |
2 |
Author: Tim Harder <radhermit <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 26 06:14:49 2017 +0000 |
4 |
Commit: Tim Harder <radhermit <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 26 06:22:57 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39456849 |
7 |
|
8 |
app-misc/binwalk: backport patch to support backports-lzma |
9 |
|
10 |
In addition to pyliblzma. |
11 |
|
12 |
app-misc/binwalk/binwalk-2.1.1.ebuild | 4 +- |
13 |
...-for-backports.lzma-when-importing-lzma-m.patch | 67 ++++++++++++++++++++++ |
14 |
2 files changed, 70 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/app-misc/binwalk/binwalk-2.1.1.ebuild b/app-misc/binwalk/binwalk-2.1.1.ebuild |
17 |
index 466c274a8df..031f4169fe8 100644 |
18 |
--- a/app-misc/binwalk/binwalk-2.1.1.ebuild |
19 |
+++ b/app-misc/binwalk/binwalk-2.1.1.ebuild |
20 |
@@ -16,10 +16,12 @@ KEYWORDS="~amd64 ~x86" |
21 |
IUSE="graph" |
22 |
|
23 |
RDEPEND=" |
24 |
- $(python_gen_cond_dep 'dev-python/pyliblzma[${PYTHON_USEDEP}]' python2_7) |
25 |
+ $(python_gen_cond_dep 'dev-python/backports-lzma[${PYTHON_USEDEP}]' python2_7) |
26 |
graph? ( dev-python/pyqtgraph[opengl,${PYTHON_USEDEP}] ) |
27 |
" |
28 |
|
29 |
+PATCHES=( "${FILESDIR}"/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch ) |
30 |
+ |
31 |
python_install_all() { |
32 |
local DOCS=( API.md INSTALL.md README.md ) |
33 |
distutils-r1_python_install_all |
34 |
|
35 |
diff --git a/app-misc/binwalk/files/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch b/app-misc/binwalk/files/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch |
36 |
new file mode 100644 |
37 |
index 00000000000..708498060bc |
38 |
--- /dev/null |
39 |
+++ b/app-misc/binwalk/files/0001-Added-check-for-backports.lzma-when-importing-lzma-m.patch |
40 |
@@ -0,0 +1,67 @@ |
41 |
+From 95bce4edcc6e92c9517b80ccb1fb956f591e0738 Mon Sep 17 00:00:00 2001 |
42 |
+From: Craig Heffner <heffnercj@×××××.com> |
43 |
+Date: Tue, 5 Jan 2016 13:28:24 -0500 |
44 |
+Subject: [PATCH] Added check for backports.lzma when importing lzma module |
45 |
+ |
46 |
+--- |
47 |
+ src/binwalk/modules/compression.py | 5 ++++- |
48 |
+ src/binwalk/plugins/lzmaextract.py | 6 +++++- |
49 |
+ src/binwalk/plugins/lzmavalid.py | 5 ++++- |
50 |
+ 3 files changed, 13 insertions(+), 3 deletions(-) |
51 |
+ |
52 |
+diff --git a/src/binwalk/modules/compression.py b/src/binwalk/modules/compression.py |
53 |
+index 97ca68d..e919f7e 100644 |
54 |
+--- a/src/binwalk/modules/compression.py |
55 |
++++ b/src/binwalk/modules/compression.py |
56 |
+@@ -2,11 +2,14 @@ |
57 |
+ |
58 |
+ import os |
59 |
+ import zlib |
60 |
+-import lzma |
61 |
+ import struct |
62 |
+ import binwalk.core.compat |
63 |
+ import binwalk.core.common |
64 |
+ from binwalk.core.module import Option, Kwarg, Module |
65 |
++try: |
66 |
++ import lzma |
67 |
++except ImportError: |
68 |
++ from backports import lzma |
69 |
+ |
70 |
+ class LZMAHeader(object): |
71 |
+ def __init__(self, **kwargs): |
72 |
+diff --git a/src/binwalk/plugins/lzmaextract.py b/src/binwalk/plugins/lzmaextract.py |
73 |
+index 137b4cc..93f6240 100755 |
74 |
+--- a/src/binwalk/plugins/lzmaextract.py |
75 |
++++ b/src/binwalk/plugins/lzmaextract.py |
76 |
+@@ -12,7 +12,11 @@ class LZMAExtractPlugin(binwalk.core.plugin.Plugin): |
77 |
+ # lzma package in Python 2.0 decompress() does not handle multiple |
78 |
+ # compressed streams, only first stream is extracted. |
79 |
+ # backports.lzma package could be used to keep consistent behaviour. |
80 |
+- import lzma |
81 |
++ try: |
82 |
++ import lzma |
83 |
++ except ImportError: |
84 |
++ from backports import lzma |
85 |
++ |
86 |
+ self.decompressor = lzma.decompress |
87 |
+ |
88 |
+ # If the extractor is enabled for the module we're currently loaded |
89 |
+diff --git a/src/binwalk/plugins/lzmavalid.py b/src/binwalk/plugins/lzmavalid.py |
90 |
+index a343656..62e15b9 100644 |
91 |
+--- a/src/binwalk/plugins/lzmavalid.py |
92 |
++++ b/src/binwalk/plugins/lzmavalid.py |
93 |
+@@ -17,7 +17,10 @@ class LZMAPlugin(binwalk.core.plugin.Plugin): |
94 |
+ |
95 |
+ def init(self): |
96 |
+ try: |
97 |
+- import lzma |
98 |
++ try: |
99 |
++ import lzma |
100 |
++ except ImportError: |
101 |
++ from backports import lzma |
102 |
+ self.decompressor = lzma.decompress |
103 |
+ except ImportError as e: |
104 |
+ self.decompressor = None |
105 |
+-- |
106 |
+2.12.2 |
107 |
+ |