The error when a snapcraft script fails is not useful to find and fix the problem

Bug #1716511 reported by Leo Arias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

This is the error shown when a script (previously known as scriptlet) fails:

Traceback (most recent call last):
  File "/home/ubuntu/venv/snapcraft/bin/snapcraft", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/ubuntu/workspace/canonical/snapcraft/bin/snapcraft", line 36, in <module>
    obj=dict(project=snapcraft.ProjectOptions()))
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/cli/__init__.py", line 110, in run
    ctx.forward(lifecyclecli.commands['snap'])
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/home/ubuntu/venv/snapcraft/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/cli/lifecycle.py", line 132, in snap
    project_options, directory=directory, output=output)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/lifecycle.py", line 349, in snap
    execute('prime', project_options)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/lifecycle.py", line 130, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/lifecycle.py", line 225, in run
    self._run_step(step, part, part_names)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/lifecycle.py", line 262, in _run_step
    getattr(part, step)()
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/pluginhandler/__init__.py", line 328, in build
    script_runner.run(scriptlet=build_scriptlet)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/pluginhandler/_scriptlets.py", line 43, in run
    run([scriptlet_path], cwd=self._builddir)
  File "/home/ubuntu/workspace/canonical/snapcraft/snapcraft/internal/common.py", line 63, in run
    subprocess.check_call(['/bin/sh', f.name] + cmd, **kwargs)
  File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/bin/sh', '/tmp/tmpsct8tq5m', '/tmp/tmpflw5zmz4']' returned non-zero exit status 1

That trace only mentions the temporary file where the script is copied and executed. It doesn't mention anything useful to understand the problem.

Lots of improvements are possible there. First, mention the script that causes the failure (i.e. prepare/build/install). Then, it's possible to show more than the exit status because stderr is likely to contain some useful details.

Tags: scripts
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.