core22 colcon plugin: re-source environment after installation
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint`?
- [x] Have you successfully run `pytest tests/unit`?
-----
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 PR does:
- Add missing spread entry for `colcon` specific tests
- Add `package-utils.sh` to restore the state of Debian package installed before a spread tests
- Add a `colcon` spread test with a message package to highlight that there is a bug
- Fix the bug by sourcing the ROS 2 environment after installing the ROS 2 dependencies
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Fixed core22 colcon plugin by re-sourcing the ROS 2 environment after dependency installation, resolving custom interface build failures. Added spread tests and package-utils.sh. Approved after reviewer discussion on LXD handling. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for the core22 colcon plugin that re-sources the ROS 2 environment after dependency installation, resolving custom interface build failures. Adds spread tests and package-utils.sh to validate the change and prevent regressions. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4054 core22 colcon plugin: re-source environment after installation (#3994) | snapcraft | merged | 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. | |
| #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. | |
| #3750 Add core22 colcon plugin / ros2-humble extension | snapcraft | merged | Merged into main. Introduces the core22 colcon plugin and ros2-humble extension to Snapcraft. Approved by two reviewers, passed CI checks, and integrated with a minor test coverage decrease. | |
| #3536 ROS plugins v2 misc fixes | snapcraft | merged | Merged. Fixes ROS plugins v2 staging failures by checking local ROS directories and skipping rosdep resolution for locally available packages. Updated tests for core20. Approved by two reviewers and passed CI. | |
| #3358 Fix colcon v1 workspace sourcing | snapcraft | merged | Merged a fix correcting colcon v1 workspace sourcing to use the proper overlay script, resolving a build repetition issue. Approved by two reviewers, passed CI, and applied a minimal two-file change per ROS2 documentation. | |
| #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. | |
| #3664 ROS plugins v2: respect source-subdir key | snapcraft | merged | Merged. Updates ROS plugins v2 to respect the source-subdir key, removes an unnecessary catkin_tools dependency, and adds tests for Colcon and catkin v2 subdir handling. Approved by reviewers and passed CI. | |
| #2835 colcon plugin: support ROS 2 Eloquent | snapcraft | merged | Merged after adding ROS 2 Eloquent Elusor support to the colcon plugin. Approved by two reviewers, passed CI checks, and updated two files with minimal changes. | |
| #3097 colcon v2 plugin + ros2 extension | snapcraft | closed | Closed without merging. The colcon v2 plugin and ros2 extension request remained in pending review with 50 unresolved comments and no CI checks, indicating it was abandoned. |