Post

ROS Distribution Extensions

ROS Distribution Extensions

Abstract

The Distribution File has been established as an effective way to coordinate the distributed release of a large set of packages. These have been effectively defined and used in REP 141 and REP 143 (TODO LINKS). However as the community is growing we are encountering several use cases were the current system is cost prohibitive to use.

The implementation currently supports the main ROS distributions well. And it supports fully forking as an entire project which is valuable for deploying in high criticality situations. However full forks do not guarentee compatibilty with other projects. To that end we look to enable a new concept of extending a rosdistro.

At it’s core a rosdistro is a collection of software packages with an agreed upon minimum dependency level. Currently these dependencies are defined through the rosdep database as well as the platform guidances captured in REP 2000. There’s potentially a better locations for that but that’s separate.

What this REP is proposing is to enable one rosdistro to declare that it extends another rosdistro. This will mean that in the downstream distros they will inherit the minimum dependencies of the upstream distro. And simultaneously all of the packages from the upstream distro will be available as if they were in the derived distribution.

This will enable independent projects to leverage the rosdistro infrastructure as long as they are willing to coordinate their minimum dependencies. Examples of projects like this can include ROS and Gazebo, where the dependencies are already managed, but in addition the packages are manually synchorinized between the distros.

Furthermore this will enable other projects to leverage the community work and explicitly extend it and release things separately. This is expected to unlock both additional open source projects as well as well as commercial developers. The extended distros will be able to leverage the full open source release pipeline if they would like, but they can also do things like explicitly focus down the support targets or other elements of the distro. However the core element of it is that as long as the derived distros extend the same compatible base distros and their communication dependencies are shared they will be compatible and be able to work together on a system.

In the abstract this is moderately simple, but the challenges will be in how to coordinate support for cross references between the distros as well as conflict detection and defining how different distributions channels interact. To get the most value out of this we want to be able to leverage existing shared binary distributions without needing to rebuild all the content so this will include metadata to control the appropriate logic to clearly define how caching will work.

In addition a common use case can be to knockout and replace content for potentially a specific requirement although this will potentially break compatibility it should be possible to do with the caveats that compatibiltiy will no longer be guarenteed.

There is also the potential that the ROS project may want to choose to separate the releases into tiers of releases which can differentiate is a similar way to Ubuntu does main universe multiverse differentation. This may be particularly valuable if the different tiers potentially have different supported Target Platforms.

Motivation

The goal of this extension is to make it easier for projects to collaborate. Four use cases drive the design, from two public projects coordinating their releases to a private team building on top of both.

Use Case 1 - Public Project Coordination

Two major projects that can be represented as distros are the ROS and Gazebo projects. ROS is already managed explicitly as a distro. Gazebo is also effectively managed as a distro, but is not formalized in the same way. And when ROS imports Gazebo as a dependency it is done manually. The goal of this proposal is to enable this dependency to be explicitly modelled and to automate that import and coordination process. Furthermore we can also reduce the need for very similar test and build infrastructure.

With extensions, Gazebo Rotary (the rolling distro) becomes a rosdistro, released with the same tooling and infrastructure as ROS, and ROS Rolling declares that it extends it. Rolling imports the binaries of an explicitly chosen Gazebo sync release instead of rebuilding them.

Use Case 2 - Externally Managed Distro Extension

The above use case covers the coordination of major projects between each other. A closely related one is an external maintainer who wants to maintain packages that are compatible with the public distribution but keep them in a separate source. The packages may need a different release cadence or trust level, or may not comply with the upstream policies: a license that is not OSI approved, packages too large for the standard releases, or builds that need special hardware. A vendor redistributing a hardware driver with a binary blob to its customers falls in this case.

With extensions, the third party maintains its own distro that extends the public one, and its packages are used together with the upstream repositories. Users explicitly add and trust the extra package repository on their system.

Use Case 3 - Private Distro Extension

In the previous use case the extension is public, but there are also many cases where someone may want to extend a ROS distro in a binary compatible way and keep the results private: commercial software behind a paywall or subscription, packages for internal use on an intranet or VPN, or the customized support of a robot. A lab manager or TA could also create an example scenario for a project, and each student would extend it with their own rosdistro, relying on binary builds of the core and shared packages and only building their own.

With extensions, the private distro extends a public one and produces only the extra packages, which stay compatible with the upstream users. As in the previous use case, users enable the extra repository.

Use Case 4 - Private Distro Rebuild + Extend

The previous use cases build new packages on top of the upstream binaries. A maintainer could instead rebuild the upstream packages from source, for improved trust in the binaries at the cost of additional computation.

