[elbe-devel] [PATCH 1/3] finetuning: decode() bytes from losetup in LosetupAction

Torben Hohn torben.hohn at linutronix.de
Wed Sep 30 15:06:16 CEST 2020


get_command_out() returns bytes, resulting in:

-----------------------------------------------------------------------------------------------------
[CMD] mount "b'/dev/loop0'p1" "/var/cache/elbe/d7a3ac31-f4b3-442c-9ec5-f6f481fca7be/imagemnt"
mount: /var/cache/elbe/d7a3ac31-f4b3-442c-9ec5-f6f481fca7be/imagemnt: special device b'/dev/loop0'p1 does not exist.
[CMD] losetup --detach "b'/dev/loop0'"
losetup: b'/dev/loop0': failed to use device: No such device
[ERROR] ProjectFinetuning Error, trying to continue anyways
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/elbepack/finetuning.py", line 561, in execute_prj
    action.execute_img(buildenv, target, builddir, loop_dev)
  File "/usr/lib/python3/dist-packages/elbepack/finetuning.py", line 660, in execute_img
    with ImgMountFilesystem(img_mnt, device) as mnt_fs:
  File "/usr/lib/python3/dist-packages/elbepack/filesystem.py", line 524, in __enter__
    do(cmd)
  File "/usr/lib/python3/dist-packages/elbepack/shellhelper.py", line 258, in do
    raise CommandError(cmd, p.returncode)
elbepack.shellhelper.CommandError: Error: 32 returned from Command mount "b'/dev/loop0'p1" "/var/cache/elbe/d7a3ac31-f4b3-442c-9ec5-f6f481fca7be/imagemnt"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/elbepack/finetuning.py", line 773, in do_prj_finetuning
    action.execute_prj(buildenv, target, builddir)
  File "/usr/lib/python3/dist-packages/elbepack/finetuning.py", line 564, in execute_prj
    do(cmd)
  File "/usr/lib/python3/dist-packages/elbepack/shellhelper.py", line 258, in do
    raise CommandError(cmd, p.returncode)
elbepack.shellhelper.CommandError: Error: 1 returned from Command losetup --detach "b'/dev/loop0'"
------------------------------------------------------------------------------

Convert them to str using decode().

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/finetuning.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 60cb5c03c..ea76dd549 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -554,7 +554,7 @@ class LosetupAction(FinetuningAction):
         imgpath = os.path.join(builddir, imgname)
         cmd = 'losetup --find --show --partscan "%s"' % imgpath
 
-        loop_dev = get_command_out(cmd).strip()
+        loop_dev = get_command_out(cmd).decode().strip()
         try:
             for i in self.node:
                 action = ImageFinetuningAction(i)
-- 
2.20.1



More information about the elbe-devel mailing list