Inconsistent results when building, cleaning stage and rebuilding

Bug #1757093 reported by Simon Hollenbach
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Triaged
Medium
Kyle Fazzari

Bug Description

As can be reproduced with this [snapcraft.yaml](1), a second run of `snapcraft` fails if the stage step has been cleaned. To overcome this, the build step has to be cleaned as well.

The following error is raised:
```
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.39.3+really2.35', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 19, in <module>
    run(prog_name='snapcraft')
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1037, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/__init__.py", line 124, in run
    ctx.forward(lifecyclecli.commands['snap'])
  File "/usr/lib/python3/dist-packages/click/core.py", line 552, in forward
    return self.invoke(cmd, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 140, in snap
    project_options, directory=directory, output=output)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_packer.py", line 45, in snap
    execute('prime', project_options)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 80, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 175, in run
    self._run_step(step, part, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 212, in _run_step
    getattr(part, step)()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 399, in stage
    self._organize()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 394, in _organize
    _organize_filesets(fileset.copy(), self.plugin.installdir)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 730, in _organize_filesets
    shutil.move(src, dst)
  File "/usr/lib/python3.5/shutil.py", line 547, in move
    " '%s'." % (src, dst))
shutil.Error: Cannot move a directory '/builddir/parts/boost/install/boost' into itself '/builddir/parts/boost/install/boost/boost/'.
```

This was discovered while [updating](2) the snap for Nextcloud to only use dump, not copy.

[1]: https://gist.github.com/r4co0n/765d99ec052d5e2daef1138731c5347c
[2]: https://github.com/nextcloud/nextcloud-snap/pull/466

Changed in snapcraft:
assignee: nobody → Kyle Fazzari (kyrofa)
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

This is because the organize is happening in the build step's area instead of as part of the staging step, which makes this a dupe of a bug that, yeah, really needs to be fixed.

Thanks Simon!

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.