Closed abulka closed 1 year ago
/bin/bash: line 52: sudo: command not found
[Edit] sorry for the quick message. You'll need to get sudo added to the snap or just remove that line if you don't want curl.
Thanks - though I wonder how you manage to build the snap yourself, if the snap doesn't have sudo. I managed to fix it by adding
override-pull: |
apt update <----
apt install -y sudo <----
sudo apt install -y curl
....
to chirp's snapcraft.yaml
.
P.S. I've used your chirp snapcraft.yaml as a template for my own project but getting an error - the build script is attempting to create a virtual environment using the venv module, but it does not have permission to write to the /root/parts/build-the-python-stuff-please/install directory.
2023-03-11 19:00:24.373 :: to prefix=/root/parts/build-the-python-stuff-please/install/usr
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:20.300 remove directory /root/parts/build-the-python-stuff-please/build
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.125 Executing PosixPath('/root/parts/build-the-python-stuff-please/run/build.sh')
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.151 :: + python3 -m venv /root/parts/build-the-python-stuff-please/install
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.625 :: Error: [Errno 13] Permission denied: '/root/parts/build-the-python-stuff-please/install/bin/python3'
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.635 Failed to run the build script for part 'build-the-python-stuff-please'.
build-the-python-stuff-please:
plugin: python
source: .
build-environment:
# WORKAROUND: The python plugin is broken with gnome extension
- PATH: ${CRAFT_PART_INSTALL}/bin:${PATH}
- PYTHONPATH: ""
stage-packages:
- python3-requests
- python3-serial
- python3-six
- python3-suds
- python3-future
- python3-yattag
- python3-wxgtk4.0
stage:
# WORKAROUND: Skip venv from python plugin
- -bin/activate
- -bin/activate.csh
- -bin/activate.fish
- -bin/Activate.ps1
- -bin/python
- -bin/python3
- -bin/python3.10
- -bin/pip
- -bin/pip3
- -bin/pip3.10
- -pyvenv.cfg
python-requirements:
- /root/project/.requirement-extras/requirements-linux-22.txt
organize:
usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio/libpulsecommon-15.99.so: usr/lib/$CRAFT_ARCH_TRIPLET/libpulsecommon-15.99.so
# override-build: |
# install -Dm644 "snap/gui/pynsource.desktop" -t "$CRAFT_PART_INSTALL/usr/share/applications/"
# craftctl default
Any ideas appreciated. Perhaps this is a side effect of your workarounds removing venv
(as per your comment). But then why does my project want to use venv and yours does not?
CHIRP has an override-pull
section but it never actually calls craftctl default
(this goes hand in hand with the source: NOT_USED.zip
) Is that venv error coming from the pull step?
Unlike yours, my snapcraft.yaml
doesn't have an override-pull section as I want to build from source: .
The venv
error I think is thus coming from the build step:
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:06.556 Executed: overlay gnome/sdk
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:06.556 Executing parts lifecycle: build build-the-python-stuff-please
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:06.557 Executing action
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:06.557 execute action build-the-python-stuff-please:Action(part_name='build-the-python-stuff-please', step=Step.BUILD, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:06.557 load state file: /root/parts/build-the-python-stuff-please/state/pull
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:12.486 fix artifacts: unpack_dir='/root/parts/build-the-python-stuff-please/install'
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:12.496 fix symlink: path='/root/parts/build-the-python-stuff-please/install/usr/share/X11/rgb.txt', unpack_dir='/root/parts/build-the-python-stuff-please/install', root='/root/parts/build-the-python-stuff-please/install/usr/share/X11'
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:12.526 fix symlink: target='/root/parts/build-the-python-stuff-please/install/etc/X11/rgb.txt'
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:13.056 For pkg-config file /root/parts/build-the-python-stuff-please/install/usr/share/pkgconfig/shared-mime-info.pc, prefix was changed from prefix=/usr
2023-03-11 19:00:24.373 :: to prefix=/root/parts/build-the-python-stuff-please/install/usr
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:20.300 remove directory /root/parts/build-the-python-stuff-please/build
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.125 Executing PosixPath('/root/parts/build-the-python-stuff-please/run/build.sh')
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.151 :: + python3 -m venv /root/parts/build-the-python-stuff-please/install
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.625 :: Error: [Errno 13] Permission denied: '/root/parts/build-the-python-stuff-please/install/bin/python3'
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.635 Failed to run the build script for part 'build-the-python-stuff-please'.
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.671 Traceback (most recent call last):
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.671 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/step_handler.py", line 144, in _builtin_build
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 subprocess.run(
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/usr/lib/python3.8/subprocess.py", line 516, in run
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 raise CalledProcessError(retcode, process.args,
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 subprocess.CalledProcessError: Command '['/root/parts/build-the-python-stuff-please/run/build.sh']' returned non-zero exit status 1.
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 The above exception was the direct cause of the following exception:
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 Traceback (most recent call last):
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/parts.py", line 171, in run
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 aex.execute(action, stdout=stream, stderr=stream)
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 304, in execute
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 self._executor.execute(actions, stdout=stdout, stderr=stderr)
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 128, in execute
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 self._run_action(act, stdout=stdout, stderr=stderr)
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 193, in _run_action
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 handler.run_action(action, stdout=stdout, stderr=stderr)
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 168, in run_action
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 state = handler(step_info, stdout=stdout, stderr=stderr)
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 305, in _run_build
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 self._run_step(
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 489, in _run_step
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 return step_handler.run_builtin()
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/step_handler.py", line 106, in run_builtin
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 return handler()
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/step_handler.py", line 152, in _builtin_build
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 raise errors.PluginBuildError(part_name=self._part.name) from process_error
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 craft_parts.errors.PluginBuildError: Failed to run the build script for part 'build-the-python-stuff-please'.
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 The above exception was the direct cause of the following exception:
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 Traceback (most recent call last):
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 294, in _run_command
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 _run_lifecycle_and_pack(
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 337, in _run_lifecycle_and_pack
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 lifecycle.run(
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 File "/snap/snapcraft/8931/lib/python3.8/site-packages/snapcraft/parts/parts.py", line 186, in run
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 raise errors.PartsLifecycleError(str(err)) from err
2023-03-11 19:00:24.373 :: 2023-03-12 00:00:21.672 snapcraft.errors.PartsLifecycleError: Failed to run the build script for part 'build-the-python-stuff-please'.
2023-03-11 19:00:25.974 Failed to execute pack in instance.
Could you send me a PR to https://github.com/goldstar611/atestsnap with your snapcraft.yaml file? I'd like to see if Canonical's build servers fail in the same way. One thing I noticed was that sometimes local snap development didnt fail in the same way as the remote builders.
I've done two PR's, the first is just my full snapcraft.yaml
file. The other is the entire project I'm trying to build.
Interestingly, in the full project copy, building the snap didn't give me a python3 -m venv
related error but gave me a snap "pynsource": path "bin/python3" does not exist
error. Not sure why the error changed - am running locally in a ubuntu 22.04 VM. There is also a github action .github/workflows/build-snap.yml
which has in the past given me the same errors as locally.
Hey Andy, I'm going to close the issue here but I'm curious if you ever got a sufficient workaround to some of the snap issues you faced (cant release because of symlink error, and such).
Yes I did - the new version of snapcraft 7.3.1.post21+gitfa823013
from edge or later removes the need for all workarounds. Can't wait for it to be available in stable so that GitHub Actions and other build tools can use it.
Thanks for asking!
Following up from the discussion https://forum.snapcraft.io/t/failed-to-release-snap/33879/7 on your workarounds to get wxpython snaps working with core22 etc and bypass the gnome plug incompatibilities. You said:
So, trying to use your project as a working example, which I can later copy into my project. I forked your project and tried to build it, but got an error straight away.
the tail of the full log is