Rust plugin fails when using .cargo/config file

I have been experiencing an issue that arises when cross compiling Rust snaps. I believe this issue is caused due to the way the Rust plugin writes out a .cargo/config file which overrides the one in the project source directory and then cargo also does not seem to pick up this config file.

I took a stab at fixing this with this PR: https://github.com/snapcore/snapcraft/pull/2264
With this change I am able to cross compile my snap now, the approach I took was to add command line arguments to cargo rather than writing to that config file.

Hopefully someone can review this so it can be included in the next release!

@sergiusens @kyrofa @kalikiana @elopio

I will take a look as soon as I can. But I can see why I ignored it, the tests are failing. Is this a plea for help on python specifics? We usually require that at least the static tests (flake8, mypy, black, shellcheck) pass to start reviewing.

Thanks, that would be helpful, I am relatively new to Python and not familiar with the project conventions.

Yeah I saw that but I am not sure what the issue is, I saw a lot of tests fails for some other PRs so I assumed it was unrelated to my change. I tried running the command the CI server is failing on locally and I get this:

$ ./runtests.sh static
Running black
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\snapcraft\internal\deltas\_deltas.py
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\snapcraft\internal\lifecycle\_packer.py
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\snapcraft\plugins\rust.py
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\tests\unit\build_providers\multipass\test_instance_info.py
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\tests\unit\lifecycle\test_status_cache.py
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\tests\unit\lifecycle\test_lifecycle.py
would reformat C:\Users\eberkundrevnig\Desktop\Code\snapcraft\tests\unit\project_loader\grammar_processing\test_global_grammar_processor.py
All done! πŸ’₯ πŸ’” πŸ’₯
7 files would be reformatted, 598 files would be left unchanged.

@sergiusens Actually nevermind that last post, I figured it out and fixed the failing tests.

1 Like

Hey @sergiusens I know you are busy but have you had any chance to look at this yet? I am happy to assist if an alternative approach is deemed more suitable or I can help with reproducing the issue the PR fixes if that’s necessary.