[elbe-users] Finetuning error with missing info

Ralf Schlatterbeck rsc at runtux.com
Tue Oct 22 18:45:49 CEST 2019


I'm getting the following Finetuning error:

[ERROR] Finetuning Error, trying to continue anyways
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/elbepack/finetuning.py", line 714, in do_finetuning
    action.execute(buildenv, target)
  File "/usr/lib/python2.7/dist-packages/elbepack/finetuning.py", line 385, in execute
    chroot(target.path, "/bin/sh", stdin=self.node.et.text)
  File "/usr/lib/python2.7/dist-packages/elbepack/shellhelper.py", line 126, in chroot
    do(chcmd, env_add=new_env, **kwargs)
  File "/usr/lib/python2.7/dist-packages/elbepack/shellhelper.py", line 115, in do
    raise CommandError(cmd, p.returncode)
CommandError

Looks like the CommandError exception wasn't tested much. Not even on
python3.5.3 (Debian oldstable) defining a __repr__ for an exception
works as intended, on python2 it probably never will.

So I'm left completely in the dark which command produced which error.

My current workaround is to patch
/usr/lib/python2.7/dist-packages/elbepack/shellhelper.py
in the VM to include the parameters in the super call:

diff -u old/shellhelper.py new/shellhelper.py
--- old/shellhelper.py  2019-10-22 18:40:24.147652500 +0200
+++ new/shellhelper.py  2019-10-22 18:40:53.823610961 +0200
@@ -19,7 +19,7 @@
 
 class CommandError(Exception):
     def __init__(self, cmd, returncode):
-        Exception.__init__(self)
+        Exception.__init__(self, cmd, returncode)
         self.returncode = returncode
         self.cmd = cmd

This works as intended on python2.7 (untested with 3.X):
% python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from elbepack.shellhelper import CommandError
>>> raise CommandError ('command', 42)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
elbepack.shellhelper.CommandError: ('command', 42)

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   http://www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office at runtux.com



More information about the elbe-users mailing list