With extensions, the distro selects the source_rebuild extension method instead of binary_import, and can still add its own packages. The rebuilt packages are named after the extension distro, not the upstream one, because they could end up binary incompatible. This also allows overriding a specific upstream package, at the risk of breaking ABI and API compatibility, with the maintainer setting their own compatibility and stability expectations.


classDiagram
    ProjectXDistroBaz *-- ROSDistroBar : Extends
    ProjectYDistroBaz *-- ROSDistroBar : Extends
    ROSDistroBar *-- GazeboDistroFoo : Extends


    class ProjectXDistroBaz{
      Project X packages list
      Minimum Dependencies( rosdep sources list)
      TargetPlatforms(Ubuntu X, RHEL Z, Conda) (SUBSET REQUIRED)
    }
    class ProjectYDistroBaz{
      Project Y packages list
      Minimum Dependencies( rosdep sources list)
      TargetPlatforms(Ubuntu X, RHEL Z, Conda) (SUBSET REQUIRED)
    }
    class ROSDistroBar{
      ROS Bar packages list
      Minimum Dependencies( rosdep sources list )
      TargetPlatforms(Ubuntu X, Debian Y, RHEL Z, Conda) (SUBSET REQUIRED)
    }
    class GazeboDistroFoo{
      Gazebo Foo packages list
      Minimum Dependencies( rosdep sources list )
      TargetPlatforms(Ubuntu X, Debian Y, RHEL Z, HomeBrew, Conda)
    }

Specification

Distribution File Version 3

Extending the definion in REP-0143

  • Add an optional extends element which is an array of items with the following required elements
    • index url - The maintained URL to find the index which contains the distro (requires index v4) (Optional, if not set look in current location)
    • distro_name - The distro name to use inside the index
    • extension_method - Either binary_import which implies that the packages will be used as distributed upstream with their original name, or source_rebuild which will cause the packages to be rebuilt and redistributed with the derived distro’s name. Aka ros-rolling-foo imported to bar distro will be rebuild ros-bar-foo with the same source as ros-rolling-foo.

Packages found in the upstream repositories first will take precedence. So the first extends distro with a matching package will match. Where content in the distro itself takes precedence over any package in the extensions.

// TODO maybe add an option no-package-masking to throw an error if there is a collision in the case that you want to guarantee compatibility.

  • Add an optional dependencies array, with the following required in the elements if the elements are present
    • rosdep_sources_list_url pointing to a rosdep sources list
    • rosdep_minimum_target_platforms An array of target platform keys in the rospkg definition, OS_NAME:OS_VERSION (TODO Check OS_CODENAME)

As an example ROS Kilted will use:

1
2
3
4
5
6
7
8
9
10
11
  dependencies:
  - * rosdep_sources_list_urls:  
    - yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
    - yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
    - yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
    * rosdep_minimum_target_platforms:
    - ubuntu:noble
    - debian:bookwork
    - rhel:9
    - windows:10

// Allows bloom to only use the official ones // TODO enables dynamics rpm work more, especially grabbing snapshots

To indidcate that these rosdep sources will be maintained for this distro. If the distro is EOL’d then these should be changed to be snapshots instead of actively maintained urls.

It is also strongly recommended to point extensions to snapshots of distros when doing a binary_import so that resources can be invalidated appropriately and trigger rebuilds as necessary.

Release Build File Version 3

This extends Release Build File Version 1 defined in REP-0141

If necessary we will extend this file for the binary imports it’s likely that the repositories and snapshots will be adaquate. For the source based imports the existing build file options should be inhereted.

For binary_import the binary artifacts place to import is going to be necessary to bring in. This may make sense to keep in the implementation specific _config.

The implementation should be updated to warn if the target platforms is outside of the set that the base distros have declared.

Index File v4 New Key

To annotate the time at which a distribution will go unsupported we define an optional key: distribution_eol_date which takes a yaml date as the argument in the date only ISO8601 format YYYY-MM-DD

This will allow tools to process and warn about missmatched or impending eol dates.

Binary Package Name Transformation

To support cross-distribution extensions, upstream binary package name formatting must be configurable in an ecosystem-agnostic manner. Different packaging ecosystems follow distinct naming conventions:

  • Standard ROS distributions prefix packages with ros-{distro}- and normalize underscores to dashes (e.g., std_msgs $\rightarrow$ ros-rolling-std-msgs).
  • Standalone / Upstream distributions (such as Gazebo) provide native binary package names without ROS prefixes (e.g., gz-sim10 or gz-cmake5).
  • Custom vendors / overlays may require specific prefix templates, regular expression rewrites, or custom vendor namespaces (e.g., vendor-{distro}-{package}).

