core22 colcon plugin: re-source environment after installation (#3994)
Metadata
Current evaluation
Merged PR resolves Core22 colcon plugin bug where premature ROS 2 environment sourcing caused PYTHONPATH errors for custom interfaces. Fixed by re-sourcing after dependency installation. Also adds missing spread tests and a package state helper script.
Suggested action: —
No scores available.
Issue body
Core22 ROS 2 colcon snaps couldn't build packages creating custom ROS 2 interfaces. It was sourcing the environment before downloading the dependencies. Some dependencies (rosidl) have specificities when sourced, hence sourcing before downloading them causes issues.
In the case of ROS 2 message, the PYTHONPATH only had the site-packages subdir and not the dist-packages subdir added by rosidl.
This issue couldn't appear with lxd spread tests because the lxd environment was not cleaned properly by colcon spread tests (Debian packages were still installed, hence the dependencies were mostly already installed).
Additionally, the advanced colcon spread tests had no entry in the spread.yaml and were never called.
Hence, this code:
- Adds missing spread entry for colcon specific tests
- Adds package-utils.sh to restore the state of Debian package installed before a spread tests
- Adds a colcon spread test with a message package to highlight that there is a bug
- Fixes the bug by sourcing the ROS 2 environment after installing the ROS 2 dependencies
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `make lint`?
- [ ] Have you successfully run `pytest tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged PR resolves Core22 colcon plugin bug where premature ROS 2 environment sourcing caused PYTHONPATH errors for custom interfaces. Fixed by re-sourcing after dependency installation. Also adds missing spread tests and a package state helper script. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for the core22 colcon plugin resolving custom ROS 2 interface build failures by re-sourcing the environment after dependency installation. Added spread tests and helper scripts. Merged into hotfix/7.3. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for the core22 colcon plugin resolving custom ROS 2 interface build failures by sourcing the environment after dependency installation. Added missing spread tests and package-utils.sh. Integrated into hotfix/7.3. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3994 core22 colcon plugin: re-source environment after installation | snapcraft | merged | Merged fix for core22 colcon plugin that re-sources ROS 2 environment post-installation to resolve custom interface build failures. Added spread tests and package state restoration. Approved by two reviewers and merged. | |
| #3566 ROS 2 plugins v2 misc fixes | snapcraft | merged | Merged after resolving conflicts and passing CI. Fixes ROS 2 plugins v2 by updating the colcon install path, resolving local packages during staging by removing the COLCON_IGNORE marker, and adding spread tests. | |
| #2456 plugins: add colcon plugin | snapcraft | merged | Merged the colcon plugin for ROS2 builds, resolving LP: #1805213. Added as a beta feature, the change was approved by two reviewers, passed CI with 100% diff coverage, and introduced 2120 lines across 16 files. | |
| #6190 Add core26 support for the colcon plugin and extensions | snapcraft | open | Placeholder tracking task for adding core26 (Ubuntu 26.04) support to the colcon plugin and ROS 2 extensions. Core26 base support and the ros2-lyrical extensions have since landed, but no colcon-specific core26 work or PR is referenced; issue remains unlabelled with zero comments. |