← Back to issue list

Catkin plugin: consider only 'local' workspaces

View original Github issue

Metadata

Project
snapcraft
Number
#2847
Type
pull request
State
merged
Author
artivis
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #2847 (commit 1d476f622) sources ROS setup with --local, preventing destructive-mode Catkin builds from using host workspaces and skipping dependency installation.

Resolution: closed resolved

Reason: PR snapcraft#2847 was merged as commit 1d476f622. It adds --local when sourcing the ROS setup script so Catkin considers only the part-local workspace.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Merged PR #2847 (commit 1d476f622) sources ROS setup with --local, preventing destructive-mode Catkin builds from using host workspaces and skipping dependency installation.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#2847 as commit 1d476f622: Catkin now sources ROS setup with --local, preventing host workspace paths from masking dependencies in destructive-mode builds.
stealth/space-bunny-alpha — closed resolved Merged in snapcore/snapcraft#2847 (commit 1d476f622), adding --local when sourcing ROS setup so destructive-mode Catkin builds ignore host workspace paths and install missing dependencies.
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.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2585 catkin plugin: check workspace for dependencies snapcraft merged Merged PR #2585 (b88e37814) fixed Catkin builds by using rospack to enumerate workspace packages and exclude their internal dependencies from rosdep resolution; resolves LP #1832044.
78%
#1832044 Catkin plugin doesn't check the workspace for dependencies snapcraft (launchpad) closed Catkin plugin failed on whole-workspace builds because rosdep (#685) couldn't resolve deps satisfied by in-workspace packages. Workaround merged in snapcraft PR #2585 (commit b88e37814); the workaround was later dropped in #2833 once rosdep was fixed upstream.
77%
#1743 catkin plugin: support building entire workspace snapcraft merged Merged #1743 in commit ec4cac26a, making catkin-packages optional so the Catkin plugin builds the entire workspace when omitted; this also resolves snapcraft#1713.
74%
#2833 catkin: remove rospack workaround snapcraft merged Merged PR #2833 in commit 949f90946, removing the Catkin rospack workaround because rosdep can now ignore workspace source packages.
73%
#1721168 Catkin plugin: support building the entire workspace snapcraft (launchpad) closed Implemented in snapcraft PR #1743 (commit ec4cac26a, "catkin plugin: support building entire workspace"), merged ~Nov 2017. catkin-packages became optional: omitting it builds the whole workspace, while an empty list still means no packages.
73%
#1638317 Catkin plugin doesn't build pure python workspaces snapcraft (launchpad) closed Catkin plugin only staged g++ when roscpp was a dependency, breaking pure-Python ROS workspaces. Fixed by snapcore/snapcraft PR #881 (merged as 2f0c8ba04), staging gcc/g++ unconditionally; issue closed by maintainer ~kyrofa.
72%
#175 Catkin plugin: Refactor build. snapcraft merged Merged in snapcraft#175 via commit 9045874fd, refactoring Catkin environment, dependency handling, build logic, source-space support, and tests.
72%
#1713 catkin plugin: support for building all packages in a given workspace snapcraft closed Implemented workspace-wide Catkin builds: omitting catkin-packages now builds every package. Merged in canonical/snapcraft#1743 via commit ec4cac26a.
72%
#1239 catkin plugin: create completely valid environment snapcraft merged Merged PR #1239 (commit 449ad2634) fixing LP: #1674487: catkin plugin now sets LD_LIBRARY_PATH and a valid ROS_HOME before sourcing setup.sh, so build-time env matches runtime.
71%
#195 Catkin plugin: Improve cmake path rewrite. snapcraft merged Merged #195 via 0bb02b679 (merge commit 42b5e382c), replacing hard-coded Catkin Config.cmake paths with generic, robust rewrites to the install directory.
70%