Design Explorations & Architectural Decision

To determine the optimal mechanism for binary package name transformations, three distinct approaches were explored:

  1. Exploration 1: Template Engines (empy / jinja2): Evaluated dynamic template evaluation using EmPy (@(...)) or Jinja2 (``) expressions to allow programmatic formatting, token splitting, and conditional logic (e.g., conditionally prefixing based on package name prefix).
    • Assessment: Highly expressive, but introduces external third-party library dependencies (empy or jinja2) to low-level, foundational bootstrapping tools (rosdistro, rosdep, and bloom). In containerized, hermetic, or embedded ROS environments, adding template engine dependencies complicates packaging, bootstrapping, and increases maintenance overhead.
  2. Exploration 2: Sequential Multi-Rule Regex Pipeline (binary_name_rules): Evaluated a sequential list of chained regex replacement rules executed in order.
    • Assessment: Allows multi-stage substitutions, but introduces unnecessary parsing complexity and potential chaining side-effects for standard distribution and vendor overlay workflows.
  3. Exploration 3: Declarative Regex Search-and-Replace (binary_rule) — Selected Approach: Evaluated a single, lightweight declarative regex substitution rule (search and replace) executed via Python’s built-in re module.
    • Assessment & Decision: Selected for implementation and testing. It offers maximum simplicity, zero additional external library dependencies, and predictable execution across all tools. It easily satisfies all target use cases:
      • Custom vendor prefixing: search: '^', replace: 'vendor-{distro}-' (e.g., vendor-extendable-upstream-a).
      • Native, un-prefixed package names for standalone ecosystems (e.g., Gazebo): search: '^', replace: ''.
      • Exact package renames: search: '^gz-cmake$', replace: 'libgz-cmake5-dev'.

Specification & Schema

A distribution file, repository specification, or an entry in extends can specify binary package name transformations using the binary_rule directive.

The directive defines a regular expression search-and-replace rule applied via Python’s built-in re.sub(rule['search'], rule['replace'], sanitized_package):

  • Distribution-level vendor prefixing (applied globally to all packages in the distribution or within an extends entry):
    1
    2
    3
    4
    
    # At distribution level or within an extends entry:
    binary_rule:
      search: "^"
      replace: "vendor-{distro}-"
    
  • Native package names without prefixes (for standalone ecosystems such as Gazebo):
    1
    2
    3
    4
    
    # In Gazebo distribution.yaml (e.g. jetty):
    binary_rule:
      search: "^"
      replace: ""
    
  • Repository-level overrides (declared within repositories -> <name> -> release to override the distribution rule for specific libraries):
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    repositories:
      gz_cmake:
        release:
          url: https://github.com/gazebosim/gz-cmake-release.git
          version: 5.1.1-2
          tags:
            release: gz-cmake5_{version}
          packages: [gz_cmake5]
          binary_rule:
            search: '^gz-cmake5$'
            replace: 'libgz-cmake5-dev'
    

Available Template Variables

When evaluating regex replace patterns, the following canonical lowercase variables are precomputed and interpolated:

  • {distro}: The active or target distribution name with underscores converted to hyphens (e.g., rolling, lyrical, extendable).
  • {package}: The source package name with underscores converted to hyphens.
  • {origin_distro}: The original upstream distribution name where the package was declared (useful when resolving imported binaries across layered distributions).

Evaluation Order & Precedence

To resolve a source package name into its OS binary package name, rosdistro evaluates rules in the following deterministic order:

  1. Repository-Level Rule (binary_rule): If binary_rule is defined in the release repository specification, that rule takes precedence (allowing per-repository overrides).
  2. Distribution-Level Rule (binary_rule): If no repository-level rule exists, the global binary_rule defined at the distribution (or extends) level is applied.
  3. Default ROS Canonical Format: If no custom rules are defined, the standard canonical format is produced: ros-{distro}-{package}.

Reverse Binary Alias Resolution

Downstream tools (rosdep, build farms, release indexers) must resolve OS binary package names back to their original source package names. Resolution operates via DistributionFile.get_package_name_from_binary(binary_name):

  • Deterministic Reverse Mapping (Primary): Tools construct an in-memory inverted dictionary mapping {evaluated_binary_name: source_package_name} across all release packages in the distribution and its parent inheritance chain.
  • Canonical Prefix Inversion (Fallback): If the binary name starts with ros-{distro}-, the prefix is stripped to match candidate package names.

Binary Import Behavior

When extending with the binary_import mechanism, upstream binary packages are directly imported as pre-built Debian/RPM artifacts from target repositories and consumed without rebuilding from source.

