snapcraft clean snapcraft fails as it cannot find python

Bug #1778716 reported by Sergio Schvezov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Kyle Fazzari

Bug Description

Building snapcraft with current master or the latest edge (13881c35fa806ff9fe029205737a49393fd48a38) one cannot clean snapcraft with snapcraft due to python3 missing after init. I suspect this is an ordering issue triggering the failure (as it could have failed before too):

Consider that the project was fully primed, so python3 could have been found at one point.

```
$ snapcraft --debug clean snapcraft
Starting snapcraft 2.42.1+git26.4602d03 from /snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/cli.
Setting up part 'snapcraft' with plugin 'python' and properties {'stage': [], 'prime': [], 'override-build': 'snapcraftctl build\nTRIPLET_PATH="$SNAPCRAFT_PART_INSTALL/usr/lib/$(gcc -print-multiarch)"\nLIBSODIUM=$(readlink -n $TRIPLET_PATH/libsodium.so.18)\nln -s $LIBSODIUM $TRIPLET_PATH/libsodium.so\npatch -d $SNAPCRAFT_PART_INSTALL/lib/python3.5/site-packages -p1 < /home/sergiusens/source/snapcraft/stage/pyyaml-support-high-codepoints.diff\npatch $SNAPCRAFT_PART_INSTALL/usr/lib/python3.5/ctypes/__init__.py /home/sergiusens/source/snapcraft/stage/ctypes_init.diff\n', 'source': '.', 'build-packages': ['build-essential', 'libapt-pkg-dev', 'libffi-dev', 'libssl-dev', 'libsodium-dev', 'liblzma-dev', 'patch', 'sed'], 'requirements': 'requirements.txt', 'override-prime': "snapcraftctl prime\n# Now that everything is built, let's disable user site-packages\n# as stated in PEP-0370\nsed -i usr/lib/python3.5/site.py -e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/'\n# This is the last step, let's now compile all our pyc files.\n./usr/bin/python3 -m compileall .\n", 'stage-packages': ['apt', 'apt-utils', 'binutils', 'execstack', 'gpgv', 'libffi6', 'libsodium18', 'patchelf', 'squashfs-tools', 'xdelta3'], 'plugin': 'python'}.
Setting up part 'patches' with plugin 'dump' and properties {'prime': ['-*.diff'], 'stage': [], 'source': 'patches', 'plugin': 'dump'}.
Setting up part 'bash-completion' with plugin 'dump' and properties {'prime': [], 'stage': ['snapcraft-completion'], 'source': 'debian', 'plugin': 'dump'}.
Cleaning pull step (and all subsequent steps) for snapcraft
Traceback (most recent call last):
  File "/snap/snapcraft/1674/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.42.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/cli/lifecycle.py", line 198, in clean
    lifecycle.clean(project, parts, step)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_clean.py", line 205, in clean
    _clean_parts(parts, step, config, staged_state, primed_state)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_clean.py", line 63, in _clean_parts
    part_name, step, config, staged_state, primed_state)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/lifecycle/_clean.py", line 36, in _clean_part
    config.parts.clean_part(part_name, staged_state, primed_state, step)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/project_loader/_parts_config.py", line 181, in clean_part
    part.clean(staged_state, primed_state, step)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 735, in clean
    project_staged_state, project_primed_state, step)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 773, in _clean_steps
    self.clean_pull()
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 397, in clean_pull
    self.plugin.clean_pull()
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/plugins/python.py", line 218, in clean_pull
    self._pip.clean_packages()
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/plugins/python.py", line 187, in _pip
    stage_dir=self.project.stage_dir)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/plugins/_python/_pip.py", line 133, in __init__
    install_dir=self._install_dir)
  File "/snap/snapcraft/1674/lib/python3.5/site-packages/snapcraft/plugins/_python/_python_finder.py", line 51, in get_python_command
    python_command_name, [stage_dir, install_dir])
snapcraft.plugins._python.errors.MissingPythonCommandError: Unable to find python3, searched: /home/sergiusens/source/snapcraft/stage:/home/sergiusens/source/snapcraft/parts/snapcraft/install
```

tags: added: 18.10-build-caching
Revision history for this message
Kyle Fazzari (kyrofa) wrote :
tags: removed: 18.10-build-caching
Changed in snapcraft:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Kyle Fazzari (kyrofa)
Changed in snapcraft:
milestone: none → 2.43
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
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.