"Environment validation failed for part 'xsv': 'cargo' not found" with `base: core22`

Bug #1990950 reported by Michał Sawicz
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

1. git clone https://github.com/snapcraft-docs/xsv.git
2. cd xsv
3. sed -i 's/base:.*/base: core22/' snapcraft.yaml
4. snapcraft

Launching instance...
Environment validation failed for part 'xsv': 'cargo' not found and part 'xsv' does not depend on a part named 'rust-deps' that would satisfy the dependency.
Full execution log: '/tmp/snapcraft.log'
Traceback (most recent call last):
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 448, in _run_in_provider
    instance.execute_run(cmd, check=True, cwd=output_dir)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
    return self.lxc.exec(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 329, in exec
    return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check
  File "/snap/snapcraft/8187/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-xsv-on-amd64-for-amd64-479080', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'snapcraft', 'pack', '--build-for', 'amd64']' returned non-zero exit status 1.

Revision history for this message
Michał Sawicz (saviq) wrote :

Adding a `after: [rust-deps]` doesn't help:

Launching instance...
Executed: pull xsv
Executed: overlay xsv
Environment validation failed for part 'xsv': 'cargo' not found.
Full execution log: '/tmp/snapcraft.log'
Traceback (most recent call last):
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/snapcraft/parts/lifecycle.py", line 448, in _run_in_provider
    instance.execute_run(cmd, check=True, cwd=output_dir)
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
    return self.lxc.exec(
  File "/snap/snapcraft/8187/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 329, in exec
    return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check
  File "/snap/snapcraft/8187/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-xsv-on-amd64-for-amd64-479080', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'snapcraft', 'pack', '--build-for', 'amd64']' returned non-zero exit status 1.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

is the dependency of providing cargo satisfied by the rust-deps part? Perhaps that is what needs to be made clearer.

Revision history for this message
Michał Sawicz (saviq) wrote :

If that's the case, shouldn't the plugin handle it?

https://snapcraft.io/docs/rust-plugin#heading--core22 does not mention `rust-deps`.

Revision history for this message
Michał Sawicz (saviq) wrote :

FWIW this is still the case.

tags: added: foundations-todo
tags: removed: foundations-todo
Revision history for this message
Zixing Liu (liushuyu-011) wrote :

This seems to be an issue with `craft-parts` (and the Rust plugin) having the `cargo` check before installing it.
I am unsure who to contact to correct this logic.

Revision history for this message
Zixing Liu (liushuyu-011) wrote :

Hi there,

I have opened a pull request on GitHub to address this issue: https://github.com/snapcore/snapcraft/pull/4297.

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.