Skip to content

feat(pixi-build-ros): RoboStack's build scripts, requirement rules and package names - #7535

Closed
Tobias-Fischer wants to merge 9 commits into
prefix-dev:mainfrom
Tobias-Fischer:pixi-build-ros-recipe-rules
Closed

Tobias-Fischer wants to merge 9 commits into
prefix-dev:mainfrom
Tobias-Fischer:pixi-build-ros-recipe-rules

Conversation

@Tobias-Fischer

Copy link
Copy Markdown
Contributor

Description

Stacked on #7533 and #7534; the four commits from 34a65ac onwards are this PR. Follow-up to #7526.


Apologies up front: this description and the implementation were written by AI agents (Claude) at @Tobias-Fischer's request; he asked me to say so. It's a draft until his own review and summary are done. It can also be split into three PRs (names, build scripts, requirement rules) if that's easier to review.

pixi-build-ros and RoboStack's recipe generator (vinca-rs) each had their own build scripts and rules for turning a package.xml into conda requirements, and they had drifted apart. As a result, pixi build built a ROS package differently from RoboStack's binaries. This PR makes pixi-build-ros the single place for both. RoboStack generates its ~2,500 recipes per distribution with these functions, and gets byte-identical recipes for all four distributions and five platforms.

What changes for pixi build users

  • Names: ROS 2 packages are ros2-<name>, as RoboStack publishes them (ros-<distro>-* remain as compatibility packages). The distribution comes from the mutex, which is now pinned: ros2-distro-mutex * <distro>_*. ROS 1 keeps ros-<distro>-<name>, because robostack-noetic only has those names.

  • Build scripts: RoboStack's. The ones here were behind:

    • they exported PY_VER=3, overriding rattler-build's;
    • they hardcoded ROS_PYTHON_VERSION=3 and macOS 11.0 instead of conda-forge's deployment target;
    • they lacked the cross-compilation fixes;
    • on Windows they used Ninja, which fails on long paths; Visual Studio is used instead.

    pixi build keeps its incremental mode: the build directory is kept and installed files are recorded in $RATTLER_BUILD_PACKAGE_FILES. CMake now reconfigures on every build, which is fast on a kept directory. ROS 2 cmake packages get the cmake script; ROS 1 keeps the catkin scripts.

  • Requirements:

    • ROS dependencies go to host only, no longer also to build, which is right for cross-compiling.
    • build holds compilers, cmake, ninja, cython (it said cpython), and the cross-compilation tools when cross-compiling.
    • Python, ros_workspace and ros_environment are handled as in RoboStack.

Library API for RoboStack's generator:

  • distro: package_prefix, conda_name, mutex_spec;
  • build_script: BuildType, BuildMode, ScriptVars, render_build_script;
  • requirements: Rules, Reqs, python_needed.

Not changed here: the docs' example ROS workspace still uses ros-jazzy-* names in its pixi.toml/pixi.lock. It needs a released backend to re-lock, so it should follow in a separate PR.

AI-generated details (Claude Opus 5.5)
  • The commit messages explain each snapshot change: names, the new build-script snapshots (incremental mode, Unix and Windows), and requirements (build = base list; host/run sorted, with ros_environment, ros_workspace and python).
  • Checks run: cargo test -p pixi-build-ros (79 + 23), cargo clippy -p pixi-build-ros --all-targets -- -D warnings, pixi run typos, dprint check, check-into-diagnostic.
  • RoboStack parity: vinca-rs with these functions vs. without, on RoboStack's monorepo, gives 44,950 identical recipes (humble, jazzy, lyrical, rolling × linux-64, linux-aarch64, osx-64, osx-arm64, win-64).
  • Kept for RoboStack and inert for pixi build: special cases for three WebAssembly packages' source folders, and opt-in VINCA_* environment variables. The build scripts' first line names whichever tool wrote them.

Checklist:

  • I've discussed the proposed changes with a maintainer.
  • I understand the purpose of my changes and how they interact with the greater system.
  • User-facing changes are documented and prose in the documentation has been written/edited/reviewed by hand.

🤖 Generated with Claude Code

Tobias-Fischer and others added 9 commits November 13, 2026 19:33
…ne lookup shared with RoboStack

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tic baseline

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replacing each identifier's text in the expression also hit it inside a longer
identifier: "LGPL-2.0 OR GPL-2.0" became "LGPL-2.0-only-only OR GPL-2.0".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nothing

`osx:` without a value made the whole mapping file fail to parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tack does

RoboStack's canonical names are now `ros2-<name>` for ROS 2 and `ros-<name>`
for ROS 1 (`ros-<distro>-<name>` are only compatibility aliases). The backend
now uses them for the package it builds, for unmapped and `ros:`-mapped
dependencies, and for workspace siblings (`Distro::conda_name`).

The names no longer say which distribution a package belongs to, so the distro
mutex in host and run is pinned to it: `ros2-distro-mutex * <distro>_*`
(`Distro::mutex_spec`; RoboStack builds the mutex with the build string
`<distro>_<build number>`). Merging that with a mutex the user declares (e.g.
`0.5.*`) needs merged specs to keep a build string: `merge_specs` now merges the
versions and keeps the build string of either side (conflicting build strings
are an error).