Renaming & Underlay Resolution

  • Standard Canonical Import: If no renaming rules are specified, imported packages retain their upstream names (e.g., ros-kinetic-pkg-name) and install into their standard paths (e.g., /opt/ros/kinetic).
  • Declarative Renaming (binary_rule): When binary_rule is declared in the distribution or extends block (e.g., vendor-{distro}-*), imported packages are packaged, published, and consumed under their vendor-namespaced binary package names (e.g., vendor-extendable-upstream-c).
  • Dynamic Underlay Chaining (install_rule): Downstream packages compile against parent binary packages by dynamically locating and sourcing their custom installation prefix (ROS_BUILDFARM_PARENT_RESULT_SPACES=/opt/ros/<parent>), resolving shared libraries and CMake configuration files across the layered underlays.
  • Dependency Resolution via rosdep: rosdep delegates package name queries to rosdistro, ensuring that downstream package manifests declaring <depend>upstream_pkg</depend> automatically resolve to the correct renamed binary package (e.g., vendor-extendable-upstream-pkg) from the APT/RPM repository.

Source Rebuild Behavior

When extending with source_rebuild, upstream packages are rebuilt from source within the downstream build environment. This allows modifying build flags, targeting new platform architectures, or creating patched source overlays while inheriting the upstream package manifest definitions.

Rationale

Lightweight Regex over Template Engines

While templating engines such as EmPy and Jinja2 provide extensive programming capabilities and conditionals, adopting them in rosdistro would add mandatory third-party dependencies to the most fundamental tools in the ROS ecosystem (rosdistro, rosdep, bloom, and ros_buildfarm). By selecting declarative regular expression search-and-replace (binary_rule) powered by Python’s built-in re module:

  • Zero Additional Dependencies: Core tools maintain a minimal dependency footprint, essential for bootstrap environments and base container images.
  • Simplicity & Predictability: Single search-and-replace rules avoid unintended evaluation side-effects and simplify configuration schemas.
  • Full Coverage of Real-World Scenarios: Testing validated that regex search-and-replace cleanly handles prefixing (vendor-{distro}-*), un-prefixed naming (Gazebo), and individual package overrides.

Backwards Compatibility

All of the new fields are optional and they will not be necessary unless the new extension mechanisms are used. In the case that dependencies are not declared they will be assumed to be blank and that there are no required dependencies.

Implmenetation

A lot of this work is in the implementation details for the binary builds.

This will require updates and extensions to many of the tools throughout the ecosystem

  • rosdistro library - parsing the files and answering queries about the packages, catch exceptions
  • rosdistro cache - respect the caching, chain the caches
  • rosinstall_generator - traverse across distro boundaries appropriately
  • ros_buildfarm - leverage the cache and rosdistro libraries to build across the multiple distros, for each platform type
  • rosdep work better with rosdistro embedded mappings, or other tools to make sure rosdep sources are up to date on the system separately and not change rosdep source logic.

How to use the template

Follow these steps to use the template and begin drafting your proposed REP.

  1. Add the full URL to all relevant discussion threads on the Open Robotics Discourse to the Discussion field. Do not use link shorteners. If no discussion thread yet exists, use Pending for this field, but remember to update the field with the discussion thread links once they become available, or your REP will not be accepted.
  2. Fill in the Supersedes field, if your REP will make one or more existing Finalized REPs obsolete.
  3. Write the Abstract, Motivation, Specification, Rationale, and any other necessary sections for your REP. Replace all the existing text from the original file with your own.
  4. Create a pull request against the REPs repository to add your REP as a draft.

Other than the Header, which must be in RFC 2822 format, all content in the REP’s source Markdown file must comply with the GitHub Flavored Markdown Specification. Within the file, lines must not be wrapped, and each sentence must start on a new line (i.e. each sentence is on its own line). This is necessary to ensure pull request diffs are sufficiently readable.

TODO Sections below

# How to Teach This

[For a REP that adds or changes user-facing behaviour, include a section on how to effectively teach both new and experienced users how to apply the REP.]

# Implementation

[The implementation must be completed before the REP can be moved to the Finalized state, but it does not need to be completed for the REP to be Accepted]

# Rejected Ideas

[Throughout the discussion of a REP, ideas may be proposed which are ultimately rejected.]

# Known Issues

[While a Draft REP is being worked on and discussed, ideas can come up that warrant further discussion or require additional work.]

License

This document is marked CC0 1.0 Universal. To view a copy of this mark, visit https://creativecommons.org/publicdomain/zero/1.0/.

This post is licensed under CC BY 4.0 by the author.