Skip to contentSkip to conversation

fetch: fix unpacking .deb and .ipk with python3

PATCH New Martin Jansa 1 participant 1 message Jun 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch: fix unpacking .deb and .ipk with python3

* otherwise e.g. libjs-jquery-1.7.2-r0 do_unpack fails like this:
http://errors.yoctoproject.org/Errors/Details/69433/
DEBUG: Executing python function do_unpack
DEBUG: Executing python function base_do_unpack
ERROR: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>

     0001:
 *** 0002:base_do_unpack(d)
     0003:
File: ' /openembedded-core/meta/classes/base.bbclass', lineno: 155, function: base_do_unpack
     0151:    bb.utils.remove(p_dir, True)
     0152:
     0153:    try:
     0154:        fetcher = bb.fetch2.Fetch(src_uri, d)

*** 0155: fetcher.unpack(rootdir)
0156: except bb.fetch2.BBFetchException as e:
0157: raise bb.build.FuncFailed(e)
0158:}
0159:
File: ' /bitbake/lib/bb/fetch2/__init__.py', lineno: 1681, function: unpack
1677:
1678: if ud.lockfile:
1679: lf = bb.utils.lockfile(ud.lockfile)
1680:
*** 1681: ud.method.unpack(ud, root, self.d)

     1682:
     1683:            if ud.lockfile:
     1684:                bb.utils.unlockfile(lf)
     1685:
File: ' /bitbake/lib/bb/fetch2/__init__.py', lineno: 1399, function: unpack
     1395:                output = subprocess.check_output('ar -t %s' % file, preexec_fn=subprocess_setup, shell=True)
     1396:                datafile = None
     1397:                if output:

1398: for line in output.splitlines():
*** 1399: if line.startswith('data.tar.'):
1400: datafile = line
1401: break
1402: else:
1403: raise UnpackError("Unable to unpack deb/ipk package - does not contain data.tar.* file", urldata.url)
Exception: TypeError: startswith first arg must be bytes or a tuple of bytes, not str

DEBUG: Python function base_do_unpack finished
DEBUG: Python function do_unpack finished
ERROR: Function failed: base_do_unpack

---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +1 -1
index f612318..325a66c 100644
@@ -1392,7 +1392,7 @@ class FetchMethod(object):
                 else:
                     cmd = 'rpm2cpio.sh %s | cpio -id' % (file)
             elif file.endswith('.deb') or file.endswith('.ipk'):
-                output = subprocess.check_output('ar -t %s' % file, preexec_fn=subprocess_setup, shell=True)
+                output = subprocess.check_output('ar -t %s' % file, preexec_fn=subprocess_setup, shell=True).decode("utf-8")
                 datafile = None
                 if output:
                     for line in output.splitlines():
Signature · 1 line
2.9.0