Catkin plugin: consider only 'local' workspaces
Metadata
Current evaluation
Merged. Fixes catkin plugin dependency resolution in destructive mode by passing the --local flag when sourcing ROS setup scripts. This prevents host ROS paths from leaking into workspace searches. Approved by three reviewers.
Suggested action: —
No scores available.
Issue body
This PR fixes a bug when calling snapcraft with `--destructive-mode`.
Some installation paths from the host machine leak into the list of paths considered by the catkin plugin. It results in having dependencies being found (in the host path) and thus not being installed by the plugin in the expected 'parts' path.
In the 'pull' step, prior to building, the ROS dependencies of the package(s) to be built are retrieved.
When checking whether a dependency is available 'locally' or should be installed, the `catkin_find` tool will look into workspaces exported in `CMAKE_PREFIX_PATH` among other paths:
[`catkin_find` calls `find_in_workspaces`](https://github.com/ros/catkin/blob/kinetic-devel/bin/catkin_find#L41) which in turns [calls `get_workspaces`](https://github.com/ros/catkin/blob/kinetic-devel/python/catkin/find_in_workspaces.py#L114) which [retrieve those from `CMAKE_PREFIX_PATH`](https://github.com/ros/catkin/blob/kinetic-devel/python/catkin/workspace.py#L46).
Now, in order for `catkin_find` to work, some ROS-related environment variables are exported by sourcing an automatically generated (ag.) script.
The ag. script `opt/ros/melodic/_setup_util.py` (called by ag. `opt/ros/melodic/setup.sh`) [sets the variable `CMAKE_PREFIX_PATH` to `/opt/ros/<distro>`](https://github.com/ros/catkin/blob/kinetic-devel/cmake/templates/_setup_util.py.in#L273) by default. This results in having the path to the ROS install on the host being searched when looking for packages.
To prevent looking into `CMAKE_PREFIX_PATH`, the flag `--local` is passed to `opt/ros/<distro>/setup.sh` when sourcing it.
- [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 `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Fixes catkin plugin dependency resolution in destructive mode by passing the --local flag when sourcing ROS setup scripts. This prevents host ROS paths from leaking into workspace searches. Approved by three reviewers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix for the catkin plugin where destructive-mode leaked host ROS paths into dependency resolution. The change passes the --local flag to setup.sh, restricting catkin_find to local workspaces only. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a catkin plugin fix where destructive mode leaked host paths into dependency resolution. Passing the --local flag when sourcing ROS setup scripts restricts workspace searches to local paths, ensuring dependencies install correctly within the snap. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2585 catkin plugin: check workspace for dependencies | snapcraft | merged | Merged. Resolves LP: #1832044 by updating the Catkin plugin to use rospack for workspace dependency resolution instead of relying solely on the rosdep index. Approved by reviewers and passed all CI checks. | |
| #1832044 Catkin plugin doesn't check the workspace for dependencies | snapcraft (launchpad) | closed | The catkin plugin incorrectly errors on workspace-local dependencies due to a rosdep bug. The report was closed without a fix or resolution. | |
| #1743 catkin plugin: support building entire workspace | snapcraft | merged | Merged. The catkin-packages property is now optional. When omitted, the plugin builds the entire workspace. Resolves LP: #1721168. Approved by two reviewers with passing CI checks. | |
| #1526 catkin plugin: don't assume catkin is in underlay | snapcraft | merged | Merged fix updating the catkin plugin to use its isolated installation instead of assuming catkin exists in the underlay. Resolves Launchpad bug #1696014. Includes reviewer-requested test naming updates. Approved and merged. | |
| #842 Catkin plugin: Support ROS Kinetic. | snapcraft | merged | Merged. Adds ROS Kinetic support to the Catkin plugin by refactoring source handling for extensibility and mapping ROS to Ubuntu releases. Fixed a fileutils coverage gap during review. Approved and merged. | |
| #195 Catkin plugin: Improve cmake path rewrite. | snapcraft | merged | Merged updates to the Catkin plugin that replace hard-coded cmake path rewrites with a generic, robust approach. The change modifies two files to correctly redirect ROS package Config.cmake files to the install directory. | |
| #331 Catkin plugin: Handle rosdep empty and multiple dependencies. | snapcraft | merged | Merged refactoring of the Catkin plugin rosdep resolver to handle empty results and multiple dependencies per line. Fixes Launchpad bugs #1548406 and #1548404. Approved by maintainer sergiusens. | |
| #152 Catkin plugin: Add support for ROS tools. | snapcraft | merged | Merged Catkin plugin updates to properly install ROS packages, include non-source files, and enable ROS tools via an updated wrapper environment. Resolved an xml2-config conflict while planning to remove the redundant roscore plugin. Tests doubled. |