summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author朱穆穆 <zhumumu@gmail.com>2017-07-10 08:35:20 +0000
committerAlejandro del Castillo <alejandro.delcastillo@ni.com>2017-07-10 15:19:11 -0500
commit9ac94576bb9a71bb3a6af2ceac46106d460f3403 (patch)
tree55752135969e5b823c7dc7a92f02417c6743c3fc
parentc75797c01f1b46efc54c8d0ca97eb1bfc1404ec3 (diff)
downloadopkg-utils-9ac94576bb9a71bb3a6af2ceac46106d460f3403.tar.gz
opkg-utils-9ac94576bb9a71bb3a6af2ceac46106d460f3403.tar.bz2
opkg-utils-9ac94576bb9a71bb3a6af2ceac46106d460f3403.zip
opkg.py/__init__: Compatible for ipk which outer is tar
Signed-off-by: Zhu Mumu <zhumumu@gmail.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
-rw-r--r--opkg.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/opkg.py b/opkg.py
index 2ecac8a..4d6f020 100644
--- a/opkg.py
+++ b/opkg.py
@@ -164,8 +164,12 @@ class Package(object):
## sys.stderr.write(" extracting control.tar.gz from %s\n"% (fn,))
- ar = arfile.ArFile(f, fn)
- tarStream = ar.open("control.tar.gz")
+ if tarfile.is_tarfile(fn):
+ tar = tarfile.open(fn, "r", f)
+ tarStream = tar.extractfile("./control.tar.gz")
+ else:
+ ar = ArFile(f, fn)
+ tarStream = ar.open("control.tar.gz")
tarf = tarfile.open("control.tar.gz", "r", tarStream)
try:
control = tarf.extractfile("control")