Snapshot changes:
- the jazzy inline snapshots (generate_recipe, condition_evaluation_*) name
  everything `ros2-<name>` instead of `ros-jazzy-<name>`, and the mutex is
  `ros2-distro-mutex * jazzy_*`
- every `ros-noetic-<name>` in the noetic fixtures is now `ros-<name>`, the
  package name `ros-noetic-custom-ros` is `ros-custom-ros`
- in the noetic .snap files `ros-distro-mutex` is `ros-distro-mutex * noetic_*` in host and run, and in
  generate_recipe_with_mutex_version the user's `0.5.*` merges into
  `ros-distro-mutex 0.5.* noetic_*`
- insta no longer writes `assertion_line` into the rewritten .snap files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The backend's templates were an old copy of RoboStack's, which have since
been fixed while building every package of RoboStack's distributions on five
platforms. Adopt those (they live here now, and RoboStack's recipe generator
renders them through this crate): among others the cross-compilation fixups,
the real `ROS_PYTHON_VERSION` (the old script exported `PY_VER=3`), conda's
macOS deployment target instead of a hardcoded 11.0, a `PYTHON_INSTALL_DIR`
that works without GNU realpath, the Visual Studio generator and short object
paths on Windows, and the ROS 2 `cmake` template (ROS 2 cmake/catkin packages
used the ROS 1 catkin template).

What differs between `pixi build` and a RoboStack recipe is a parameter:
- `ScriptVars::source_dir`: the manifest directory here, the checked-out source
  in a recipe (the templates no longer set `SRC_DIR`)
- `BuildMode::Incremental` keeps the build directory (the configure step is
  incremental too, so the `build.ninja` guard is gone) and lists what the
  build installed in `$RATTLER_BUILD_PACKAGE_FILES`, as before;
  `BuildMode::Clean` is RoboStack's fresh build

The catkin templates stay for ROS 1, with `@(package_prefix)-` instead of the
hardcoded `ros-noetic-` names. `BuildType::of` decides the template (no build
type plus an ament_cmake build tool is ament_cmake; catkin/cmake is the cmake
template in ROS 2 and the catkin one in ROS 1), and `ACTIVATION_SCRIPTS` are
ros_workspace's environment activation scripts.

New snapshots: the eight scripts `pixi build` runs (the incremental mode of
every template, for Unix and Windows).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`requirements::Rules` holds RoboStack's requirement rules, which this backend
and RoboStack's recipe generator now share:
- `Rules::requirements`: what every package builds with (compilers, the C
  stdlib, cython, the build tools, pkg-config/python/numpy and cross-python only
  when cross-compiling, clang-tools on macOS), Python in host and run, the
  pinned distro mutex, ros_environment/ros_workspace (except for the packages
  they are built from), and the package.xml dependencies: ROS and system
  dependencies in host (a format 1 `run_depend` too), build tools in host except
  git, which goes to build; run dependencies in run. How a dependency becomes
  conda specs is the caller's: here the package map, keeping package.xml's
  versions
- `Rules::finish`: build-time-only Python for a package without Python
  (RoboStack's opt-in conditional Python; off here), the cross-compiling and
  Emscripten rules (cmake, mimick_vendor, rosidl generators, pybind11, qt-main,
  build-machine tools native/cross), host and run sorted
- `Reqs`/`Req`: the requirement lists, with `if: build_platform != ...`
  entries; `package_xml_to_conda_requirements` turns them into the recipe's

Behaviour changes for `pixi build`: ROS and system dependencies are no longer
also in `build` (they are host dependencies; this is what makes cross-compiling
work), `stdlib('c')` is added when the variants have `c_stdlib`, `cpython` was
a typo for `cython`, setuptools only for ament_python, pkg-config/python/numpy
in build only when cross-compiling, and ros_workspace is a run dependency.

Snapshot changes, all from the above:
- build: only the base requirements (compilers first, `cython` instead of
  `cpython`, the cross-only pkg-config/python/numpy); no package.xml dependencies
- host: sorted; python/numpy/pip, `pkg-config` only when native, no
  setuptools, ros2-ros-environment for ROS 2
- run: sorted; python, and ros2-ros-workspace for ROS 2
- the package_xml_to_recipe_config tests and the condition-evaluation and
  workspace-discovery tests look at host instead of build

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uild scripts name their generator

- robostack-noetic only publishes ros-noetic-* (no ros-*): ROS 1 packages and
  their unmapped dependencies stay ros-<distro>-<name>, so that `pixi build` of a
  noetic workspace resolves. ROS 2 keeps ros2-<name>.
- The build scripts' first line names what wrote them (ScriptVars::generator):
  pixi-build-ros for `pixi build`, vinca-rs for RoboStack's recipes.

Snapshots: the noetic names (ros-noetic-*), and the scripts' first line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tobias-Fischer

Copy link
Copy Markdown
Contributor Author

Split into three drafts for easier review, as offered in the description: #7539 (names), #7540 (build scripts) and #7541 (requirement rules), stacked in that order. Two cuts along the way:

  • the snapshots of the rendered build scripts are gone (−749 lines; they repeated the templates);
  • ros_workspace's activation scripts stay in RoboStack's generator, because pixi build doesn't use them.

The ROS 1 naming fix from the last commit here is folded into #7539. Closing this one in their favour.

— Claude (on behalf of @Tobias-Fischer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant