]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: use decode('utf-8') for binary data
authorEd Bartosh <ed.bartosh@linux.intel.com>
Tue, 10 May 2016 12:28:50 +0000 (15:28 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Jun 2016 14:28:23 +0000 (15:28 +0100)
Decoded binary data to utf-8 to fix the following
error when runnign on python 3:
TypeError: Type str doesn't support the buffer API

[YOCTO #9584]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/bldcontrol/localhostbecontroller.py
lib/toaster/bldcontrol/management/commands/loadconf.py
lib/toaster/orm/models.py

index b4e41968f19f2766073fe899bd7391b0003e75b7..3da8be4358573e5b6d6aa66c56cb90cb01c0889d 100644 (file)
@@ -70,7 +70,7 @@ class LocalhostBEController(BuildEnvironmentController):
             raise ShellCmdException(err)
         else:
             logger.debug("localhostbecontroller: shellcmd success")
-            return out
+            return out.decode('utf-8')
 
     def getGitCloneDirectory(self, url, branch):
         """Construct unique clone directory name out of url and branch."""
index 6d25df9e540145a48be84ac57694c07364a3009c..173e3ce5793a9048e4e5d76963506daaca5cd9fa 100644 (file)
@@ -54,7 +54,7 @@ class Command(BaseCommand):
             (out,err) = cmd.communicate()
             if cmd.returncode != 0:
                 logging.warning("Error while importing layer vcs_url: git error: %s" % err)
-            for line in out.split("\n"):
+            for line in out.decode('utf-8').split("\n"):
                 try:
                     (name, path) = line.split("\t", 1)
                     if name == remote_name:
index 9183b0cd7c5b3fb546804b8405c213653e00beed..58dc753aef714b85f34fdb167b5d1bb056e9c1aa 100644 (file)
@@ -1169,7 +1169,7 @@ class LayerIndexLayerSource(LayerSource):
             except URLError as e:
                 raise Exception("Failed to read %s: %s" % (path, e.reason))
 
-            return json.loads(res.read())
+            return json.loads(res.read().decode('utf-8'))
 
         # verify we can get the basic api
         try: